Skip to content

Commit

Permalink
chore: statusEntryCorrelationId support in CredentialOfferRESTRequest…
Browse files Browse the repository at this point in the history
… and CredentialSignerCallback
  • Loading branch information
sanderPostma committed Feb 4, 2025
1 parent 5194986 commit f935d94
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/issuer/lib/VcIssuer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,10 @@ export class VcIssuer<DIDDoc extends object> {
baseUri?: string
scheme?: string
pinLength?: number
qrCodeOpts?: QRCodeOpts
qrCodeOpts?: QRCodeOpts,
statusEntryCorrelationId?: string
}): Promise<CreateCredentialOfferURIResult> {
const { credential_configuration_ids } = opts
const { credential_configuration_ids, statusEntryCorrelationId } = opts

const grants = opts.grants ? { ...opts.grants } : {}
// for backwards compat, would be better if user sets the prop on the grants directly
Expand Down Expand Up @@ -213,6 +214,7 @@ export class VcIssuer<DIDDoc extends object> {
...(userPin && { txCode: userPin }), // We used to use userPin according to older specs. We map these onto txCode now. If both are used, txCode in the end wins, even if they are different
...(opts.credentialDataSupplierInput && { credentialDataSupplierInput: opts.credentialDataSupplierInput }),
credentialOffer,
statusEntryCorrelationId
}

if (preAuthorizedCode) {
Expand Down Expand Up @@ -309,6 +311,7 @@ export class VcIssuer<DIDDoc extends object> {
let credential: CredentialIssuanceInput | undefined
let format: OID4VCICredentialFormat | undefined = credentialRequest.format
let signerCallback: CredentialSignerCallback<DIDDoc> | undefined = opts.credentialSignerCallback
let session: CredentialOfferSession | undefined
if (opts.credential) {
credential = opts.credential
} else {
Expand All @@ -317,7 +320,7 @@ export class VcIssuer<DIDDoc extends object> {
if (typeof credentialDataSupplier !== 'function') {
throw Error('Data supplier is mandatory if no credential is supplied')
}
const session = preAuthorizedCode && preAuthSession ? preAuthSession : authSession
session = preAuthorizedCode && preAuthSession ? preAuthSession : authSession
if (!session) {
throw Error('Either a preAuth or Auth session is required, none found')
}
Expand Down Expand Up @@ -388,6 +391,7 @@ export class VcIssuer<DIDDoc extends object> {
credential,
jwtVerifyResult,
issuer,
...(session && {statusEntryCorrelationId: session.statusEntryCorrelationId})
},
signerCallback,
)
Expand Down Expand Up @@ -667,6 +671,7 @@ export class VcIssuer<DIDDoc extends object> {
jwtVerifyResult: JwtVerifyResult<DIDDoc>
format?: OID4VCICredentialFormat
issuer?: string
statusEntryCorrelationId?: string
},
issuerCallback?: CredentialSignerCallback<DIDDoc>,
): Promise<W3CVerifiableCredential | CompactSdJwtVc> {
Expand Down
1 change: 1 addition & 0 deletions packages/issuer/lib/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export type CredentialSignerCallback<T extends object> = (opts: {
* An implementation that wants to look into the DIDDoc would have to do a cast in the signer callback implementation
*/
jwtVerifyResult: JwtVerifyResult<T>
statusEntryCorrelationId?: string
}) => Promise<W3CVerifiableCredential | CompactSdJwtVc>

export interface CredentialDataSupplierArgs extends CNonceState {
Expand Down
1 change: 1 addition & 0 deletions packages/oid4vci-common/lib/types/StateManager.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface CredentialOfferSession extends StateType {
issuerState?: string; //todo: Probably good to hash it here, since it would come in from the client and we could match the hash and thus use the client value
preAuthorizedCode?: string; //todo: Probably good to hash it here, since it would come in from the client and we could match the hash and thus use the client value
authorizationCode?: string
statusEntryCorrelationId?: string
}

export enum IssueStatus {
Expand Down
1 change: 1 addition & 0 deletions packages/oid4vci-common/lib/types/v1_0_13.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ export interface CredentialOfferRESTRequest extends CredentialOfferV1_0_13 {
pinLength?: number;
qrCodeOpts?: QRCodeOpts;
credentialDataSupplierInput?: CredentialDataSupplierInput;
statusEntryCorrelationId?: string
}

export interface CredentialOfferPayloadV1_0_13 {
Expand Down

0 comments on commit f935d94

Please sign in to comment.