Skip to content

Commit

Permalink
inc feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Auer <martin.auer97@gmail.com>
  • Loading branch information
auer-martin committed Jul 17, 2024
1 parent 9cccc54 commit af1e7a2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions demo-openid/src/Holder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ export class Holder extends BaseAgent<ReturnType<typeof getOpenIdHolderModules>>
credentialsToRequest: string[]
) {
const tokenResponse = await this.agent.modules.openId4VcHolder.requestToken({ resolvedCredentialOffer })
const credentialResponse = await this.agent.modules.openId4VcHolder.requestCredential({
const credentialResponse = await this.agent.modules.openId4VcHolder.requestCredentials({
resolvedCredentialOffer,
tokenResponse,
...tokenResponse,
// TODO: add jwk support for holder binding
credentialsToRequest,
credentialBindingResolver: async () => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,9 @@ export class OpenId4VcHolderApi {

return this.openId4VciHolderService.acceptCredentialOffer(this.agentContext, {
resolvedCredentialOffer,
tokenResponse: { c_nonce: cNonce, access_token: accessToken },
acceptCredentialOfferOptions: credentialRequestOptions,
accessToken,
cNonce,
})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import type {
OpenId4VciSupportedCredentialFormats,
OpenId4VciCredentialResponse,
OpenId4VciNotificationEvent,
OpenId4VciTokenResponse,
OpenId4VciAcceptCredentialOfferOptions,
OpenId4VciTokenRequestOptions,
} from './OpenId4VciHolderServiceOptions'
Expand Down Expand Up @@ -306,7 +305,8 @@ export class OpenId4VciHolderService {
resolvedCredentialOffer: OpenId4VciResolvedCredentialOffer
acceptCredentialOfferOptions: OpenId4VciAcceptCredentialOfferOptions
resolvedAuthorizationRequestWithCode?: OpenId4VciResolvedAuthorizationRequestWithCode
tokenResponse?: OpenId4VciTokenResponse
accessToken?: string
cNonce?: string
}
) {
const { resolvedCredentialOffer, acceptCredentialOfferOptions } = options
Expand Down Expand Up @@ -345,7 +345,9 @@ export class OpenId4VciHolderService {
txCode: acceptCredentialOfferOptions.userPin,
} as OpenId4VciTokenRequestOptions

const tokenResponse = options.tokenResponse ?? (await this.requestAccessToken(agentContext, tokenRequestOptions))
const tokenResponse = options.accessToken
? { access_token: options.accessToken, c_nonce: options.cNonce }
: await this.requestAccessToken(agentContext, tokenRequestOptions)

const receivedCredentials: Array<OpenId4VciCredentialResponse> = []
let newCNonce: string | undefined
Expand Down

0 comments on commit af1e7a2

Please sign in to comment.