class

RNS::PacketReceipt

Inherits Reference < Object

Tracks the delivery status of a sent packet and validates incoming proofs. Supports delivery/timeout callbacks and computes round-trip time once a proof is validated.

Constants

CULLED = 255_u8
DELIVERED = 2_u8
EXPL_LENGTH = (Identity::HASHLENGTH // 8) + (Identity::SIGLENGTH // 8)
FAILED = 0_u8

─── Status constants ──────────────────────────────────────────

IMPL_LENGTH = Identity::SIGLENGTH // 8
SENT = 1_u8

Constructors

new(packet : Packet)
Source

Instance methods

callbacks
Source
callbacks=(callbacks : PacketReceiptCallbacks)
Source
check_timeout
Source
concluded_at
Source
concluded_at=(concluded_at : Float64 | Nil)
Source
destination
Source
destination=(destination : Destination::DestinationInterface | Nil)
Source
get_rtt
Source
get_status
Source
hash

Generates an UInt64 hash value for this object.

This method must have the property that a == b implies a.hash == b.hash.

The hash value is used along with == by the Hash class to determine if two objects reference the same hash key.

Subclasses must not override this method. Instead, they must define hash(hasher), though usually the macro def_hash can be used to generate this method.

Source
hash=(hash : Bytes)
Source
is_timed_out?
Source
proof_packet
Source
proof_packet=(proof_packet : Packet | Nil)
Source
proved
Source
proved=(proved : Bool)
Source
sent
Source
sent=(sent : Bool)
Source
sent_at
Source
sent_at=(sent_at : Float64)
Source
set_delivery_callback(callback : Proc(PacketReceipt, Nil))
Source
set_timeout(timeout : Float64)
Source
set_timeout_callback(callback : Proc(PacketReceipt, Nil))
Source
status
Source
status=(status : UInt8)
Source
timeout
Source
timeout=(timeout : Float64)
Source
truncated_hash
Source
truncated_hash=(truncated_hash : Bytes)
Source
validate_proof(proof : Bytes, proof_packet : Packet | Nil = nil) : Bool

Validates a proof against this receipt. Handles both explicit proofs (hash + signature) and implicit proofs (signature only). On success, marks the receipt as DELIVERED and fires the delivery callback.

Source
validate_proof_packet(proof_packet : Packet) : Bool
Source