Skip to main content

SessionLike

SessionLike<T>: object

The cross-algorithm session contract. Every binding presents its multi-round protocol sessions through this shape, so the host-side flows are written once rather than per algorithm.

Messages are bytes in both directions. Base64 belongs at the boundaries that genuinely require it — a binding's native edge, storage, and the public API — not in the middle of the flow.

Type Parameters

T

Type declaration

setupMessage?

optional setupMessage: Uint8Array

The opening message, for sessions that start the protocol.

finish()

Produces the session's result. Only valid once inputMessage has resolved true.

Returns

Promise<T>

free()

Releases any native resources the session holds.

Returns

Promise<boolean>

inputMessage()

Feeds a message from the other party. Resolves true once the session can finish.

Parameters

message

Uint8Array

Returns

Promise<boolean>

outputMessage()

The next message to send, or undefined when this side has nothing more to emit.

Returns

Promise<undefined | Uint8Array>