Skip to content

Commit

Permalink
use credential identifier with msoMdoc format
Browse files Browse the repository at this point in the history
  • Loading branch information
phisakel committed May 28, 2024
1 parent e6e70bb commit f741a50
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Sources/eudi-lib-ios-wallet-kit/Services/OpenId4VciService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ public class OpenId4VCIService: NSObject, ASWebAuthenticationPresentationContext
let authorized = try await authorizeRequestWithAuthCodeUseCase(issuer: issuer, offer: offer)
let data = try await credentialInfo.asyncCompactMap {
do {
logger.info("Starting issuing with scope \($0.scope)")
let str = try await issueOfferedCredentialWithProof(authorized, offer: offer, issuer: issuer, scope: $0.scope, claimSet: claimSet)
logger.info("Starting issuing with identifer \($0.identifier.value) and scope \($0.scope)")
let str = try await issueOfferedCredentialWithProof(authorized, offer: offer, issuer: issuer, credentialConfigurationIdentifier: $0.identifier, claimSet: claimSet)
return Data(base64URLEncoded: str)
} catch {
logger.error("Failed to issue document with scope \($0.scope)")
Expand Down Expand Up @@ -142,10 +142,10 @@ public class OpenId4VCIService: NSObject, ASWebAuthenticationPresentationContext
}
}

private func issueOfferedCredentialWithProof(_ authorized: AuthorizedRequest, offer: CredentialOffer, issuer: Issuer, scope: String, claimSet: ClaimSet? = nil) async throws -> String {
private func issueOfferedCredentialWithProof(_ authorized: AuthorizedRequest, offer: CredentialOffer, issuer: Issuer, credentialConfigurationIdentifier: CredentialConfigurationIdentifier, claimSet: ClaimSet? = nil) async throws -> String {
let issuerMetadata = offer.credentialIssuerMetadata
guard let credentialConfigurationIdentifier = issuerMetadata.credentialsSupported.first(where: { $0.value.getScope() == scope })?.key else {
throw WalletError(description: "Cannot find credential identifier for \(scope)")
guard issuerMetadata.credentialsSupported.keys.contains(where: { $0.value == credentialConfigurationIdentifier.value }) else {
throw WalletError(description: "Cannot find credential identifier \(credentialConfigurationIdentifier.value) in offer")
}
return try await issueOfferedCredentialInternal(authorized, issuer: issuer, credentialConfigurationIdentifier: credentialConfigurationIdentifier, claimSet: claimSet)
}
Expand Down
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## v0.4.1
OpenID4VCI: fix to use credential identifier with msoMdoc format

## v0.4.0
OpenID4VCI: fix for filtering resolved identifiers
Support mdoc Authentication for OpenId4Vp #46
Expand Down

0 comments on commit f741a50

Please sign in to comment.