@sphereon/ssi-types
Version:
SSI Common Types
116 lines • 3.59 kB
TypeScript
import { EventEmitter } from 'events';
export declare enum System {
GENERAL = "general",
KMS = "kms",
IDENTITY = "identity",
OID4VCI = "oid4vci",
OID4VP = "oid4vp",
SIOPv2 = "siopv2",
PE = "PE",
CREDENTIALS = "credentials",
WEB3 = "web3",
PROFILE = "profile",
CONTACT = "contact"
}
export declare enum SubSystem {
KEY = "key",
DID_PROVIDER = "did_provider",
DID_RESOLVER = "did_resolver",
OID4VP_OP = "oid4vp_op",
OID4VCI_CLIENT = "oid4vci_client",
SIOPv2_OP = "siopv2_op",
CONTACT_MANAGER = "contact_manager",
VC_ISSUER = "vc_issuer",
VC_VERIFIER = "vc_verifier",
VC_PERSISTENCE = "vc_persistence",
TRANSPORT = "transport",
PROFILE = "profile",
API = "api"
}
export declare enum ActionType {
CREATE = "create",
READ = "read",
UPDATE = "update",
DELETE = "delete",
EXECUTE = "execute"
}
export declare enum DefaultActionSubType {
KEY_GENERATION = "Key generation",
KEY_IMPORT = "Key import",
KEY_PERSISTENCE = "Key persistence",
KEY_REMOVAL = "Key removal",
DID_CREATION = "DID creation",
DID_RESOLUTION = "DID resolution",
DID_SERVICE_UPDATE = "DID service update",
VC_ISSUE = "VC issue",
VC_VERIFY = "VC verify",
VC_SHARE = "VC share",
VC_DELETE = "VC delete",
VC_ISSUE_DECLINE = "VC issue decline",
VC_SHARE_DECLINE = "VC share decline"
}
export type ActionSubType = DefaultActionSubType | string;
export declare enum InitiatorType {
USER = "user",
SYSTEM = "system",
EXTERNAL = "external"
}
export declare enum SystemCorrelationIdType {
DID = "did",
URL = "url",
EMAIL = "email",
HOSTNAME = "hostname",
PHONE = "phone",
USER = "user"
}
export type EventData = {
system: string;
subSystemType: string;
};
export interface BasicEvent<SourceType, PayloadType extends EventData> {
id: string;
correlationId?: string;
eventName: string;
initiator?: string;
initiatorType: InitiatorType;
system: System;
subsystem: SubSystem;
data: PayloadType;
}
export declare class EventManager {
private static readonly INSTANCE;
private _emitters;
private constructor();
static instance(): EventManager;
register(name: string, emitter: EventEmitter, opts?: {
disabled: boolean;
}): EventEmitter;
get(name: string, opts?: {
onlyEnabled?: boolean;
}): EventEmitter;
getOrCreate(name: string, opts?: {
onlyEnabled?: boolean;
}): EventEmitter;
has(name: string): boolean;
emitters(filter?: {
eventName?: string | symbol;
onlyEnabled?: boolean;
}): Array<EventEmitter>;
hasEventName(eventName: string | symbol): boolean;
eventNames(): Array<string | symbol>;
emitBasic(event: BasicEvent<any, any>, ...args: any[]): void;
emit(eventName: string | symbol, event: Omit<BasicEvent<any, any>, 'eventName'> | any, ...args: any[]): void;
listenerCount(eventName: string | symbol): number;
listeners(filter: {
emitterName?: string;
eventName: string;
onlyEnabled?: boolean;
}): Array<Function>;
private emittersImpl;
}
export declare class BasicEventEmitter extends EventEmitter {
addListener(eventName: string | symbol, listener: (event: BasicEvent<any, any>, ...args: any[]) => void): this;
once(eventName: string | symbol, listener: (event: BasicEvent<any, any>, ...args: any[]) => void): this;
emit(eventName: string, event: BasicEvent<any, any>, ...args: any[]): boolean;
}
//# sourceMappingURL=index.d.ts.map