diff --git a/packages/openid4vc/src/openid4vc-holder/OpenId4VcHolderApi.ts b/packages/openid4vc/src/openid4vc-holder/OpenId4VcHolderApi.ts index 8444d7837..70aadbc31 100644 --- a/packages/openid4vc/src/openid4vc-holder/OpenId4VcHolderApi.ts +++ b/packages/openid4vc/src/openid4vc-holder/OpenId4VcHolderApi.ts @@ -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, + } } /** diff --git a/packages/openid4vc/src/openid4vc-holder/OpenId4VciHolderService.ts b/packages/openid4vc/src/openid4vc-holder/OpenId4VciHolderService.ts index 1e342c897..edf029283 100644 --- a/packages/openid4vc/src/openid4vc-holder/OpenId4VciHolderService.ts +++ b/packages/openid4vc/src/openid4vc-holder/OpenId4VciHolderService.ts @@ -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) diff --git a/packages/openid4vc/src/openid4vc-holder/OpenId4VciHolderServiceOptions.ts b/packages/openid4vc/src/openid4vc-holder/OpenId4VciHolderServiceOptions.ts index 90678436e..9379a79b8 100644 --- a/packages/openid4vc/src/openid4vc-holder/OpenId4VciHolderServiceOptions.ts +++ b/packages/openid4vc/src/openid4vc-holder/OpenId4VciHolderServiceOptions.ts @@ -1,5 +1,6 @@ import type { OpenId4VcCredentialHolderBinding, + OpenId4VciAccessTokenResponse, OpenId4VciCredentialConfigurationsSupportedWithFormats, } from '../shared' import type { CredentialOfferObject, IssuerMetadataResult } from '@animo-id/oid4vci' @@ -43,6 +44,8 @@ export type OpenId4VciRequestTokenResponse = { accessToken: string cNonce?: string dpop?: OpenId4VciDpopRequestOptions + + accessTokenResponse: OpenId4VciAccessTokenResponse } // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/packages/openid4vc/src/shared/models/index.ts b/packages/openid4vc/src/shared/models/index.ts index c99cbeab9..aa0120694 100644 --- a/packages/openid4vc/src/shared/models/index.ts +++ b/packages/openid4vc/src/shared/models/index.ts @@ -1,3 +1,4 @@ +import type { AccessTokenResponse } from '@animo-id/oauth2' import type { CredentialConfigurationSupported, CredentialConfigurationSupportedWithFormats, @@ -29,6 +30,7 @@ export type OpenId4VciCredentialConfigurationsSupportedWithFormats = Record< OpenId4VciCredentialConfigurationSupportedWithFormats > +export type OpenId4VciAccessTokenResponse = AccessTokenResponse export type OpenId4VciMetadata = IssuerMetadataResult export type OpenId4VciTxCode = CredentialOfferPreAuthorizedCodeGrantTxCode