-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release 0.2 There were quite a few assumptions that changed. Therefore the huge amount of changes, important notes below: - Now pluto will persist 2 keys for DIDPeer. TODO: Change to be an array of keys - Added DIDcomm integration with our DIDResolver and SecretsResolver - SecretsResolver is working but TODO move it to a more proper place - Changed Keys models to support an enum of Curves Fixes ATL-2698
- Loading branch information
1 parent
4f9948e
commit e8e1fd8
Showing
60 changed files
with
884 additions
and
381 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
import Core | ||
import Domain | ||
import Foundation | ||
|
||
struct OctetKeyPair { | ||
struct PublicJson: Codable { | ||
enum CodingKeys: String, CodingKey { | ||
case kty | ||
case kid | ||
case crv | ||
case publicKey = "x" | ||
} | ||
|
||
let kty = "OKP" | ||
let kid: String | ||
let crv: String | ||
let publicKey: String | ||
|
||
init(kid: String, crv: String, publicKey: String) { | ||
self.kid = kid | ||
self.crv = crv | ||
self.publicKey = publicKey | ||
} | ||
} | ||
|
||
struct PrivateJson: Codable { | ||
enum CodingKeys: String, CodingKey { | ||
case kty | ||
case kid | ||
case crv | ||
case publicKey = "x" | ||
case privateKey = "d" | ||
} | ||
|
||
let kty = "OKP" | ||
let kid: String | ||
let crv: String | ||
let privateKey: String | ||
let publicKey: String | ||
|
||
init(kid: String, crv: String, privateKey: String, publicKey: String) { | ||
self.kid = kid | ||
self.crv = crv | ||
self.privateKey = privateKey | ||
self.publicKey = publicKey | ||
} | ||
} | ||
|
||
let kty = "OKP" | ||
let kid: String | ||
let crv: String | ||
let privateKey: String | ||
let publicKey: String | ||
|
||
init(id: String, from: KeyPair) throws { | ||
self.init( | ||
kid: id, | ||
crv: from.curve.name, | ||
privateKey: from.privateKey.value.base64UrlEncodedString(), | ||
publicKey: from.publicKey.value.base64UrlEncodedString() | ||
) | ||
} | ||
|
||
init(kid: String, crv: String, privateKey: String, publicKey: String) { | ||
self.kid = kid | ||
self.crv = crv | ||
self.privateKey = privateKey | ||
self.publicKey = publicKey | ||
} | ||
|
||
var publicJson: String? { | ||
let publicJson = PublicJson( | ||
kid: kid, | ||
crv: crv, | ||
publicKey: publicKey | ||
) | ||
guard let dataJson = try? JSONEncoder().encode(publicJson) else { | ||
return nil | ||
} | ||
return String(data: dataJson, encoding: .utf8) | ||
} | ||
var privateJson: String? { | ||
let privateJson = PrivateJson( | ||
kid: kid, | ||
crv: crv, | ||
privateKey: privateKey, | ||
publicKey: publicKey | ||
) | ||
guard let dataJson = try? JSONEncoder().encode(privateJson) else { | ||
return nil | ||
} | ||
return String(data: dataJson, encoding: .utf8) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import Core | ||
import Domain | ||
import Foundation | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.