UNPKG

di-wings

Version:

Aviary Tech's common library for decentralized identity

65 lines 2.75 kB
import type { WorkflowConfig, ExchangeRequest, ExchangeResponse, ExchangeStateUpdate, IWorkflow, IExchange } from './types'; import type { IWorkflowRepository, IExchangeRepository } from './repositories'; import type { PrivateVerificationMethod, VerifiablePresentation } from '../common/interfaces'; export interface WorkflowServiceConfig { workflowRepository: IWorkflowRepository; exchangeRepository: IExchangeRepository; verificationMethods?: PrivateVerificationMethod[]; } /** * WorkflowService implements the VC-API Workflow Service specification * @see https://w3c-ccg.github.io/vc-api/#workflow-service */ export declare class WorkflowService { private config; constructor(config: WorkflowServiceConfig); /** * Gets all workflows (admin access) */ getAllWorkflows(): Promise<IWorkflow[]>; /** * Gets workflows for a specific user */ getUserWorkflows(userId: string): Promise<IWorkflow[]>; /** * Creates a new workflow instance * @see https://w3c-ccg.github.io/vc-api/#create-workflow */ createWorkflow(config: WorkflowConfig, userId: string): Promise<IWorkflow>; private validateWorkflowConfig; /** * Creates a new exchange for a workflow * @see https://w3c-ccg.github.io/vc-api/#create-exchange */ createExchange(workflowId: string, ttl?: string, variables?: Record<string, any>[]): Promise<IExchange>; /** * Handles participation in an exchange * @see https://w3c-ccg.github.io/vc-api/#participate-in-an-exchange */ participateInExchange(workflowId: string, exchangeId: string, exchangeData?: ExchangeRequest): Promise<{ response: ExchangeResponse; stateUpdate: ExchangeStateUpdate; }>; private handleEmptyRequest; private evaluateTemplate; private getTemplateVariables; private updateExchangeVariables; private handleVerifiablePresentation; getWorkflow(workflowId: string): Promise<IWorkflow>; getExchange(workflowId: string, exchangeId: string): Promise<IExchange>; validateVerifiablePresentation(vp: VerifiablePresentation): Promise<void>; private validStateTransitions; private validateStateTransition; updateExchangeState(workflowId: string, exchangeId: string, update: ExchangeStateUpdate): Promise<void>; private handleCredentialIssuance; private handleVerifiablePresentationRequest; /** * Deletes a workflow by ID */ deleteWorkflow(workflowId: string): Promise<IWorkflow | null>; private evaluateJSONata; private getVerificationMethod; issueCredential(credential: any): Promise<any>; getWorkflowExchanges(workflowId: string): Promise<IExchange[]>; } //# sourceMappingURL=WorkflowService.d.ts.map