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 2cae342
Show file tree
Hide file tree
Showing 4 changed files with 12 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 @@ -138,6 +137,7 @@ export class OpenId4VciHolderService {
credentialIssuerMetadata: credentialIssuerMetadata,
},
offeredCredentials: credentialsSupportedV13ToV11(offeredCredentialConfigurations),
credentialOfferPayload,
credentialOfferRequestWithBaseUrl: client.credentialOffer,
version: client.version(),
}
Expand Down Expand Up @@ -306,7 +306,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 +346,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
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type {
OpenId4VcCredentialHolderBinding,
OpenId4VciCredentialSupportedWithId,
OpenId4VciIssuerMetadata,
OpenId4VciCredentialOfferPayload,
} from '../shared'
import type { JwaSignatureAlgorithm, KeyType } from '@credo-ts/core'
import type { VerifiableCredential } from '@credo-ts/core/src/modules/dif-presentation-exchange/models/index'
Expand Down Expand Up @@ -53,6 +54,7 @@ export interface OpenId4VciResolvedCredentialOffer {
credentialIssuerMetadata: OpenId4VciIssuerMetadata
}
credentialOfferRequestWithBaseUrl: CredentialOfferRequestWithBaseUrl
credentialOfferPayload: OpenId4VciCredentialOfferPayload
offeredCredentials: OpenId4VciCredentialSupportedWithId[]
version: OpenId4VCIVersion
}
Expand Down

0 comments on commit 2cae342

Please sign in to comment.