UNPKG

trustbroker-client

Version:

Official Client SDK for the TrustBroker Data Exchange Platform.

68 lines 2.21 kB
import EventEmitter from "events"; export interface RequestDataParams { ownerExternalId: string; providerId: string; schemaId: string; neededData?: any; pollingIntervalMs?: number; timeoutMs?: number; abortSignal?: AbortSignal; } export interface RequestStatusResponse { requestId: string; status: string; platformSignature?: string; providerEndpoint?: string; } export interface ProviderDataResponse { signature: string; requestId: string; data: any; } export interface CompleteRequestResponse { requestId: string; status: string; } export interface TrustBrokerClientOptions { logger?: { debug: (...args: any[]) => void; info: (...args: any[]) => void; warn: (...args: any[]) => void; error: (...args: any[]) => void; }; } export declare class TrustBrokerClient extends EventEmitter { private clientId; private publicKey; private privateKey; private http; private logger?; constructor(options?: TrustBrokerClientOptions); getClientId(): string; getMyInstitution(): Promise<any>; getInstitutionById(id: string): Promise<any>; getPublicKey(): Promise<string>; createDataRequest(params: { providerId: string; dataOwnerId: string; schemaId: string; relationshipId?: string; expiresAt?: string; }): Promise<{ requestId: string; status: string; }>; /** * Get status of a specific data request. */ getRequestStatus(requestId: string): Promise<RequestStatusResponse>; requestDataFromProvider(requestId: string, platformSignature: string, mySignature: string, providerEndpoint: string): Promise<ProviderDataResponse>; submitRequesterSignature(requestId: string, providerId: string, providerSignature: string, platformSignature: string, requesterSignature: string): Promise<CompleteRequestResponse>; signPayload(payload: any): string; /** * Verify a signature against a payload using the given public key. */ verifyPayloadSignature(payload: any, signature: string, publicKey: string): boolean; private handleApiError; } //# sourceMappingURL=index.d.ts.map