@slide-computer/signer-web
Version:
JavaScript and TypeScript library to communicate with web signers on the Internet Computer
53 lines (52 loc) • 1.63 kB
TypeScript
export interface HeartbeatClientOptions {
/**
* Signer window to send and receive heartbeat messages from
*/
signerWindow: Window;
/**
* Callback when first heartbeat has been received
*/
onEstablish: (origin: string) => void;
/**
* Reasonable time in milliseconds in which the communication channel needs to be established
* @default 10000
*/
establishTimeout?: number;
/**
* Callback when no heartbeats have been received for {@link establishTimeout} milliseconds
*/
onEstablishTimeout: () => void;
/**
* Time in milliseconds of not receiving heartbeat responses after which the communication channel is disconnected
* @default 2000
*/
disconnectTimeout?: number;
/**
* Callback when no heartbeats have been received for {@link disconnectTimeout} milliseconds
*/
onDisconnect: () => void;
/**
* Status polling rate in ms
* @default 300
*/
statusPollingRate?: number;
/**
* Relying party window, used to listen for incoming message events
* @default globalThis.window
*/
window?: Window;
/**
* Get random uuid implementation for status messages
* @default globalThis.crypto
*/
crypto?: Pick<Crypto, "randomUUID">;
}
export declare class HeartbeatClient {
#private;
constructor(options: HeartbeatClientOptions);
}
export type HeartbeatServerOptions = Omit<HeartbeatClientOptions, "signerWindow" | "statusPollingRate" | "crypto">;
export declare class HeartbeatServer {
#private;
constructor(options: HeartbeatClientOptions);
}