Skip to content

PostMessageChannel

Defined in: src/web/postMessageChannel.ts:42

A Channel implementation that communicates with a signer via window.postMessage. Created by PostMessageTransport after the ICRC-29 heartbeat handshake completes.

Messages are filtered by source window and origin to prevent cross-origin interference. When the signer status is "pending", outgoing messages are queued and flushed when it becomes "ready".

new PostMessageChannel(options): PostMessageChannel

Defined in: src/web/postMessageChannel.ts:48

PostMessageChannelOptions

PostMessageChannel

get closed(): boolean

Defined in: src/web/postMessageChannel.ts:58

Whether this channel has been closed.

boolean

Channel.closed

addEventListener(…__namedParameters): () => void

Defined in: src/web/postMessageChannel.ts:62

["close", () => void] | ["response", (response) => void]

() => void

Channel.addEventListener


changeStatus(status): void

Defined in: src/web/postMessageChannel.ts:145

Updates the signer status. When transitioning to "ready", all queued messages are flushed to the signer window.

"pending" | "ready"

The new signer status.

void


close(): Promise<void>

Defined in: src/web/postMessageChannel.ts:122

Closes the signer window and notifies all close listeners.

Promise<void>

Channel.close


send(request): Promise<void>

Defined in: src/web/postMessageChannel.ts:99

Sends a JSON-RPC request to the signer. If the signer status is "pending", the request is queued until changeStatus is called with "ready".

JsonRpcRequest

The JSON-RPC request to send.

Promise<void>

Channel.send