Skip to content

Commit e03d204

Browse files
authored
chore: return access token response (#2097)
Signed-off-by: Timo Glastra <[email protected]>
1 parent 607659a commit e03d204

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

packages/openid4vc/src/openid4vc-holder/OpenId4VcHolderApi.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,12 @@ export class OpenId4VcHolderApi {
134134
options
135135
)
136136

137-
return { accessToken: accessTokenResponse.access_token, cNonce: accessTokenResponse.c_nonce, dpop }
137+
return {
138+
accessToken: accessTokenResponse.access_token,
139+
cNonce: accessTokenResponse.c_nonce,
140+
dpop,
141+
accessTokenResponse,
142+
}
138143
}
139144

140145
/**

packages/openid4vc/src/openid4vc-holder/OpenId4VciHolderService.ts

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

408413
for (const [offeredCredentialId, offeredCredentialConfiguration] of credentialConfigurationsToRequest) {
409414
// Get all options for the credential request (such as which kid to use, the signature algorithm, etc)

packages/openid4vc/src/openid4vc-holder/OpenId4VciHolderServiceOptions.ts

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type {
22
OpenId4VcCredentialHolderBinding,
3+
OpenId4VciAccessTokenResponse,
34
OpenId4VciCredentialConfigurationsSupportedWithFormats,
45
} from '../shared'
56
import type { CredentialOfferObject, IssuerMetadataResult } from '@animo-id/oid4vci'
@@ -43,6 +44,8 @@ export type OpenId4VciRequestTokenResponse = {
4344
accessToken: string
4445
cNonce?: string
4546
dpop?: OpenId4VciDpopRequestOptions
47+
48+
accessTokenResponse: OpenId4VciAccessTokenResponse
4649
}
4750

4851
// eslint-disable-next-line @typescript-eslint/no-explicit-any

packages/openid4vc/src/shared/models/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { AccessTokenResponse } from '@animo-id/oauth2'
12
import type {
23
CredentialConfigurationSupported,
34
CredentialConfigurationSupportedWithFormats,
@@ -29,6 +30,7 @@ export type OpenId4VciCredentialConfigurationsSupportedWithFormats = Record<
2930
OpenId4VciCredentialConfigurationSupportedWithFormats
3031
>
3132

33+
export type OpenId4VciAccessTokenResponse = AccessTokenResponse
3234
export type OpenId4VciMetadata = IssuerMetadataResult
3335

3436
export type OpenId4VciTxCode = CredentialOfferPreAuthorizedCodeGrantTxCode

0 commit comments

Comments
 (0)