From b12028857fafb3002c4e506f5829b8676f6fca5d Mon Sep 17 00:00:00 2001 From: Filippos Sakellaropoulos Date: Tue, 21 May 2024 12:36:33 +0300 Subject: [PATCH] OpenID4VCI: Allow partial issuing when some documents fail to issue --- .../Services/OpenId4VciService.swift | 11 +++++++++-- changelog.md | 6 ++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Sources/eudi-lib-ios-wallet-kit/Services/OpenId4VciService.swift b/Sources/eudi-lib-ios-wallet-kit/Services/OpenId4VciService.swift index 1fffc6e..280a9f4 100644 --- a/Sources/eudi-lib-ios-wallet-kit/Services/OpenId4VciService.swift +++ b/Sources/eudi-lib-ios-wallet-kit/Services/OpenId4VciService.swift @@ -98,8 +98,15 @@ public class OpenId4VCIService: NSObject, ASWebAuthenticationPresentationContext let issuer = try Issuer(authorizationServerMetadata: offer.authorizationServerMetadata, issuerMetadata: offer.credentialIssuerMetadata, config: config) let authorized = try await authorizeRequestWithAuthCodeUseCase(issuer: issuer, offer: offer) let data = try await credentialInfo.asyncCompactMap { - let str = try await issueOfferedCredentialWithProof(authorized, offer: offer, issuer: issuer, scope: $0.scope, claimSet: claimSet) - if let d = Data(base64URLEncoded: str) { return d } else { throw OpenId4VCIError.dataNotValid } + do { + logger.info("Starting issuing with scope \($0.scope)") + let str = try await issueOfferedCredentialWithProof(authorized, offer: offer, issuer: issuer, scope: $0.scope, claimSet: claimSet) + return Data(base64URLEncoded: str) + } catch { + logger.error("Failed to issue document with scope \($0.scope)") + logger.info("Exception: \(error)") + return nil + } } Self.metadataCache.removeValue(forKey: offerUri) return data diff --git a/changelog.md b/changelog.md index ea05376..e488330 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,9 @@ +## v0.3.9 +OpenID4VCI: Allow partial issuing when some documents fail to issue + +## v0.3.8 +OpenID4VCI: Fixed issuing with https://dev.issuer.eudiw.dev + ## v0.3.7 ### Added functions: /// Resolve OpenID4VCI offer URL document types. Resolved offer metadata are cached