determine if recipient identity change is unseen

// FREEBIE
pull/1/head
Michael Kirk 8 years ago
parent cd7a172b94
commit e10cc0c180

@ -40,6 +40,13 @@ extern NSString *const TSStorageManagerTrustedKeysCollection;
*/
- (nullable OWSRecipientIdentity *)unconfirmedIdentityThatShouldBlockSendingForRecipientId:(NSString *)recipientId;
/**
* @param recipientId unique stable identifier for the recipient, e.g. e164 phone number
* @returns YES if the recipient's id has not been marked as seen (and it's not a TOFU situation)
* NO if the recipient's current id has been seen, or if it's the users first key
*/
- (BOOL)hasUnseenIdentityChangeForRecipientId:(NSString *)recipientId;
- (void)generateNewIdentityKey;
- (nullable NSData *)identityKeyForRecipientId:(NSString *)recipientId;
- (void)removeIdentityKeyForRecipient:(NSString *)receipientId;

@ -278,6 +278,24 @@ const NSTimeInterval kIdentityKeyStoreNonBlockingSecondsThreshold = 5.0;
}
}
- (BOOL)hasUnseenIdentityChangeForRecipientId:(NSString *)recipientId
{
OWSAssert(recipientId != nil);
OWSRecipientIdentity *recipientIdentity = [OWSRecipientIdentity fetchObjectWithUniqueID:recipientId];
if (!recipientIdentity) {
return NO;
}
if (recipientIdentity.isFirstKnownKey) {
return NO;
}
return !recipientIdentity.wasSeen;
}
@end
NS_ASSUME_NONNULL_END

Loading…
Cancel
Save