diff --git a/package.json b/package.json index a9703de6..97362923 100644 --- a/package.json +++ b/package.json @@ -57,3 +57,4 @@ "OID4VCI" ] } + diff --git a/packages/issuer-rest/lib/oid4vci-api-functions.ts b/packages/issuer-rest/lib/oid4vci-api-functions.ts index 4014cc8d..ac696f7f 100644 --- a/packages/issuer-rest/lib/oid4vci-api-functions.ts +++ b/packages/issuer-rest/lib/oid4vci-api-functions.ts @@ -1,15 +1,14 @@ import { ACCESS_TOKEN_ISSUER_REQUIRED_ERROR, - AuthorizationRequest, - CredentialOfferRESTRequestV1_0_11, + AuthorizationRequest, CredentialOfferRESTRequestV1_0_11, CredentialRequestV1_0_11, determineGrantTypes, getNumberOrUndefined, Grant, IssueStatusResponse, JWT_SIGNER_CALLBACK_REQUIRED_ERROR, - TokenErrorResponse, -} from '@sphereon/oid4vci-common' + TokenErrorResponse +} from '@sphereon/oid4vci-common'; import { adjustUrl, trimBoth, trimEnd, trimStart } from '@sphereon/oid4vci-common/dist/functions/HttpUtils' import { ITokenEndpointOpts, VcIssuer } from '@sphereon/oid4vci-issuer' import { env, ISingleEndpointOpts, sendErrorResponse } from '@sphereon/ssi-express-support' @@ -201,12 +200,12 @@ export function createCredentialOfferEndpoint( return sendErrorResponse(response, 400, { error: TokenErrorResponse.invalid_grant, error_description: 'No grant type supplied' }) } const grants = request.body.grants as Grant - const credentials = request.body.credentials as (string | CredentialFormat)[] - if (!credentials || credentials.length === 0) { - return sendErrorResponse(response, 400, { error: TokenErrorResponse.invalid_request, error_description: 'No credentials supplied' }) + const credentialIds = request.body.credentials as (string | CredentialFormat)[] + if (!credentialIds || credentialIds.length === 0) { + return sendErrorResponse(response, 400, { error: TokenErrorResponse.invalid_request, error_description: 'No credential ids supplied' }) } const qrCodeOpts = request.body.qrCodeOpts ?? opts?.qrCodeOpts - const result = await issuer.createCredentialOfferURI({ ...request.body, qrCodeOpts, grants, credentials }) + const result = await issuer.createCredentialOfferURI({ ...request.body, qrCodeOpts, grants }) const resultResponse: ICreateCredentialOfferURIResponse = result if ('session' in resultResponse) { // eslint-disable-next-line @typescript-eslint/ban-ts-comment diff --git a/packages/issuer/lib/VcIssuer.ts b/packages/issuer/lib/VcIssuer.ts index 1333ffa9..6b828bc1 100644 --- a/packages/issuer/lib/VcIssuer.ts +++ b/packages/issuer/lib/VcIssuer.ts @@ -4,7 +4,6 @@ import { CNonceState, CreateCredentialOfferURIResult, CREDENTIAL_MISSING_ERROR, - CredentialConfigurationSupported, CredentialConfigurationSupportedV1_0_13, CredentialDataSupplierInput, CredentialOfferPayloadV1_0_13, @@ -89,7 +88,7 @@ export class VcIssuer { public async createCredentialOfferURI(opts: { grants?: Grant - credentials?: Record + credentials?: Array credentialDefinition?: JsonLdIssuerCredentialDefinition credentialOfferUri?: string credentialDataSupplierInput?: CredentialDataSupplierInput // Optional storage that can help the credential Data Supplier. For instance to store credential input data during offer creation, if no additional data can be supplied later on @@ -107,7 +106,7 @@ export class VcIssuer { } const credentialOfferPayload: CredentialOfferPayloadV1_0_13 = { ...(grants && { grants }), - ...(credentials && { credential_configuration_ids: credentials ? Object.keys(credentials) : [] }), + ...(credentials && { credential_configuration_ids: credentials ?? [] }), credential_issuer: this.issuerMetadata.credential_issuer, } as CredentialOfferPayloadV1_0_13 if (grants?.authorization_code) {