UNPKG

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

Version:

Sphereon SSI-SDK plugin for Status List management, like StatusList2021. Issuer drivers module

77 lines (72 loc) 3.74 kB
import { GenericAuthArgs, ISingleEndpointOpts, ExpressSupport } from '@sphereon/ssi-express-support'; import { IStatusListPlugin } from '@sphereon/ssi-sdk.vc-status-list'; import { IAgentContext, TAgent } from '@veramo/core'; import express, { Express, Router } from 'express'; import { IRequiredPlugins } from '@sphereon/ssi-sdk.vc-status-list-issuer-drivers'; import { StatusListType } from '@sphereon/ssi-types'; type IRequiredContext = IAgentContext<IRequiredPlugins & IStatusListPlugin>; interface IStatusListOpts { endpointOpts: IStatusListEndpointOpts; enableFeatures?: statusListFeatures[]; } interface IStatusListEndpointOpts { basePath?: string; globalAuth?: GenericAuthArgs; vcApiCredentialStatus: IW3CredentialStatusEndpointOpts; createStatusList: ICredentialStatusListEndpointOpts; getStatusList: ICredentialStatusListEndpointOpts; } type statusListFeatures = 'w3c-vc-api-credential-status' | 'status-list-management' | 'status-list-hosting'; interface ICredentialStatusListEndpointOpts extends ISingleEndpointOpts { dbName: string; } interface IW3CredentialStatusEndpointOpts extends ICredentialStatusListEndpointOpts { statusListId?: string; correlationId?: string; keyRef?: string; } interface UpdateW3cCredentialStatusRequest extends UpdateCredentialStatusRequest { credentialId: string; } interface UpdateIndexedCredentialStatusRequest extends UpdateCredentialStatusRequest { statusListIndex?: number; } interface UpdateCredentialStatusRequest { credentialStatus: UpdateCredentialStatusItem[]; statusListId?: string; statusListCorrelationId?: string; entryCorrelationId?: string; } interface UpdateCredentialStatusItem { type?: StatusListType; status: string; } declare enum StatusListIdType { StatusListId = "StatusListId", StatusListCorrelationId = "StatusListCorrelationId" } declare enum EntryIdType { StatusListIndex = "StatusListIndex", EntryCorrelationId = "StatusListCorrelationId" } declare class StatuslistManagementApiServer { get router(): express.Router; private readonly _express; private readonly _agent; private readonly _opts?; private readonly _router; constructor(args: { agent: TAgent<IRequiredPlugins & IStatusListPlugin>; expressSupport: ExpressSupport; opts: IStatusListOpts; }); get agent(): TAgent<IRequiredPlugins>; get opts(): IStatusListOpts | undefined; get express(): Express; } declare function createNewStatusListEndpoint(router: Router, context: IRequiredContext, opts: ICredentialStatusListEndpointOpts): void; declare function getStatusListCredentialEndpoint(router: Router, context: IRequiredContext, opts: ICredentialStatusListEndpointOpts): void; declare function getStatusListCredentialIndexStatusEndpoint(router: Router, context: IRequiredContext, opts: ICredentialStatusListEndpointOpts): void; declare function getStatusListCredentialIndexStatusEndpointLegacy(router: Router, context: IRequiredContext, opts: ICredentialStatusListEndpointOpts): void; declare function updateStatusEndpoint(router: Router, context: IRequiredContext, opts: IW3CredentialStatusEndpointOpts): void; export { EntryIdType, type ICredentialStatusListEndpointOpts, type IRequiredContext, type IStatusListEndpointOpts, type IStatusListOpts, type IW3CredentialStatusEndpointOpts, StatusListIdType, StatuslistManagementApiServer, type UpdateCredentialStatusItem, type UpdateIndexedCredentialStatusRequest, type UpdateW3cCredentialStatusRequest, createNewStatusListEndpoint, getStatusListCredentialEndpoint, getStatusListCredentialIndexStatusEndpoint, getStatusListCredentialIndexStatusEndpointLegacy, type statusListFeatures, updateStatusEndpoint };