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