π ReplayFilter
Methods
β isReplayOrExpired
Checks if a packet is a replay or has an expired timestamp.
Returns true if packet is invalid (replay or expired).
If valid, records the nonce and returns false.
| Method | Type |
|---|
isReplayOrExpired | (packet: WirePacket, now?: number) => boolean |
β cleanup
Purges nonces whose expiration timestamp has passed
| Method | Type |
|---|
cleanup | (now?: number) => void |
π ProtocolEngine
Methods
β isReplayOrExpired
Checks if an incoming packet is a duplicate replay or expired
| Method | Type |
|---|
isReplayOrExpired | (packet: WirePacket) => boolean |
β getReplayFilter
Returns the internal ReplayFilter instance
| Method | Type |
|---|
getReplayFilter | () => ReplayFilter |
β createRequestPacket
Packs an RPC Request into an Encrypted WirePacket envelope.
| Method | Type |
|---|
createRequestPacket | (targetId: string, action: string, params: Record<string, unknown>, keyHex: string) => { packet: WirePacket; nonce: string; } |
β unpackPayload
Unpacks and decrypts an incoming packetβs inner payload.
| Method | Type |
|---|
unpackPayload | <T>(packet: WirePacket, keyHex: string) => T or null |
β registerPendingRequest
Registers a callback listener for a specific request nonce
| Method | Type |
|---|
registerPendingRequest | (nonce: string, callback: (res: RPCResponsePayload) => void) => void |
β handleResponse
Resolves a pending RPC promise when a matching response arrives
| Method | Type |
|---|
handleResponse | (responsePayload: RPCResponsePayload) => void |
β createResponsePacket
Constructs an encrypted Response WirePacket.
| Method | Type |
|---|
createResponsePacket | (targetId: string, replyToNonce: string, success: boolean, data?: unknown, error?: string or undefined, keyHex?: string or undefined) => WirePacket |
β createDataPacket
Constructs an encrypted Data WirePacket (direct message / chat).
| Method | Type |
|---|
createDataPacket | (targetId: string, payload: DirectMessagePayload, keyHex: string) => WirePacket |
β createHandshakePacket
Constructs a P2P Ticket Handshake Signal WirePacket.
Delivered to target peer so target can decrypt the ticket using their master key.
| Method | Type |
|---|
createHandshakePacket | (targetId: string, ticket: string, ticketIv: string) => WirePacket |
β createTestPacket
Constructs an unencrypted SIGNAL Test Request WirePacket.
| Method | Type |
|---|
createTestPacket | (targetId: string, seq?: number, data?: string) => WirePacket |
β createTestResponsePacket
Constructs an unencrypted SIGNAL Test Response WirePacket with constant βpongβ payload data.
| Method | Type |
|---|
createTestResponsePacket | (requestPacket: WirePacket, seq?: number) => WirePacket |
πΉ Interfaces
β RPCRequestPayload
| Property | Type | Description |
|---|
action | string | |
params | Record<string, unknown> or undefined | |
β RPCResponsePayload
| Property | Type | Description |
|---|
replyToNonce | string | |
success | boolean | |
data | unknown | |
error | string or undefined | |
β DirectMessagePayload
| Property | Type | Description |
|---|
contentType | "text" or "json" or "binary" | |
content | string | |
β P2PTicket
| Property | Type | Description |
|---|
sessionKey | string | |
initiatorId | string | |
timestamp | number | |
ttl | number | |
β TicketResponseBody
| Property | Type | Description |
|---|
targetId | string | |
sessionKey | string | |
ticketForTarget | string | |
ticketIv | string | |
β P2PHandshakePayload
| Property | Type | Description |
|---|
ticket | string | |
iv | string | |
β TestPacketPayload
| Property | Type | Description |
|---|
seq | number | |
data | string | |
ts | number | |