Skip to content

Commit

Permalink
chore: return access token response (#2097)
Browse files Browse the repository at this point in the history
Signed-off-by: Timo Glastra <[email protected]>
  • Loading branch information
TimoGlastra authored Nov 20, 2024
1 parent 607659a commit e03d204
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,12 @@ export class OpenId4VcHolderApi {
options
)

return { accessToken: accessTokenResponse.access_token, cNonce: accessTokenResponse.c_nonce, dpop }
return {
accessToken: accessTokenResponse.access_token,
cNonce: accessTokenResponse.c_nonce,
dpop,
accessTokenResponse,
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,11 @@ export class OpenId4VciHolderService {
// Else: use 1
const batchSize =
requestBatch === true ? metadata.credentialIssuer.batch_credential_issuance?.batch_size ?? 1 : requestBatch || 1
if (typeof requestBatch === 'number' && requestBatch > 1 && !metadata.credentialIssuer.batch_credential_issuance) {
throw new CredoError(
`Credential issuer '${metadata.credentialIssuer.credential_issuer}' does not support batch credential issuance using the 'proofs' request property. Onlt 'proof' supported.`
)
}

for (const [offeredCredentialId, offeredCredentialConfiguration] of credentialConfigurationsToRequest) {
// Get all options for the credential request (such as which kid to use, the signature algorithm, etc)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type {
OpenId4VcCredentialHolderBinding,
OpenId4VciAccessTokenResponse,
OpenId4VciCredentialConfigurationsSupportedWithFormats,
} from '../shared'
import type { CredentialOfferObject, IssuerMetadataResult } from '@animo-id/oid4vci'
Expand Down Expand Up @@ -43,6 +44,8 @@ export type OpenId4VciRequestTokenResponse = {
accessToken: string
cNonce?: string
dpop?: OpenId4VciDpopRequestOptions

accessTokenResponse: OpenId4VciAccessTokenResponse
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down
2 changes: 2 additions & 0 deletions packages/openid4vc/src/shared/models/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { AccessTokenResponse } from '@animo-id/oauth2'
import type {
CredentialConfigurationSupported,
CredentialConfigurationSupportedWithFormats,
Expand Down Expand Up @@ -29,6 +30,7 @@ export type OpenId4VciCredentialConfigurationsSupportedWithFormats = Record<
OpenId4VciCredentialConfigurationSupportedWithFormats
>

export type OpenId4VciAccessTokenResponse = AccessTokenResponse
export type OpenId4VciMetadata = IssuerMetadataResult

export type OpenId4VciTxCode = CredentialOfferPreAuthorizedCodeGrantTxCode
Expand Down

0 comments on commit e03d204

Please sign in to comment.