Skip to content

Commit

Permalink
fix: update did core version
Browse files Browse the repository at this point in the history
  • Loading branch information
beatt83 committed Oct 10, 2024
1 parent 09fe15e commit 2bd8f51
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ let package = Package(
name: "didcomm-swift",
platforms: [
.iOS(.v15),
.macOS(.v12),
.macOS(.v13),
.macCatalyst(.v15),
.tvOS(.v15),
.watchOS(.v8)
Expand All @@ -20,7 +20,7 @@ let package = Package(
],
dependencies: [
.package(url: "https://github.com/swift-libp2p/swift-multibase.git", .upToNextMajor(from: "0.0.1")),
.package(url: "https://github.com/beatt83/didcore-swift.git", .upToNextMinor(from: "2.0.0")),
.package(url: "https://github.com/beatt83/didcore-swift.git", .upToNextMinor(from: "2.0.1")),
.package(url: "https://github.com/beatt83/jose-swift.git", .upToNextMajor(from: "3.2.0"))
],
targets: [
Expand Down
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.verificationMethods?.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.verificationMethods?.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.verificationMethods?.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.verificationMethods?.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 verificationMethods?.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 verificationMethods?.first { $0.id == value }
case .verificationMethod(let method):
return method
}
Expand Down

0 comments on commit 2bd8f51

Please sign in to comment.