@sphereon/oid4vci-common
Version:
OpenID 4 Verifiable Credential Issuance Common Types
65 lines • 2.89 kB
TypeScript
import { AssertedUniformCredentialOffer } from './CredentialIssuance.types';
import { CredentialDataSupplierInput, NotificationRequest, StatusListOpts } from './Generic.types';
export interface StateType {
createdAt: number;
expiresAt?: number;
}
export interface CredentialOfferSession extends StateType {
clientId?: string;
credentialOffer: AssertedUniformCredentialOffer;
credentialDataSupplierInput?: CredentialDataSupplierInput;
txCode?: string;
status: IssueStatus;
error?: string;
lastUpdatedAt: number;
notification_id: string;
notification?: NotificationRequest;
issuerState?: string;
preAuthorizedCode?: string;
authorizationCode?: string;
redirectUri?: string;
statusLists?: Array<StatusListOpts>;
}
export declare enum IssueStatus {
OFFER_CREATED = "OFFER_CREATED",// An offer is created. This is the initial state
ACCESS_TOKEN_REQUESTED = "ACCESS_TOKEN_REQUESTED",// Optional state, given the token endpoint could also be on a separate AS
ACCESS_TOKEN_CREATED = "ACCESS_TOKEN_CREATED",// Optional state, given the token endpoint could also be on a separate AS
CREDENTIAL_REQUEST_RECEIVED = "CREDENTIAL_REQUEST_RECEIVED",// Credential request received. Next state would either be error or issued
CREDENTIAL_ISSUED = "CREDENTIAL_ISSUED",// The credential iss issued from the issuer's perspective
NOTIFICATION_CREDENTIAL_ACCEPTED = "NOTIFICATION_CREDENTIAL_ACCEPTED",// The holder/user stored the credential in the wallet (If notifications are enabled)
NOTIFICATION_CREDENTIAL_DELETED = "NOTIFICATION_CREDENTIAL_DELETED",// The holder/user did not store the credential in the wallet (If notifications are enabled)
NOTIFICATION_CREDENTIAL_FAILURE = "NOTIFICATION_CREDENTIAL_FAILURE",// The holder/user encountered an error (If notifications are enabled)
ERROR = "ERROR"
}
export interface CNonceState extends StateType {
cNonce: string;
issuerState?: string;
preAuthorizedCode?: string;
}
export interface URIState extends StateType {
issuerState?: string;
preAuthorizedCode?: string;
uri: string;
correlationId?: string;
}
export interface IssueStatusResponse {
createdAt: number;
lastUpdatedAt: number;
expiresAt?: number;
status: IssueStatus;
error?: string;
clientId?: string;
statusLists?: Array<StatusListOpts>;
}
export interface IStateManager<T extends StateType> {
set(id: string, stateValue: T): Promise<void>;
get(id: string): Promise<T | undefined>;
has(id: string): Promise<boolean>;
delete(id: string): Promise<boolean>;
clearExpired(timestamp?: number): Promise<void>;
clearAll(): Promise<void>;
getAsserted(id: string): Promise<T>;
startCleanupRoutine(timeout?: number): Promise<void>;
stopCleanupRoutine(): Promise<void>;
}
//# sourceMappingURL=StateManager.types.d.ts.map