Skip to content

Commit

Permalink
chore: statusListOpts support in CredentialOfferRESTRequest and Crede…
Browse files Browse the repository at this point in the history
…ntialSignerCallback
  • Loading branch information
sanderPostma committed Feb 4, 2025
1 parent f935d94 commit ad12217
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 14 deletions.
13 changes: 7 additions & 6 deletions packages/issuer/lib/VcIssuer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ import {
OpenId4VCIVersion,
PRE_AUTH_GRANT_LITERAL,
QRCodeOpts,
StatusListOpts,
TokenErrorResponse,
toUniformCredentialOfferRequest,
TxCode,
TYP_ERROR,
URIState,
URIState
} from '@sphereon/oid4vci-common'
import {
CompactSdJwtVc,
Expand Down Expand Up @@ -139,9 +140,9 @@ export class VcIssuer<DIDDoc extends object> {
scheme?: string
pinLength?: number
qrCodeOpts?: QRCodeOpts,
statusEntryCorrelationId?: string
statusListOpts? :Array<StatusListOpts>
}): Promise<CreateCredentialOfferURIResult> {
const { credential_configuration_ids, statusEntryCorrelationId } = opts
const { credential_configuration_ids, statusListOpts } = 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 @@ -214,7 +215,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
statusListOpts
}

if (preAuthorizedCode) {
Expand Down Expand Up @@ -391,7 +392,7 @@ export class VcIssuer<DIDDoc extends object> {
credential,
jwtVerifyResult,
issuer,
...(session && {statusEntryCorrelationId: session.statusEntryCorrelationId})
...(session && {statusListOpts: session.statusListOpts})
},
signerCallback,
)
Expand Down Expand Up @@ -671,7 +672,7 @@ export class VcIssuer<DIDDoc extends object> {
jwtVerifyResult: JwtVerifyResult<DIDDoc>
format?: OID4VCICredentialFormat
issuer?: string
statusEntryCorrelationId?: string
statusListOpts?: Array<StatusListOpts>
},
issuerCallback?: CredentialSignerCallback<DIDDoc>,
): Promise<W3CVerifiableCredential | CompactSdJwtVc> {
Expand Down
6 changes: 3 additions & 3 deletions packages/issuer/lib/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {
CredentialRequest,
CredentialSupplierConfig,
JwtVerifyResult,
OID4VCICredentialFormat,
UniformCredentialRequest,
OID4VCICredentialFormat, StatusListOpts,
UniformCredentialRequest
} from '@sphereon/oid4vci-common'
import {
CompactSdJwtVc,
Expand All @@ -25,7 +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
statusListOpts? :Array<StatusListOpts>
}) => Promise<W3CVerifiableCredential | CompactSdJwtVc>

export interface CredentialDataSupplierArgs extends CNonceState {
Expand Down
7 changes: 7 additions & 0 deletions packages/oid4vci-common/lib/types/Generic.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,3 +425,10 @@ export type NotificationResponseResult = {
export interface NotificationErrorResponse {
error: NotificationError | string;
}

export interface StatusListOpts {
statusListId: string
statusListCorrelationId: string
statusEntryIndex?: number
statusEntryCorrelationId?: string
}
4 changes: 2 additions & 2 deletions packages/oid4vci-common/lib/types/StateManager.types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AssertedUniformCredentialOffer } from './CredentialIssuance.types';
import { CredentialDataSupplierInput, NotificationRequest } from './Generic.types'
import { CredentialDataSupplierInput, NotificationRequest, StatusListOpts } from './Generic.types'

export interface StateType {
createdAt: number;
Expand All @@ -18,7 +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
statusListOpts? :Array<StatusListOpts>
}

export enum IssueStatus {
Expand Down
6 changes: 3 additions & 3 deletions packages/oid4vci-common/lib/types/v1_0_13.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import {
MetadataDisplay,
OID4VCICredentialFormat,
ProofTypesSupported,
ResponseEncryption,
} from './Generic.types';
ResponseEncryption, StatusListOpts
} from './Generic.types'
import { QRCodeOpts } from './QRCode.types';
import { AuthorizationServerMetadata, AuthorizationServerType, EndpointMetadata } from './ServerMetadata';

Expand Down Expand Up @@ -156,7 +156,7 @@ export interface CredentialOfferRESTRequest extends CredentialOfferV1_0_13 {
pinLength?: number;
qrCodeOpts?: QRCodeOpts;
credentialDataSupplierInput?: CredentialDataSupplierInput;
statusEntryCorrelationId?: string
statusListOpts?: Array<StatusListOpts>
}

export interface CredentialOfferPayloadV1_0_13 {
Expand Down

0 comments on commit ad12217

Please sign in to comment.