UNPKG

@sphereon/ssi-sdk.vc-status-list-issuer

Version:

Sphereon SSI-SDK plugin for Status List issuance

68 lines (64 loc) 2.58 kB
import { StatusListResult, IStatusListPlugin } from '@sphereon/ssi-sdk.vc-status-list'; import { StatusListManagementOptions, IStatusListDriver } from '@sphereon/ssi-sdk.vc-status-list-issuer-drivers'; import { OrPromise } from '@sphereon/ssi-types'; import { DataSource } from 'typeorm'; import { DataSources } from '@sphereon/ssi-sdk.agent-config'; import { IAgentPlugin } from '@veramo/core'; type StatusListInstance = StatusListManagementOptions & { dataSource?: OrPromise<DataSource>; issuer?: string; }; interface IDriverAndStatusListResult { slDriver: IStatusListDriver; statusList: StatusListRef; } type StatusListRef = Pick<StatusListResult, 'id' | 'correlationId' | 'type' | 'oauthStatusList' | 'bitstringStatusList'>; declare class StatusListPlugin implements IAgentPlugin { private readonly instances; private readonly defaultStatusListId?; private readonly allDataSources; private initialized; readonly methods: IStatusListPlugin; constructor(opts: { instances?: Array<StatusListInstance>; defaultStatusListId?: string; allDataSources?: DataSources; autoCreateInstances?: boolean; }); private init; private slImportStatusLists; private createStatusListInstance; private getDriverForStatusListOption; private slGetStatusList; private selectDatasource; private slCreateStatusList; /** * Selects bitsPerStatus from the used status list type when applicable * @param sl * @private */ private selectBitsPerStatus; /** * Adds status information to a credential by either: * 1. Using existing status ID from the credential if present * 2. Using provided status list options * 3. Falling back to the default status list ID * * @param args Contains credential and status options * @param context Required agent context * @returns Credential with added status information */ private slAddStatusToCredential; /** * Adds status information to an SD-JWT credential by either: * 1. Using existing status URI from the credential if present * 2. Using provided status list options * 3. Falling back to the default status list ID * * @param args Contains SD-JWT credential and status options * @param context Required agent context * @returns SD-JWT credential with added status information */ private slAddStatusToSdJwtCredential; } export { type IDriverAndStatusListResult, type StatusListInstance, StatusListPlugin, type StatusListRef };