secure-channel — API
ChannelMessageType
Section titled “ChannelMessageType”export type ChannelMessageType = | 'request' | 'response' | 'event' | 'command' | 'command-result'ChannelMessage
Section titled “ChannelMessage”export interface ChannelMessage { type: ChannelMessageType id?: string route?: string expectReply?: boolean statusCode?: number headers?: Record<string, string> payload?: any error?: string}SecureChannelClientOptions
Section titled “SecureChannelClientOptions”export interface SecureChannelClientOptions { url: string serviceId: string certificate: string // PEM privateKey: string // PEM caCertificate?: string // PEM reconnectDelayMs?: number requestTimeoutMs?: number maxSkewMs?: number nonceTtlMs?: number nonceCacheSize?: number}RequestOptions
Section titled “RequestOptions”export interface RequestOptions { route: string payload?: any expectReply?: boolean headers?: Record<string, string> timeoutMs?: number}SecureChannelServerOptions
Section titled “SecureChannelServerOptions”export interface SecureChannelServerOptions { wss: WebSocketServer verifyClient?: (peerCert: any) => boolean onRequest: (route: string, payload: any, raw: ChannelMessage, ws?: any) => Promise<any> maxSkewMs?: number nonceTtlMs?: number nonceCacheSize?: number}bindSecureChannelServer
Section titled “bindSecureChannelServer”export function bindSecureChannelServer(options: SecureChannelServerOptions): void