Skip to content

Commit

Permalink
fix: Resume OID4VCI with linkhandler and auth code flow was broken
Browse files Browse the repository at this point in the history
  • Loading branch information
nklomp committed Mar 17, 2024
1 parent 68a6dee commit 654cef4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions packages/oid4vci-holder/src/link-handler/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@ export class OID4VCIHolderLinkHandler extends LinkHandlerAdapter {
const uri = new URL(url).toString()
const offerData = convertURIToJsonObject(uri) as Record<string, unknown>
const hasCode = 'code' in offerData && !!offerData.code && !('issuer' in offerData)
const code = hasCode ? offerData.code : undefined
const code = hasCode ? (offerData.code as string) : undefined
console.log('offer contained code: ', code)

const oid4vciMachine = await this.context.agent.oid4vciHolderGetMachineInterpreter({
requestData: {
credentialOffer: await CredentialOfferClient.fromURI(uri),
...(!hasCode && { credentialOffer: await CredentialOfferClient.fromURI(uri) }),
...(hasCode && { code: code }),
uri,
},
stateNavigationListener: this.stateNavigationListener,
Expand Down
3 changes: 2 additions & 1 deletion packages/oid4vci-holder/src/types/IOID4VCIHolder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ export enum OID4VCIHolderEvent {
}

export type RequestData = {
credentialOffer: any
credentialOffer?: any
code?: string
uri: string
[x: string]: any
}
Expand Down

0 comments on commit 654cef4

Please sign in to comment.