Skip to content

Commit

Permalink
Update Cocoapods.
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesmchen-signal committed Nov 7, 2019
1 parent 6ae507b commit a126686
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 17 deletions.
4 changes: 3 additions & 1 deletion AxolotlKit/AxolotlKitTests/SessionBuilderTests.m
Expand Up @@ -80,7 +80,9 @@ - (void)testBasicPreKey {
XCTAssert([outgoingMessage isKindOfClass:[PreKeyWhisperMessage class]], @"Message should be PreKey type");

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

SessionCipher *bobSessionCipher = [[SessionCipher alloc] initWithAxolotlStore:bobStore recipientId:ALICE_RECIPIENT_ID deviceId:1];
Expand Down
12 changes: 3 additions & 9 deletions AxolotlKit/AxolotlKitTests/Util/ECKeyPair+ECKeyPairTesting.m
Expand Up @@ -7,14 +7,6 @@

NS_ASSUME_NONNULL_BEGIN

@interface ECKeyPair (ECKeyPairTestingPrivate)

- (nullable id)initWithPublicKey:(NSData *)publicKey privateKey:(NSData *)privateKey;

@end

#pragma mark -

@implementation ECKeyPair (testing)

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

ECKeyPair *keyPairCopy = [[ECKeyPair alloc] initWithPublicKey:[publicKey copy] privateKey:[privateKey copy]];
NSError *error;
ECKeyPair *_Nullable keyPairCopy = [[ECKeyPair alloc] initWithPublicKeyData:[publicKey copy] privateKeyData:[privateKey copy] error:&error];
OWSAssertDebug(error == nil && keyPairCopy != nil);
return keyPairCopy;
}

Expand Down
10 changes: 7 additions & 3 deletions Curve25519Kit/Classes/ECPublicKey.swift
Expand Up @@ -5,6 +5,10 @@
import Foundation
import SignalCoreKit

public enum ECKeyError: Error {
case assertionError(description: String)
}

// See:
// https://github.com/signalapp/libsignal-protocol-java/blob/87fae0f98332e98a32bbb82515428b4edeb4181f/java/src/main/java/org/whispersystems/libsignal/ecc/DjbECPublicKey.java
@objc public class ECPublicKey: NSObject {
Expand All @@ -18,7 +22,7 @@ import SignalCoreKit
@objc
public init(keyData: Data) throws {
guard keyData.count == ECCKeyLength else {
throw OWSAssertionError("\(ECPublicKey.logTag) key has invalid length")
throw ECKeyError.assertionError(description: "\(ECPublicKey.logTag) key has invalid length")
}

self.keyData = keyData
Expand All @@ -31,12 +35,12 @@ import SignalCoreKit

let typeByte = try parser.nextByte(name: "type byte")
guard typeByte == ECPublicKey.keyTypeDJB else {
throw OWSAssertionError("\(ECPublicKey.logTag) key data has invalid type byte")
throw ECKeyError.assertionError(description: "\(ECPublicKey.logTag) key data has invalid type byte")
}

let keyData = try parser.remainder(name: "key data")
guard keyData.count == ECCKeyLength else {
throw OWSAssertionError("\(ECPublicKey.logTag) key has invalid length")
throw ECKeyError.assertionError(description: "\(ECPublicKey.logTag) key has invalid length")
}

self.keyData = keyData
Expand Down
6 changes: 3 additions & 3 deletions Manifest.lock
Expand Up @@ -296,13 +296,13 @@ EXTERNAL SOURCES:

CHECKOUT OPTIONS:
AxolotlKit:
:commit: 905c5d0e0cd22dc290e6992b3d4790d07e347c41
:commit: 97bc4ea1014c0cfac539e87444e3d0bb98a264ba
:git: https://github.com/signalapp/SignalProtocolKit.git
blurhash:
:commit: e2b1540fc24867c83971045542483b91a46eb115
:git: https://github.com/signalapp/blurhash
Curve25519Kit:
:commit: 877c48f4bc46feccb952f198de743c8525aa8e94
:commit: 4fc1c10e98fff2534b5379a9bb587430fdb8e577
:git: https://github.com/signalapp/Curve25519Kit
GRKOpenSSLFramework:
:commit: 4d9944de35ed56a95879c5a8a1b410ae03f71d57
Expand All @@ -317,7 +317,7 @@ CHECKOUT OPTIONS:
:commit: 2794df474414736d9deca3ff1011b7841850c4a0
:git: https://github.com/signalapp/SignalCoreKit.git
SignalMetadataKit:
:commit: b572f728d015d40cdb1e50ed790fb36c972dec0c
:commit: 33dc101ee66b25ba6f4310dce04d48276a934781
:git: "git@github.com:signalapp/SignalMetadataKit"
Starscream:
:commit: b09ea163c3cb305152c65b299cb024610f52e735
Expand Down
Expand Up @@ -172,6 +172,9 @@ class SMKServerCertificateTest: XCTestCase {
} catch SMKError.assertionError {
// Some bad certificates will fail to parse.
continue
} catch ECKeyError.assertionError {
// Some bad certificates will fail to parse.
continue
} catch {
XCTFail("Unexpected parsing error: \(error)")
continue
Expand Down
Expand Up @@ -81,7 +81,7 @@ class MockClient: NSObject {
func generateMockPreKey() -> PreKeyRecord {
let preKeyId: Int32 = Int32(arc4random_uniform(UInt32(INT32_MAX)))
let keyPair = Curve25519.generateKeyPair()
let preKey = PreKeyRecord(id: preKeyId, keyPair: keyPair)!
let preKey = PreKeyRecord(id: preKeyId, keyPair: keyPair, createdAt: Date())!
self.preKeyStore.storePreKey(preKeyId, preKeyRecord: preKey)
return preKey
}
Expand Down

0 comments on commit a126686

Please sign in to comment.