Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update didcore to next version #14

Merged
merged 1 commit into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Sources/DIDCommSwift/Crypto/RecipientKeySelector.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand All @@ -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)
}

Expand Down
8 changes: 4 additions & 4 deletions Sources/DIDCommSwift/Crypto/SenderKeySelector.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand All @@ -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 {
Expand All @@ -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
}
Expand All @@ -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
}
Expand Down
6 changes: 3 additions & 3 deletions Tests/DIDCommSwiftTests/TestData/Mock/DIDAliceMockData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ let aliceServiceRoutingKeys = AnyCodable(aliceServiceRoutingKeysDic)

let didDocAliceSpecTestVectors = DIDDocument(
id: "did:example:alice",
verificationMethods: [
verificationMethod: [
aliceVerificationMethodKeyAgreeX25519,
aliceVerificationMethodKeyAgreeP256,
aliceVerificationMethodKeyAgreeP521,
Expand All @@ -200,7 +200,7 @@ let didDocAliceSpecTestVectors = DIDDocument(

let didDocAliceSpecWithNoSecrets = DIDDocument(
id: "did:example:alice",
verificationMethods: [
verificationMethod: [
aliceVerificationMethodKeyAgreemX25519NotInSecret,
aliceVerificationMethodKeyAgreeX25519,
aliceVerificationMethodKeyAgreeP256,
Expand All @@ -223,7 +223,7 @@ let didDocAliceSpecWithNoSecrets = DIDDocument(

let didDocAliceSpecRoutingTestVectors = DIDDocument(
id: "did:example:alice",
verificationMethods: [
verificationMethod: [
aliceVerificationMethodKeyAgreeX25519,
aliceVerificationMethodKeyAgreeP256,
aliceVerificationMethodKeyAgreeP521,
Expand Down
12 changes: 6 additions & 6 deletions Tests/DIDCommSwiftTests/TestData/Mock/DIDBobMockData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ let bobMediatorMultipleMediators = AnyCodable(dictionaryLiteral:

let didDocBobTestVectors = DIDDocument(
id: "did:example:bob",
verificationMethods: [
verificationMethod: [
bobVerificationMethodKeyAgreeX25519_1,
bobVerificationMethodKeyAgreeX25519_2,
bobVerificationMethodKeyAgreeX25519_3,
Expand Down Expand Up @@ -484,7 +484,7 @@ let bobService = AnyCodable(dictionaryLiteral:

let didDocBobWithNoSecrets = DIDDocument(
id: "did:example:bob",
verificationMethods: [
verificationMethod: [
bobVerificationMethodKeyAgreeX25519_1,
bobVerificationMethodKeyAgreeX25519_2,
bobVerificationMethodKeyAgreeX25519_3,
Expand Down Expand Up @@ -519,7 +519,7 @@ let didDocBobWithNoSecrets = DIDDocument(

let didDocBobSpecRoutingTestVectors = DIDDocument(
id: "did:example:bob",
verificationMethods: [
verificationMethod: [
bobVerificationMethodKeyAgreeX25519_1,
bobVerificationMethodKeyAgreeX25519_2,
bobVerificationMethodKeyAgreeX25519_3,
Expand All @@ -535,7 +535,7 @@ let didDocBobSpecRoutingTestVectors = DIDDocument(

let didDocBobSpecRoutingMediator1TestVectors = DIDDocument(
id: "did:example:bobMediator1",
verificationMethods: [
verificationMethod: [
bobMediator1VerificationMethodKeyAgreeX25519_1,
],
authentication: [],
Expand All @@ -547,7 +547,7 @@ let didDocBobSpecRoutingMediator1TestVectors = DIDDocument(

let didDocBobSpecRoutingMediator2TestVectors = DIDDocument(
id: "did:example:bobMediator2",
verificationMethods: [
verificationMethod: [
bobMediator2VerificationMethodKeyAgreeX25519_1,
],
authentication: [],
Expand All @@ -559,7 +559,7 @@ let didDocBobSpecRoutingMediator2TestVectors = DIDDocument(

let didDocBobSpecRoutingMediator3TestVectors = DIDDocument(
id: "did:example:bobMediator3",
verificationMethods: [
verificationMethod: [
bobMediator3VerificationMethodKeyAgreeX25519_1,
bobMediator3VerificationMethodKeyAgreeP256_1,
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ let charlieServices1 = AnyCodable(dictionaryLiteral:

let didDocCharlie = DIDDocument(
id: "did:example:charlie",
verificationMethods: [
verificationMethod: [
charlieVerificationMethodKeyAgreeX255191,
// charlieVerificationMethodKeyAgreeX255192,
// charlieVerificationMethodKeyAgreeX255193,
Expand Down
Loading