This commit is contained in:
sydneymorton 2020-10-08 16:00:01 -07:00
Родитель c520243b98
Коммит 2d57a27529
4 изменённых файлов: 9 добавлений и 13 удалений

Просмотреть файл

@ -28,7 +28,6 @@ public struct Secp256k1: Signing {
public func sign(messageHash: Data, withSecret secret: VCCryptoSecret) throws -> Data {
// Validate params
print(secret.id.uuidString)
guard secret is Secret else { throw Secp256k1Error.invalidSecret }
guard messageHash.count == 32 else { throw Secp256k1Error.invalidMessageHash }

Просмотреть файл

@ -22,19 +22,19 @@ public struct IdentifierCreator {
}
public func create() throws -> Identifier {
let signingKeyMapping = KeyContainer(keyReference: try self.cryptoOperations.generateKey(), keyId: "sign")
let updateKeyMapping = KeyContainer(keyReference: try self.cryptoOperations.generateKey(), keyId: "update")
let recoveryKeyMapping = KeyContainer(keyReference: try self.cryptoOperations.generateKey(), keyId: "recover")
let signingKeyContainer = KeyContainer(keyReference: try self.cryptoOperations.generateKey(), keyId: "sign")
let updateKeyContainer = KeyContainer(keyReference: try self.cryptoOperations.generateKey(), keyId: "update")
let recoveryKeyContainer = KeyContainer(keyReference: try self.cryptoOperations.generateKey(), keyId: "recover")
let longformDid = try self.createLongformDid(signingKeyMapping: signingKeyMapping, updateKeyMapping: updateKeyMapping, recoveryKeyMapping: recoveryKeyMapping)
return Identifier(longformId: longformDid, didDocumentKeys: [signingKeyMapping], updateKey: updateKeyMapping, recoveryKey: recoveryKeyMapping)
let longformDid = try self.createLongformDid(signingKeyContainer: signingKeyContainer, updateKeyContainer: updateKeyContainer, recoveryKeyContainer: recoveryKeyContainer)
return Identifier(longformId: longformDid, didDocumentKeys: [signingKeyContainer], updateKey: updateKeyContainer, recoveryKey: recoveryKeyContainer)
}
private func createLongformDid(signingKeyMapping: KeyContainer, updateKeyMapping: KeyContainer, recoveryKeyMapping: KeyContainer) throws -> String {
let signingJwk = try self.generatePublicJwk(for: signingKeyMapping)
let updateJwk = try self.generatePublicJwk(for: updateKeyMapping)
let recoveryJwk = try self.generatePublicJwk(for: recoveryKeyMapping)
private func createLongformDid(signingKeyContainer: KeyContainer, updateKeyContainer: KeyContainer, recoveryKeyContainer: KeyContainer) throws -> String {
let signingJwk = try self.generatePublicJwk(for: signingKeyContainer)
let updateJwk = try self.generatePublicJwk(for: updateKeyContainer)
let recoveryJwk = try self.generatePublicJwk(for: recoveryKeyContainer)
return try self.identifierFormatter.createIonLongForm(recoveryKey: recoveryJwk, updateKey: updateJwk, didDocumentKeys: [signingJwk], serviceEndpoints: [])
}

Просмотреть файл

@ -6,7 +6,6 @@
import XCTest
import VCRepository
import VCEntities
import VCCrypto
@testable import VCUseCase

Просмотреть файл

@ -6,8 +6,6 @@
import XCTest
import VCRepository
import VCEntities
import VCCrypto
import PromiseKit
@testable import VCUseCase