Skip to content

Commit 97bc4ea

Browse files
Merge branch 'charlesmchen/fixBrokenTests'
2 parents 905c5d0 + ddcdbd0 commit 97bc4ea

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

AxolotlKitTests/SessionBuilderTests.m

+3-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ - (void)testBasicPreKey {
8080
XCTAssert([outgoingMessage isKindOfClass:[PreKeyWhisperMessage class]], @"Message should be PreKey type");
8181

8282
PreKeyWhisperMessage *incomingMessage = (PreKeyWhisperMessage*)outgoingMessage;
83-
[bobStore storePreKey:31337 preKeyRecord:[[PreKeyRecord alloc] initWithId:bobPreKey.preKeyId keyPair:bobPreKeyPair]];
83+
[bobStore storePreKey:31337 preKeyRecord:[[PreKeyRecord alloc] initWithId:bobPreKey.preKeyId
84+
keyPair:bobPreKeyPair
85+
createdAt:[NSDate date]]];
8486
[bobStore storeSignedPreKey:22 signedPreKeyRecord:[[SignedPreKeyRecord alloc] initWithId:22 keyPair:bobSignedPreKeyPair signature:bobSignedPreKeySignature generatedAt:[NSDate date]]];
8587

8688
SessionCipher *bobSessionCipher = [[SessionCipher alloc] initWithAxolotlStore:bobStore recipientId:ALICE_RECIPIENT_ID deviceId:1];

AxolotlKitTests/Util/ECKeyPair+ECKeyPairTesting.m

+3-9
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,6 @@
77

88
NS_ASSUME_NONNULL_BEGIN
99

10-
@interface ECKeyPair (ECKeyPairTestingPrivate)
11-
12-
- (nullable id)initWithPublicKey:(NSData *)publicKey privateKey:(NSData *)privateKey;
13-
14-
@end
15-
16-
#pragma mark -
17-
1810
@implementation ECKeyPair (testing)
1911

2012
+ (ECKeyPair *)throws_keyPairWithPrivateKey:(NSData *)privateKey publicKey:(NSData *)publicKey
@@ -27,7 +19,9 @@ + (ECKeyPair *)throws_keyPairWithPrivateKey:(NSData *)privateKey publicKey:(NSDa
2719
@throw [NSException exceptionWithName:NSInvalidArgumentException reason:@"Public or Private key is not required size" userInfo:@{@"PrivateKey":privateKey, @"Public Key":publicKey}];
2820
}
2921

30-
ECKeyPair *keyPairCopy = [[ECKeyPair alloc] initWithPublicKey:[publicKey copy] privateKey:[privateKey copy]];
22+
NSError *error;
23+
ECKeyPair *_Nullable keyPairCopy = [[ECKeyPair alloc] initWithPublicKeyData:[publicKey copy] privateKeyData:[privateKey copy] error:&error];
24+
OWSAssertDebug(error == nil && keyPairCopy != nil);
3125
return keyPairCopy;
3226
}
3327

0 commit comments

Comments
 (0)