diff --git a/Sources/DIDCommSwift/Crypto/RecipientKeySelector.swift b/Sources/DIDCommSwift/Crypto/RecipientKeySelector.swift index b822faa..a084d0b 100644 --- a/Sources/DIDCommSwift/Crypto/RecipientKeySelector.swift +++ b/Sources/DIDCommSwift/Crypto/RecipientKeySelector.swift @@ -36,7 +36,7 @@ struct RecipientKeySelector { let document = try await didResolver.resolve(did: didFrom.did) - guard let method = document.verificationMethods?.first(where: { $0.id == signFrom }) else { + guard let method = document.verificationMethod?.first(where: { $0.id == signFrom }) else { throw DIDCommError.verificationMethodNotFoundForId(signFrom) } @@ -53,7 +53,7 @@ struct RecipientKeySelector { let document = try await didResolver.resolve(did: didFrom.did) - guard let method = document.verificationMethods?.first(where: { $0.id == from }) else { + guard let method = document.verificationMethod?.first(where: { $0.id == from }) else { throw DIDCommError.verificationMethodNotFoundForId(from) } diff --git a/Sources/DIDCommSwift/Crypto/SenderKeySelector.swift b/Sources/DIDCommSwift/Crypto/SenderKeySelector.swift index cfb1f12..24a32f5 100644 --- a/Sources/DIDCommSwift/Crypto/SenderKeySelector.swift +++ b/Sources/DIDCommSwift/Crypto/SenderKeySelector.swift @@ -107,7 +107,7 @@ struct SenderKeySelector { } let document = try await didResolver.resolve(did: didTo.did) if didTo.fragment != nil { - guard let verificationMethod = document.verificationMethods?.first(where: { $0.id == to }) else { + guard let verificationMethod = document.verificationMethod?.first(where: { $0.id == to }) else { return [] } return [try KeyHelper.fromVerificationMethod(method: verificationMethod)] @@ -127,7 +127,7 @@ struct SenderKeySelector { } if didTo.fragment != nil { guard - let verificationMethod = document.verificationMethods?.first(where: { $0.id == to }), + let verificationMethod = document.verificationMethod?.first(where: { $0.id == to }), let methodCurve = try? verificationMethod.getCurve(), curve == methodCurve else { @@ -150,7 +150,7 @@ extension DIDDocument { authentication?.map { switch $0 { case .stringValue(let value): - return verificationMethods?.first { $0.id == value } + return verificationMethod?.first { $0.id == value } case .verificationMethod(let method): return method } @@ -161,7 +161,7 @@ extension DIDDocument { keyAgreement?.map { switch $0 { case .stringValue(let value): - return verificationMethods?.first { $0.id == value } + return verificationMethod?.first { $0.id == value } case .verificationMethod(let method): return method } diff --git a/Tests/DIDCommSwiftTests/TestData/Mock/DIDAliceMockData.swift b/Tests/DIDCommSwiftTests/TestData/Mock/DIDAliceMockData.swift index 5f6c720..c0b52a7 100644 --- a/Tests/DIDCommSwiftTests/TestData/Mock/DIDAliceMockData.swift +++ b/Tests/DIDCommSwiftTests/TestData/Mock/DIDAliceMockData.swift @@ -177,7 +177,7 @@ let aliceServiceRoutingKeys = AnyCodable(aliceServiceRoutingKeysDic) let didDocAliceSpecTestVectors = DIDDocument( id: "did:example:alice", - verificationMethods: [ + verificationMethod: [ aliceVerificationMethodKeyAgreeX25519, aliceVerificationMethodKeyAgreeP256, aliceVerificationMethodKeyAgreeP521, @@ -200,7 +200,7 @@ let didDocAliceSpecTestVectors = DIDDocument( let didDocAliceSpecWithNoSecrets = DIDDocument( id: "did:example:alice", - verificationMethods: [ + verificationMethod: [ aliceVerificationMethodKeyAgreemX25519NotInSecret, aliceVerificationMethodKeyAgreeX25519, aliceVerificationMethodKeyAgreeP256, @@ -223,7 +223,7 @@ let didDocAliceSpecWithNoSecrets = DIDDocument( let didDocAliceSpecRoutingTestVectors = DIDDocument( id: "did:example:alice", - verificationMethods: [ + verificationMethod: [ aliceVerificationMethodKeyAgreeX25519, aliceVerificationMethodKeyAgreeP256, aliceVerificationMethodKeyAgreeP521, diff --git a/Tests/DIDCommSwiftTests/TestData/Mock/DIDBobMockData.swift b/Tests/DIDCommSwiftTests/TestData/Mock/DIDBobMockData.swift index 93f4e3c..f18b248 100644 --- a/Tests/DIDCommSwiftTests/TestData/Mock/DIDBobMockData.swift +++ b/Tests/DIDCommSwiftTests/TestData/Mock/DIDBobMockData.swift @@ -446,7 +446,7 @@ let bobMediatorMultipleMediators = AnyCodable(dictionaryLiteral: let didDocBobTestVectors = DIDDocument( id: "did:example:bob", - verificationMethods: [ + verificationMethod: [ bobVerificationMethodKeyAgreeX25519_1, bobVerificationMethodKeyAgreeX25519_2, bobVerificationMethodKeyAgreeX25519_3, @@ -484,7 +484,7 @@ let bobService = AnyCodable(dictionaryLiteral: let didDocBobWithNoSecrets = DIDDocument( id: "did:example:bob", - verificationMethods: [ + verificationMethod: [ bobVerificationMethodKeyAgreeX25519_1, bobVerificationMethodKeyAgreeX25519_2, bobVerificationMethodKeyAgreeX25519_3, @@ -519,7 +519,7 @@ let didDocBobWithNoSecrets = DIDDocument( let didDocBobSpecRoutingTestVectors = DIDDocument( id: "did:example:bob", - verificationMethods: [ + verificationMethod: [ bobVerificationMethodKeyAgreeX25519_1, bobVerificationMethodKeyAgreeX25519_2, bobVerificationMethodKeyAgreeX25519_3, @@ -535,7 +535,7 @@ let didDocBobSpecRoutingTestVectors = DIDDocument( let didDocBobSpecRoutingMediator1TestVectors = DIDDocument( id: "did:example:bobMediator1", - verificationMethods: [ + verificationMethod: [ bobMediator1VerificationMethodKeyAgreeX25519_1, ], authentication: [], @@ -547,7 +547,7 @@ let didDocBobSpecRoutingMediator1TestVectors = DIDDocument( let didDocBobSpecRoutingMediator2TestVectors = DIDDocument( id: "did:example:bobMediator2", - verificationMethods: [ + verificationMethod: [ bobMediator2VerificationMethodKeyAgreeX25519_1, ], authentication: [], @@ -559,7 +559,7 @@ let didDocBobSpecRoutingMediator2TestVectors = DIDDocument( let didDocBobSpecRoutingMediator3TestVectors = DIDDocument( id: "did:example:bobMediator3", - verificationMethods: [ + verificationMethod: [ bobMediator3VerificationMethodKeyAgreeX25519_1, bobMediator3VerificationMethodKeyAgreeP256_1, ], diff --git a/Tests/DIDCommSwiftTests/TestData/Mock/DIDCharlieMockData.swift b/Tests/DIDCommSwiftTests/TestData/Mock/DIDCharlieMockData.swift index 62f0657..4d8102c 100644 --- a/Tests/DIDCommSwiftTests/TestData/Mock/DIDCharlieMockData.swift +++ b/Tests/DIDCommSwiftTests/TestData/Mock/DIDCharlieMockData.swift @@ -98,7 +98,7 @@ let charlieServices1 = AnyCodable(dictionaryLiteral: let didDocCharlie = DIDDocument( id: "did:example:charlie", - verificationMethods: [ + verificationMethod: [ charlieVerificationMethodKeyAgreeX255191, // charlieVerificationMethodKeyAgreeX255192, // charlieVerificationMethodKeyAgreeX255193,