Skip to content

Commit

Permalink
Merge pull request #116 from niscy-eudiw/fixes
Browse files Browse the repository at this point in the history
Update OpenID4VP to version 0.6.0 (VP draft 21)
  • Loading branch information
phisakel authored Nov 5, 2024
2 parents 309ed05 + 18d994b commit d745d4f
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
10 changes: 5 additions & 5 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "b67feccbd1f8993b7daae2734ce787ff627abb69b550179cbe226a9574f98dda",
"originHash" : "ebf47c2682782005cbaf1f28ff387c17a3cad1d91fcba1d59b4cd31b98367167",
"pins" : [
{
"identity" : "blueecc",
Expand Down Expand Up @@ -60,17 +60,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/eu-digital-identity-wallet/eudi-lib-ios-presentation-exchange-swift.git",
"state" : {
"revision" : "bf9396b3bc9ed27a3b740759b045c31d10b0eb62",
"version" : "0.1.1"
"revision" : "4e1ac57b6772f7f6eac5ef24d977c42e94bc6565",
"version" : "0.2.0"
}
},
{
"identity" : "eudi-lib-ios-siop-openid4vp-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/eu-digital-identity-wallet/eudi-lib-ios-siop-openid4vp-swift.git",
"state" : {
"revision" : "1a6912fb79646dfaad393625e71aef427e4635b6",
"version" : "0.5.0"
"revision" : "f103311dd3bd975b12919d4c3c1e099b6cb40330",
"version" : "0.6.0"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let package = Package(
.package(url: "https://github.com/crspybits/swift-log-file", from: "0.1.0"),
.package(url: "https://github.com/eu-digital-identity-wallet/eudi-lib-ios-iso18013-data-transfer.git", exact: "0.3.3"),
.package(url: "https://github.com/eu-digital-identity-wallet/eudi-lib-ios-wallet-storage.git", exact: "0.3.0"),
.package(url: "https://github.com/eu-digital-identity-wallet/eudi-lib-ios-siop-openid4vp-swift.git", exact: "0.5.0"),
.package(url: "https://github.com/eu-digital-identity-wallet/eudi-lib-ios-siop-openid4vp-swift.git", exact: "0.6.0"),
.package(url: "https://github.com/eu-digital-identity-wallet/eudi-lib-ios-openid4vci-swift.git", exact: "0.7.0"),
],
targets: [
Expand Down
4 changes: 2 additions & 2 deletions Sources/EudiWalletKit/EudiWallet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public final class EudiWallet: ObservableObject, @unchecked Sendable {
let issueReq = try IssueRequest(id: pendingDoc.id, docType: pendingDoc.docType, privateKeyType: pkt, keyData: pk)
try await openId4VCIService.initSecurityKeys(pendingDoc.privateKeyType == .secureEnclaveP256)
let outcome = try await openId4VCIService.resumePendingIssuance(pendingDoc: pendingDoc, webUrl: webUrl)
if case let .pending(_) = outcome { return pendingDoc }
if case .pending(_) = outcome { return pendingDoc }
let res = try await finalizeIssuing(id: pendingDoc.id, data: outcome, docType: pendingDoc.docType, format: format, issueReq: issueReq, openId4VCIService: openId4VCIService)
return res
}
Expand Down Expand Up @@ -367,7 +367,7 @@ public final class EudiWallet: ObservableObject, @unchecked Sendable {
}
try await storage.loadDocuments(status: .issued)
} catch {
storage.setError(error)
await storage.setError(error)
throw WalletError(description: error.localizedDescription)
}
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/EudiWalletKit/Services/OpenId4VpService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public final class OpenId4VpService: @unchecked Sendable, PresentationService {
}

/// OpenId4VP wallet configuration
func getWalletConf(verifierApiUrl: String?, verifierLegalName: String?) -> WalletOpenId4VPConfiguration? {
func getWalletConf(verifierApiUrl: String?, verifierLegalName: String?) -> SiopOpenId4VPConfiguration? {
guard let rsaPrivateKey = try? KeyController.generateRSAPrivateKey(), let privateKey = try? KeyController.generateECDHPrivateKey(),
let rsaPublicKey = try? KeyController.generateRSAPublicKey(from: rsaPrivateKey) else { return nil }
guard let rsaJWK = try? RSAPublicKey(publicKey: rsaPublicKey, additionalParameters: ["use": "sig", "kid": UUID().uuidString, "alg": "RS256"]) else { return nil }
Expand All @@ -171,7 +171,7 @@ public final class OpenId4VpService: @unchecked Sendable, PresentationService {
let verifierMetaData = PreregisteredClient(clientId: "Verifier", legalName: verifierLegalName, jarSigningAlg: JWSAlgorithm(.RS256), jwkSetSource: WebKeySource.fetchByReference(url: URL(string: "\(verifierApiUrl)/wallet/public-keys.json")!))
supportedClientIdSchemes += [.preregistered(clients: [verifierMetaData.clientId: verifierMetaData])]
}
let res = WalletOpenId4VPConfiguration(subjectSyntaxTypesSupported: [.decentralizedIdentifier, .jwkThumbprint], preferredSubjectSyntaxType: .jwkThumbprint, decentralizedIdentifier: try! DecentralizedIdentifier(rawValue: "did:example:123"), signingKey: privateKey, signingKeySet: keySet, supportedClientIdSchemes: supportedClientIdSchemes, vpFormatsSupported: [], session: urlSession)
let res = SiopOpenId4VPConfiguration(subjectSyntaxTypesSupported: [.decentralizedIdentifier, .jwkThumbprint], preferredSubjectSyntaxType: .jwkThumbprint, decentralizedIdentifier: try! DecentralizedIdentifier(rawValue: "did:example:123"), signingKey: privateKey, signingKeySet: keySet, supportedClientIdSchemes: supportedClientIdSchemes, vpFormatsSupported: [], session: urlSession)
return res
}

Expand Down
12 changes: 6 additions & 6 deletions Sources/EudiWalletKit/Services/StorageManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public class StorageManager: ObservableObject, @unchecked Sendable {
await refreshPublishedVars()
return docs
} catch {
setError(error)
await setError(error)
throw error
}
}
Expand All @@ -161,7 +161,7 @@ public class StorageManager: ObservableObject, @unchecked Sendable {
await refreshPublishedVars()
return doc
} catch {
setError(error)
await setError(error)
throw error
}
}
Expand Down Expand Up @@ -221,7 +221,7 @@ public class StorageManager: ObservableObject, @unchecked Sendable {
_ = await MainActor.run { deferredDocuments.remove(at: index) }
}
} catch {
setError(error)
await setError(error)
throw error
}
}
Expand All @@ -238,13 +238,13 @@ public class StorageManager: ObservableObject, @unchecked Sendable {
await MainActor.run { deferredDocuments.removeAll(keepingCapacity:false) }
}
} catch {
setError(error)
await setError(error)
throw error
}
}

func setError(_ error: Error) {
uiError = WalletError(description: error.localizedDescription, userInfo: (error as NSError).userInfo)
func setError(_ error: Error) async {
await MainActor.run { uiError = WalletError(description: error.localizedDescription, userInfo: (error as NSError).userInfo) }
}

}
Expand Down

0 comments on commit d745d4f

Please sign in to comment.