From 719eb543a8d08c4f536ea7933ffb3af0a8553e87 Mon Sep 17 00:00:00 2001 From: Chris Ballinger Date: Fri, 8 Apr 2016 17:24:41 -0700 Subject: Xcode, podspec, wrapper --- xcode/OLMKitTests/OLMKitTests.m | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 xcode/OLMKitTests/OLMKitTests.m (limited to 'xcode/OLMKitTests/OLMKitTests.m') diff --git a/xcode/OLMKitTests/OLMKitTests.m b/xcode/OLMKitTests/OLMKitTests.m new file mode 100644 index 0000000..944d11c --- /dev/null +++ b/xcode/OLMKitTests/OLMKitTests.m @@ -0,0 +1,41 @@ +// +// OLMKitTests.m +// OLMKitTests +// +// Created by Chris Ballinger on 4/8/16. +// +// + +#import +@import OLMKit; + +@interface OLMKitTests : XCTestCase + +@end + +@implementation OLMKitTests + +- (void)setUp { + [super setUp]; + // Put setup code here. This method is called before the invocation of each test method in the class. +} + +- (void)tearDown { + // Put teardown code here. This method is called after the invocation of each test method in the class. + [super tearDown]; +} + +- (void)testExample { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct results. + OLMAccount *alice = [[OLMAccount alloc] initNewAccount]; + OLMAccount *bob = [[OLMAccount alloc] initNewAccount]; + [bob generateOneTimeKeys:5]; + NSDictionary *identityKeys = bob.identityKeys; + NSDictionary *oneTimeKeys = bob.oneTimeKeys; + NSParameterAssert(identityKeys != nil); + NSParameterAssert(oneTimeKeys != nil); +} + + +@end -- cgit v1.2.3 From f505113fb7a6d61015ad8050b3fb4e26df029150 Mon Sep 17 00:00:00 2001 From: Chris Ballinger Date: Sat, 9 Apr 2016 14:00:30 -0700 Subject: Initial test passing --- xcode/OLMKitTests/OLMKitTests.m | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'xcode/OLMKitTests/OLMKitTests.m') diff --git a/xcode/OLMKitTests/OLMKitTests.m b/xcode/OLMKitTests/OLMKitTests.m index 944d11c..7075057 100644 --- a/xcode/OLMKitTests/OLMKitTests.m +++ b/xcode/OLMKitTests/OLMKitTests.m @@ -31,10 +31,27 @@ OLMAccount *alice = [[OLMAccount alloc] initNewAccount]; OLMAccount *bob = [[OLMAccount alloc] initNewAccount]; [bob generateOneTimeKeys:5]; - NSDictionary *identityKeys = bob.identityKeys; - NSDictionary *oneTimeKeys = bob.oneTimeKeys; - NSParameterAssert(identityKeys != nil); - NSParameterAssert(oneTimeKeys != nil); + NSDictionary *bobIdKeys = bob.identityKeys; + NSString *bobIdKey = bobIdKeys[@"curve25519"]; + NSDictionary *bobOneTimeKeys = bob.oneTimeKeys; + NSParameterAssert(bobIdKey != nil); + NSParameterAssert(bobOneTimeKeys != nil); + __block NSString *bobOneTimeKey = nil; + NSDictionary *bobOtkCurve25519 = bobOneTimeKeys[@"curve25519"]; + [bobOtkCurve25519 enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id _Nonnull obj, BOOL * _Nonnull stop) { + bobOneTimeKey = obj; + }]; + XCTAssert([bobOneTimeKey isKindOfClass:[NSString class]]); + + OLMSession *aliceSession = [[OLMSession alloc] initOutboundSessionWithAccount:alice theirIdentityKey:bobIdKey theirOneTimeKey:bobOneTimeKey]; + NSString *message = @"Hello!"; + OLMMessage *aliceToBobMsg = [aliceSession encryptMessage:message]; + + OLMSession *bobSession = [[OLMSession alloc] initInboundSessionWithAccount:bob oneTimeKeyMessage:aliceToBobMsg.ciphertext]; + NSString *plaintext = [bobSession decryptMessage:aliceToBobMsg]; + XCTAssertEqualObjects(message, plaintext); + BOOL success = [bobSession removeOneTimeKeys]; + XCTAssertTrue(success); } -- cgit v1.2.3 From daab2a58af947cddd67fe9f30dd3a9fc327650c0 Mon Sep 17 00:00:00 2001 From: Chris Ballinger Date: Wed, 13 Apr 2016 16:53:47 -0700 Subject: OLMAccount and OLMSession serialization --- xcode/OLMKitTests/OLMKitTests.m | 111 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 107 insertions(+), 4 deletions(-) (limited to 'xcode/OLMKitTests/OLMKitTests.m') diff --git a/xcode/OLMKitTests/OLMKitTests.m b/xcode/OLMKitTests/OLMKitTests.m index 7075057..c76d636 100644 --- a/xcode/OLMKitTests/OLMKitTests.m +++ b/xcode/OLMKitTests/OLMKitTests.m @@ -25,9 +25,7 @@ [super tearDown]; } -- (void)testExample { - // This is an example of a functional test case. - // Use XCTAssert and related functions to verify your tests produce the correct results. +- (void)testAliceAndBob { OLMAccount *alice = [[OLMAccount alloc] initNewAccount]; OLMAccount *bob = [[OLMAccount alloc] initNewAccount]; [bob generateOneTimeKeys:5]; @@ -50,9 +48,114 @@ OLMSession *bobSession = [[OLMSession alloc] initInboundSessionWithAccount:bob oneTimeKeyMessage:aliceToBobMsg.ciphertext]; NSString *plaintext = [bobSession decryptMessage:aliceToBobMsg]; XCTAssertEqualObjects(message, plaintext); - BOOL success = [bobSession removeOneTimeKeys]; + BOOL success = [bob removeOneTimeKeysForSession:bobSession]; XCTAssertTrue(success); } +- (void) testBackAndForth { + OLMAccount *alice = [[OLMAccount alloc] initNewAccount]; + OLMAccount *bob = [[OLMAccount alloc] initNewAccount]; + [bob generateOneTimeKeys:1]; + NSDictionary *bobIdKeys = bob.identityKeys; + NSString *bobIdKey = bobIdKeys[@"curve25519"]; + NSDictionary *bobOneTimeKeys = bob.oneTimeKeys; + NSParameterAssert(bobIdKey != nil); + NSParameterAssert(bobOneTimeKeys != nil); + __block NSString *bobOneTimeKey = nil; + NSDictionary *bobOtkCurve25519 = bobOneTimeKeys[@"curve25519"]; + [bobOtkCurve25519 enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id _Nonnull obj, BOOL * _Nonnull stop) { + bobOneTimeKey = obj; + }]; + XCTAssert([bobOneTimeKey isKindOfClass:[NSString class]]); + + OLMSession *aliceSession = [[OLMSession alloc] initOutboundSessionWithAccount:alice theirIdentityKey:bobIdKey theirOneTimeKey:bobOneTimeKey]; + NSString *message = @"Hello I'm Alice!"; + OLMMessage *aliceToBobMsg = [aliceSession encryptMessage:message]; + + OLMSession *bobSession = [[OLMSession alloc] initInboundSessionWithAccount:bob oneTimeKeyMessage:aliceToBobMsg.ciphertext]; + NSString *plaintext = [bobSession decryptMessage:aliceToBobMsg]; + XCTAssertEqualObjects(message, plaintext); + BOOL success = [bob removeOneTimeKeysForSession:bobSession]; + XCTAssertTrue(success); + + NSString *msg1 = @"Hello I'm Bob!"; + NSString *msg2 = @"Isn't life grand?"; + NSString *msg3 = @"Let's go to the opera."; + + OLMMessage *eMsg1 = [bobSession encryptMessage:msg1]; + OLMMessage *eMsg2 = [bobSession encryptMessage:msg2]; + OLMMessage *eMsg3 = [bobSession encryptMessage:msg3]; + + NSString *dMsg1 = [aliceSession decryptMessage:eMsg1]; + NSString *dMsg2 = [aliceSession decryptMessage:eMsg2]; + NSString *dMsg3 = [aliceSession decryptMessage:eMsg3]; + XCTAssertEqualObjects(msg1, dMsg1); + XCTAssertEqualObjects(msg2, dMsg2); + XCTAssertEqualObjects(msg3, dMsg3); + + +} + +- (void) testAccountSerialization { + OLMAccount *bob = [[OLMAccount alloc] initNewAccount]; + [bob generateOneTimeKeys:5]; + NSDictionary *bobIdKeys = bob.identityKeys; + NSDictionary *bobOneTimeKeys = bob.oneTimeKeys; + + NSData *bobData = [NSKeyedArchiver archivedDataWithRootObject:bob]; + + OLMAccount *bob2 = [NSKeyedUnarchiver unarchiveObjectWithData:bobData]; + NSDictionary *bobIdKeys2 = bob2.identityKeys; + NSDictionary *bobOneTimeKeys2 = bob.oneTimeKeys; + + XCTAssertEqualObjects(bobIdKeys, bobIdKeys2); + XCTAssertEqualObjects(bobOneTimeKeys, bobOneTimeKeys2); +} + +- (void) testSessionSerialization { + OLMAccount *alice = [[OLMAccount alloc] initNewAccount]; + OLMAccount *bob = [[OLMAccount alloc] initNewAccount]; + [bob generateOneTimeKeys:1]; + NSDictionary *bobIdKeys = bob.identityKeys; + NSString *bobIdKey = bobIdKeys[@"curve25519"]; + NSDictionary *bobOneTimeKeys = bob.oneTimeKeys; + NSParameterAssert(bobIdKey != nil); + NSParameterAssert(bobOneTimeKeys != nil); + __block NSString *bobOneTimeKey = nil; + NSDictionary *bobOtkCurve25519 = bobOneTimeKeys[@"curve25519"]; + [bobOtkCurve25519 enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id _Nonnull obj, BOOL * _Nonnull stop) { + bobOneTimeKey = obj; + }]; + XCTAssert([bobOneTimeKey isKindOfClass:[NSString class]]); + + OLMSession *aliceSession = [[OLMSession alloc] initOutboundSessionWithAccount:alice theirIdentityKey:bobIdKey theirOneTimeKey:bobOneTimeKey]; + NSString *message = @"Hello I'm Alice!"; + OLMMessage *aliceToBobMsg = [aliceSession encryptMessage:message]; + + OLMSession *bobSession = [[OLMSession alloc] initInboundSessionWithAccount:bob oneTimeKeyMessage:aliceToBobMsg.ciphertext]; + NSString *plaintext = [bobSession decryptMessage:aliceToBobMsg]; + XCTAssertEqualObjects(message, plaintext); + BOOL success = [bob removeOneTimeKeysForSession:bobSession]; + XCTAssertTrue(success); + + NSString *msg1 = @"Hello I'm Bob!"; + NSString *msg2 = @"Isn't life grand?"; + NSString *msg3 = @"Let's go to the opera."; + + OLMMessage *eMsg1 = [bobSession encryptMessage:msg1]; + OLMMessage *eMsg2 = [bobSession encryptMessage:msg2]; + OLMMessage *eMsg3 = [bobSession encryptMessage:msg3]; + + NSData *aliceData = [NSKeyedArchiver archivedDataWithRootObject:aliceSession]; + OLMSession *alice2 = [NSKeyedUnarchiver unarchiveObjectWithData:aliceData]; + + NSString *dMsg1 = [alice2 decryptMessage:eMsg1]; + NSString *dMsg2 = [alice2 decryptMessage:eMsg2]; + NSString *dMsg3 = [alice2 decryptMessage:eMsg3]; + XCTAssertEqualObjects(msg1, dMsg1); + XCTAssertEqualObjects(msg2, dMsg2); + XCTAssertEqualObjects(msg3, dMsg3); +} + @end -- cgit v1.2.3 From 6f113dd7b3b4de918c4efb81d38a1ffe1d391b5b Mon Sep 17 00:00:00 2001 From: manuroe Date: Tue, 27 Sep 2016 11:57:29 +0200 Subject: OLMKit: Make the project build Make OLMKit CocoaPods expose the obj-c wrapper of libolm --- xcode/OLMKitTests/OLMKitTests.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'xcode/OLMKitTests/OLMKitTests.m') diff --git a/xcode/OLMKitTests/OLMKitTests.m b/xcode/OLMKitTests/OLMKitTests.m index c76d636..a7280f8 100644 --- a/xcode/OLMKitTests/OLMKitTests.m +++ b/xcode/OLMKitTests/OLMKitTests.m @@ -7,7 +7,7 @@ // #import -@import OLMKit; +#import @interface OLMKitTests : XCTestCase -- cgit v1.2.3 From 3cb01fd27971a6f8c5d76fddb8676ef76c636a23 Mon Sep 17 00:00:00 2001 From: manuroe Date: Tue, 11 Oct 2016 16:54:56 +0200 Subject: OLMKit: Fixed typo in test --- xcode/OLMKitTests/OLMKitTests.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'xcode/OLMKitTests/OLMKitTests.m') diff --git a/xcode/OLMKitTests/OLMKitTests.m b/xcode/OLMKitTests/OLMKitTests.m index a7280f8..5459c85 100644 --- a/xcode/OLMKitTests/OLMKitTests.m +++ b/xcode/OLMKitTests/OLMKitTests.m @@ -106,7 +106,7 @@ OLMAccount *bob2 = [NSKeyedUnarchiver unarchiveObjectWithData:bobData]; NSDictionary *bobIdKeys2 = bob2.identityKeys; - NSDictionary *bobOneTimeKeys2 = bob.oneTimeKeys; + NSDictionary *bobOneTimeKeys2 = bob2.oneTimeKeys; XCTAssertEqualObjects(bobIdKeys, bobIdKeys2); XCTAssertEqualObjects(bobOneTimeKeys, bobOneTimeKeys2); -- cgit v1.2.3 From 4a2aac5800dacb3de935f6594e4d213087cb7cb5 Mon Sep 17 00:00:00 2001 From: manuroe Date: Fri, 14 Oct 2016 15:57:12 +0200 Subject: OLMKit: Add signature tests --- xcode/OLMKitTests/OLMKitTests.m | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'xcode/OLMKitTests/OLMKitTests.m') diff --git a/xcode/OLMKitTests/OLMKitTests.m b/xcode/OLMKitTests/OLMKitTests.m index 5459c85..7edc062 100644 --- a/xcode/OLMKitTests/OLMKitTests.m +++ b/xcode/OLMKitTests/OLMKitTests.m @@ -157,5 +157,25 @@ XCTAssertEqualObjects(msg3, dMsg3); } +- (void)testEd25519Signing { + + OLMUtility *olmUtility = [[OLMUtility alloc] init]; + OLMAccount *alice = [[OLMAccount alloc] initNewAccount]; + + NSDictionary *aJSON = @{ + @"key1": @"value1", + @"key2": @"value2" + }; + NSData *message = [NSKeyedArchiver archivedDataWithRootObject:aJSON]; + NSString *signature = [alice signMessage:message]; + + + NSString *aliceEd25519Key = alice.identityKeys[@"ed25519"]; + + NSError *error; + BOOL result = [olmUtility verifyEd25519Signature:signature key:aliceEd25519Key message:message error:&error]; + XCTAssert(result); + XCTAssertNil(error); +} @end -- cgit v1.2.3 From cf66af6f2e7c69a3e0712317f8473ab09711d426 Mon Sep 17 00:00:00 2001 From: manuroe Date: Mon, 14 Nov 2016 16:54:51 +0100 Subject: OLMKit: Replaced NSAsserts by NSErrors --- xcode/OLMKitTests/OLMKitTests.m | 56 +++++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 24 deletions(-) (limited to 'xcode/OLMKitTests/OLMKitTests.m') diff --git a/xcode/OLMKitTests/OLMKitTests.m b/xcode/OLMKitTests/OLMKitTests.m index 7edc062..251c90e 100644 --- a/xcode/OLMKitTests/OLMKitTests.m +++ b/xcode/OLMKitTests/OLMKitTests.m @@ -26,6 +26,8 @@ } - (void)testAliceAndBob { + NSError *error; + OLMAccount *alice = [[OLMAccount alloc] initNewAccount]; OLMAccount *bob = [[OLMAccount alloc] initNewAccount]; [bob generateOneTimeKeys:5]; @@ -41,13 +43,15 @@ }]; XCTAssert([bobOneTimeKey isKindOfClass:[NSString class]]); - OLMSession *aliceSession = [[OLMSession alloc] initOutboundSessionWithAccount:alice theirIdentityKey:bobIdKey theirOneTimeKey:bobOneTimeKey]; + OLMSession *aliceSession = [[OLMSession alloc] initOutboundSessionWithAccount:alice theirIdentityKey:bobIdKey theirOneTimeKey:bobOneTimeKey error:nil]; NSString *message = @"Hello!"; - OLMMessage *aliceToBobMsg = [aliceSession encryptMessage:message]; + OLMMessage *aliceToBobMsg = [aliceSession encryptMessage:message error:&error]; + XCTAssertNil(error); - OLMSession *bobSession = [[OLMSession alloc] initInboundSessionWithAccount:bob oneTimeKeyMessage:aliceToBobMsg.ciphertext]; - NSString *plaintext = [bobSession decryptMessage:aliceToBobMsg]; + OLMSession *bobSession = [[OLMSession alloc] initInboundSessionWithAccount:bob oneTimeKeyMessage:aliceToBobMsg.ciphertext error:nil]; + NSString *plaintext = [bobSession decryptMessage:aliceToBobMsg error:&error]; XCTAssertEqualObjects(message, plaintext); + XCTAssertNil(error); BOOL success = [bob removeOneTimeKeysForSession:bobSession]; XCTAssertTrue(success); } @@ -68,12 +72,12 @@ }]; XCTAssert([bobOneTimeKey isKindOfClass:[NSString class]]); - OLMSession *aliceSession = [[OLMSession alloc] initOutboundSessionWithAccount:alice theirIdentityKey:bobIdKey theirOneTimeKey:bobOneTimeKey]; + OLMSession *aliceSession = [[OLMSession alloc] initOutboundSessionWithAccount:alice theirIdentityKey:bobIdKey theirOneTimeKey:bobOneTimeKey error:nil]; NSString *message = @"Hello I'm Alice!"; - OLMMessage *aliceToBobMsg = [aliceSession encryptMessage:message]; + OLMMessage *aliceToBobMsg = [aliceSession encryptMessage:message error:nil]; - OLMSession *bobSession = [[OLMSession alloc] initInboundSessionWithAccount:bob oneTimeKeyMessage:aliceToBobMsg.ciphertext]; - NSString *plaintext = [bobSession decryptMessage:aliceToBobMsg]; + OLMSession *bobSession = [[OLMSession alloc] initInboundSessionWithAccount:bob oneTimeKeyMessage:aliceToBobMsg.ciphertext error:nil]; + NSString *plaintext = [bobSession decryptMessage:aliceToBobMsg error:nil]; XCTAssertEqualObjects(message, plaintext); BOOL success = [bob removeOneTimeKeysForSession:bobSession]; XCTAssertTrue(success); @@ -82,13 +86,13 @@ NSString *msg2 = @"Isn't life grand?"; NSString *msg3 = @"Let's go to the opera."; - OLMMessage *eMsg1 = [bobSession encryptMessage:msg1]; - OLMMessage *eMsg2 = [bobSession encryptMessage:msg2]; - OLMMessage *eMsg3 = [bobSession encryptMessage:msg3]; + OLMMessage *eMsg1 = [bobSession encryptMessage:msg1 error:nil]; + OLMMessage *eMsg2 = [bobSession encryptMessage:msg2 error:nil]; + OLMMessage *eMsg3 = [bobSession encryptMessage:msg3 error:nil]; - NSString *dMsg1 = [aliceSession decryptMessage:eMsg1]; - NSString *dMsg2 = [aliceSession decryptMessage:eMsg2]; - NSString *dMsg3 = [aliceSession decryptMessage:eMsg3]; + NSString *dMsg1 = [aliceSession decryptMessage:eMsg1 error:nil]; + NSString *dMsg2 = [aliceSession decryptMessage:eMsg2 error:nil]; + NSString *dMsg3 = [aliceSession decryptMessage:eMsg3 error:nil]; XCTAssertEqualObjects(msg1, dMsg1); XCTAssertEqualObjects(msg2, dMsg2); XCTAssertEqualObjects(msg3, dMsg3); @@ -113,6 +117,8 @@ } - (void) testSessionSerialization { + NSError *error; + OLMAccount *alice = [[OLMAccount alloc] initNewAccount]; OLMAccount *bob = [[OLMAccount alloc] initNewAccount]; [bob generateOneTimeKeys:1]; @@ -128,12 +134,14 @@ }]; XCTAssert([bobOneTimeKey isKindOfClass:[NSString class]]); - OLMSession *aliceSession = [[OLMSession alloc] initOutboundSessionWithAccount:alice theirIdentityKey:bobIdKey theirOneTimeKey:bobOneTimeKey]; + OLMSession *aliceSession = [[OLMSession alloc] initOutboundSessionWithAccount:alice theirIdentityKey:bobIdKey theirOneTimeKey:bobOneTimeKey error:nil]; NSString *message = @"Hello I'm Alice!"; - OLMMessage *aliceToBobMsg = [aliceSession encryptMessage:message]; + OLMMessage *aliceToBobMsg = [aliceSession encryptMessage:message error:&error]; + XCTAssertNil(error); + - OLMSession *bobSession = [[OLMSession alloc] initInboundSessionWithAccount:bob oneTimeKeyMessage:aliceToBobMsg.ciphertext]; - NSString *plaintext = [bobSession decryptMessage:aliceToBobMsg]; + OLMSession *bobSession = [[OLMSession alloc] initInboundSessionWithAccount:bob oneTimeKeyMessage:aliceToBobMsg.ciphertext error:nil]; + NSString *plaintext = [bobSession decryptMessage:aliceToBobMsg error:nil]; XCTAssertEqualObjects(message, plaintext); BOOL success = [bob removeOneTimeKeysForSession:bobSession]; XCTAssertTrue(success); @@ -142,16 +150,16 @@ NSString *msg2 = @"Isn't life grand?"; NSString *msg3 = @"Let's go to the opera."; - OLMMessage *eMsg1 = [bobSession encryptMessage:msg1]; - OLMMessage *eMsg2 = [bobSession encryptMessage:msg2]; - OLMMessage *eMsg3 = [bobSession encryptMessage:msg3]; + OLMMessage *eMsg1 = [bobSession encryptMessage:msg1 error:nil]; + OLMMessage *eMsg2 = [bobSession encryptMessage:msg2 error:nil]; + OLMMessage *eMsg3 = [bobSession encryptMessage:msg3 error:nil]; NSData *aliceData = [NSKeyedArchiver archivedDataWithRootObject:aliceSession]; OLMSession *alice2 = [NSKeyedUnarchiver unarchiveObjectWithData:aliceData]; - NSString *dMsg1 = [alice2 decryptMessage:eMsg1]; - NSString *dMsg2 = [alice2 decryptMessage:eMsg2]; - NSString *dMsg3 = [alice2 decryptMessage:eMsg3]; + NSString *dMsg1 = [alice2 decryptMessage:eMsg1 error:nil]; + NSString *dMsg2 = [alice2 decryptMessage:eMsg2 error:nil]; + NSString *dMsg3 = [alice2 decryptMessage:eMsg3 error:nil]; XCTAssertEqualObjects(msg1, dMsg1); XCTAssertEqualObjects(msg2, dMsg2); XCTAssertEqualObjects(msg3, dMsg3); -- cgit v1.2.3 From 7ee17a295738f0db8cab74cec2343a577f2ade45 Mon Sep 17 00:00:00 2001 From: manuroe Date: Mon, 14 Nov 2016 17:35:24 +0100 Subject: OLMKit: Add missing implementations for matchesInboundSession matchesInboundSessionFrom --- xcode/OLMKitTests/OLMKitTests.m | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'xcode/OLMKitTests/OLMKitTests.m') diff --git a/xcode/OLMKitTests/OLMKitTests.m b/xcode/OLMKitTests/OLMKitTests.m index 251c90e..1adbde2 100644 --- a/xcode/OLMKitTests/OLMKitTests.m +++ b/xcode/OLMKitTests/OLMKitTests.m @@ -52,6 +52,15 @@ NSString *plaintext = [bobSession decryptMessage:aliceToBobMsg error:&error]; XCTAssertEqualObjects(message, plaintext); XCTAssertNil(error); + + XCTAssert([bobSession matchesInboundSession:aliceToBobMsg.ciphertext]); + XCTAssertFalse([aliceSession matchesInboundSession:@"ARandomOtkMessage"]); + + NSString *aliceIdKey = alice.identityKeys[@"curve25519"]; + XCTAssert([bobSession matchesInboundSessionFrom:aliceIdKey oneTimeKeyMessage:aliceToBobMsg.ciphertext]); + XCTAssertFalse([bobSession matchesInboundSessionFrom:@"ARandomIdKey" oneTimeKeyMessage:aliceToBobMsg.ciphertext]); + XCTAssertFalse([bobSession matchesInboundSessionFrom:aliceIdKey oneTimeKeyMessage:@"ARandomOtkMessage"]); + BOOL success = [bob removeOneTimeKeysForSession:bobSession]; XCTAssertTrue(success); } @@ -96,8 +105,6 @@ XCTAssertEqualObjects(msg1, dMsg1); XCTAssertEqualObjects(msg2, dMsg2); XCTAssertEqualObjects(msg3, dMsg3); - - } - (void) testAccountSerialization { -- cgit v1.2.3 From 29de7825c9607955d061c5fe75c7f29d78dfaec5 Mon Sep 17 00:00:00 2001 From: manuroe Date: Thu, 17 Nov 2016 15:50:23 +0100 Subject: OLMKit: Update Copyrights --- xcode/OLMKitTests/OLMKitTests.m | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'xcode/OLMKitTests/OLMKitTests.m') diff --git a/xcode/OLMKitTests/OLMKitTests.m b/xcode/OLMKitTests/OLMKitTests.m index 1adbde2..ee02420 100644 --- a/xcode/OLMKitTests/OLMKitTests.m +++ b/xcode/OLMKitTests/OLMKitTests.m @@ -1,10 +1,20 @@ -// -// OLMKitTests.m -// OLMKitTests -// -// Created by Chris Ballinger on 4/8/16. -// -// +/* +Copyright 2016 Chris Ballinger +Copyright 2016 OpenMarket Ltd +Copyright 2016 Vector Creations Ltd + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ #import #import -- cgit v1.2.3