78 lines
2.6 KiB
Objective-C
78 lines
2.6 KiB
Objective-C
//
|
|
// Copyright (c) 2020 Open Whisper Systems. All rights reserved.
|
|
//
|
|
|
|
#import "BaseModel.h"
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
typedef NS_CLOSED_ENUM(NSUInteger, OWSVerificationState) {
|
|
OWSVerificationStateDefault,
|
|
OWSVerificationStateVerified,
|
|
OWSVerificationStateNoLongerVerified,
|
|
};
|
|
|
|
@class SDSAnyWriteTransaction;
|
|
@class SSKProtoVerified;
|
|
@class SignalServiceAddress;
|
|
|
|
NSString *OWSVerificationStateToString(OWSVerificationState verificationState);
|
|
SSKProtoVerified *_Nullable BuildVerifiedProtoWithAddress(SignalServiceAddress *destinationAddress,
|
|
NSData *identityKey,
|
|
OWSVerificationState verificationState,
|
|
NSUInteger paddingBytesLength);
|
|
|
|
@interface OWSRecipientIdentity : BaseModel
|
|
|
|
@property (nonatomic, readonly) NSString *accountId;
|
|
@property (nonatomic, readonly) NSData *identityKey;
|
|
@property (nonatomic, readonly) NSDate *createdAt;
|
|
@property (nonatomic, readonly) BOOL isFirstKnownKey;
|
|
|
|
#pragma mark - Verification State
|
|
|
|
@property (atomic, readonly) OWSVerificationState verificationState;
|
|
|
|
- (void)updateWithVerificationState:(OWSVerificationState)verificationState
|
|
transaction:(SDSAnyWriteTransaction *)transaction;
|
|
|
|
#pragma mark - Initializers
|
|
|
|
- (instancetype)init NS_UNAVAILABLE;
|
|
- (nullable instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER;
|
|
- (instancetype)initWithUniqueId:(NSString *)uniqueId NS_UNAVAILABLE;
|
|
- (instancetype)initWithGrdbId:(int64_t)grdbId uniqueId:(NSString *)uniqueId NS_UNAVAILABLE;
|
|
|
|
- (instancetype)initWithAccountId:(NSString *)accountId
|
|
identityKey:(NSData *)identityKey
|
|
isFirstKnownKey:(BOOL)isFirstKnownKey
|
|
createdAt:(NSDate *)createdAt
|
|
verificationState:(OWSVerificationState)verificationState NS_DESIGNATED_INITIALIZER;
|
|
|
|
// --- CODE GENERATION MARKER
|
|
|
|
// This snippet is generated by /Scripts/sds_codegen/sds_generate.py. Do not manually edit it, instead run `sds_codegen.sh`.
|
|
|
|
// clang-format off
|
|
|
|
- (instancetype)initWithGrdbId:(int64_t)grdbId
|
|
uniqueId:(NSString *)uniqueId
|
|
accountId:(NSString *)accountId
|
|
createdAt:(NSDate *)createdAt
|
|
identityKey:(NSData *)identityKey
|
|
isFirstKnownKey:(BOOL)isFirstKnownKey
|
|
verificationState:(OWSVerificationState)verificationState
|
|
NS_DESIGNATED_INITIALIZER NS_SWIFT_NAME(init(grdbId:uniqueId:accountId:createdAt:identityKey:isFirstKnownKey:verificationState:));
|
|
|
|
// clang-format on
|
|
|
|
// --- CODE GENERATION MARKER
|
|
|
|
#pragma mark - debug
|
|
|
|
+ (void)printAllIdentities;
|
|
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END
|