Skip to content

Commit 3407309

Browse files
Use protocol contexts in prekey stores.
1 parent 61ce278 commit 3407309

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

AxolotlKit/Classes/Sessions/SessionBuilder.m

+5-2
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,13 @@ - (int)throws_processPrekeyV3:(PreKeyWhisperMessage *)message
211211
SignedPreKeyRecord *_Nullable signedPreKeyRecord = [self.signedPreKeyStore loadSignedPreKey:message.signedPrekeyId
212212
protocolContext:protocolContext];
213213
if (signedPreKeyRecord == nil) {
214-
DDLogWarn(@"%@ Signed prekey id: %lu, prekey id: %lu.", self.tag,
214+
OWSLogWarn(@"Signed prekey id: %lu, prekey id: %lu.",
215215
(unsigned long) message.signedPrekeyId,
216216
(unsigned long) message.prekeyID);
217-
OWSRaiseException(InvalidKeyIdException, @"No signed pre key found matching key id");
217+
OWSLogWarn(@"Available signed prekey ids: %@",
218+
[self.signedPreKeyStore availableSignedPreKeyIdsWithProtocolContext:protocolContext]);
219+
220+
OWSRaiseException(InvalidKeyIdException, @"No signed prekey found matching key id");
218221
}
219222
ECKeyPair *ourSignedPrekey = signedPreKeyRecord.keyPair;
220223

AxolotlKit/Classes/State/SignedPreKeyStore.h

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ NS_ASSUME_NONNULL_BEGIN
2424
- (void)removeSignedPreKey:(int)signedPreKeyId
2525
protocolContext:(nullable id<SPKProtocolWriteContext>)protocolContext;
2626

27+
- (NSArray<NSString *> *)availableSignedPreKeyIdsWithProtocolContext:(nullable id<SPKProtocolReadContext>)protocolContext;
28+
2729
@end
2830

2931
NS_ASSUME_NONNULL_END

AxolotlKit/Classes/TestUtils/SPKMockProtocolStore.m

+5
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ - (nullable SignedPreKeyRecord *)loadSignedPreKey:(int)signedPreKeyId
6969
return results;
7070
}
7171

72+
- (NSArray<NSString *> *)availableSignedPreKeyIdsWithProtocolContext:(nullable id<SPKProtocolReadContext>)protocolContext
73+
{
74+
return @[];
75+
}
76+
7277
- (void)storeSignedPreKey:(int)signedPreKeyId
7378
signedPreKeyRecord:(SignedPreKeyRecord *)signedPreKeyRecord
7479
protocolContext:(nullable id<SPKProtocolWriteContext>)protocolContext

0 commit comments

Comments
 (0)