2017-05-23 16:28:50 +02:00
|
|
|
//
|
2018-01-23 19:58:45 +01:00
|
|
|
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
2017-05-23 16:28:50 +02:00
|
|
|
//
|
|
|
|
|
2017-06-22 19:36:40 +02:00
|
|
|
#import "TSYapDatabaseObject.h"
|
2017-05-23 16:28:50 +02:00
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
|
2017-06-06 21:01:11 +02:00
|
|
|
typedef NS_ENUM(NSUInteger, OWSVerificationState) {
|
|
|
|
OWSVerificationStateDefault,
|
|
|
|
OWSVerificationStateVerified,
|
|
|
|
OWSVerificationStateNoLongerVerified,
|
|
|
|
};
|
|
|
|
|
2018-08-02 19:29:24 +02:00
|
|
|
@class SSKProtoVerified;
|
|
|
|
|
2017-06-06 21:01:11 +02:00
|
|
|
NSString *OWSVerificationStateToString(OWSVerificationState verificationState);
|
2018-08-03 20:35:22 +02:00
|
|
|
SSKProtoVerified *_Nullable BuildVerifiedProtoWithRecipientId(NSString *destinationRecipientId,
|
2018-08-02 19:29:24 +02:00
|
|
|
NSData *identityKey,
|
|
|
|
OWSVerificationState verificationState,
|
|
|
|
NSUInteger paddingBytesLength);
|
2017-06-06 21:01:11 +02:00
|
|
|
|
2017-05-23 16:28:50 +02:00
|
|
|
@interface OWSRecipientIdentity : TSYapDatabaseObject
|
|
|
|
|
|
|
|
@property (nonatomic, readonly) NSString *recipientId;
|
|
|
|
@property (nonatomic, readonly) NSData *identityKey;
|
|
|
|
@property (nonatomic, readonly) NSDate *createdAt;
|
|
|
|
@property (nonatomic, readonly) BOOL isFirstKnownKey;
|
2017-05-25 02:30:30 +02:00
|
|
|
|
2017-06-06 21:01:11 +02:00
|
|
|
#pragma mark - Verification State
|
2017-05-25 02:30:30 +02:00
|
|
|
|
2017-06-06 21:01:11 +02:00
|
|
|
@property (atomic, readonly) OWSVerificationState verificationState;
|
2017-05-25 02:30:30 +02:00
|
|
|
|
2018-01-23 19:58:45 +01:00
|
|
|
- (void)updateWithVerificationState:(OWSVerificationState)verificationState
|
|
|
|
transaction:(YapDatabaseReadWriteTransaction *)transaction;
|
2017-05-25 02:30:30 +02:00
|
|
|
|
|
|
|
#pragma mark - Initializers
|
2017-05-23 16:28:50 +02:00
|
|
|
|
2017-11-15 19:15:48 +01:00
|
|
|
- (instancetype)initWithUniqueId:(NSString *_Nullable)uniqueId NS_UNAVAILABLE;
|
2017-05-23 16:28:50 +02:00
|
|
|
|
2017-06-06 21:01:11 +02:00
|
|
|
- (instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER;
|
|
|
|
|
2017-05-23 16:28:50 +02:00
|
|
|
- (instancetype)initWithRecipientId:(NSString *)recipientId
|
|
|
|
identityKey:(NSData *)identityKey
|
|
|
|
isFirstKnownKey:(BOOL)isFirstKnownKey
|
|
|
|
createdAt:(NSDate *)createdAt
|
2017-06-06 21:01:11 +02:00
|
|
|
verificationState:(OWSVerificationState)verificationState NS_DESIGNATED_INITIALIZER;
|
2017-05-23 16:28:50 +02:00
|
|
|
|
|
|
|
#pragma mark - debug
|
|
|
|
|
|
|
|
+ (void)printAllIdentities;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_END
|