diff options
author | manuroe <manu@matrix.org> | 2016-10-14 15:57:12 +0200 |
---|---|---|
committer | manuroe <manu@matrix.org> | 2016-10-14 15:57:12 +0200 |
commit | 4a2aac5800dacb3de935f6594e4d213087cb7cb5 (patch) | |
tree | 00f6846f32bc6d40d82119d5568b660a9f4ed4ba /xcode/OLMKitTests | |
parent | d1060af8f0dec312447567cce0bc812c82b7343f (diff) |
OLMKit: Add signature tests
Diffstat (limited to 'xcode/OLMKitTests')
-rw-r--r-- | xcode/OLMKitTests/OLMKitTests.m | 20 |
1 files changed, 20 insertions, 0 deletions
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 |