Low-level constructor. Prefer the static factories (Identity.generate,
Identity.fromPublicKey, Identity.fromBytes).
StaticTRUNCATED_Truncated-hash length in bytes. Destination, identity, and address
hashes are the first 16 bytes of a SHA-256 digest (the Python reference
expresses this as RNS.Reticulum.TRUNCATED_HASHLENGTH//8, in bits).
The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.
Optionaloptions: boolean | AddEventListenerOptionsDecrypt information for the identity.
The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent().
Encrypt information for the identity.
Returns the application-specific metadata as a UTF-8 string.
Get the context for HKDF.
Get the raw private key bytes.
Matches upstream RNS.Identity.get_private_key(): 64 bytes =
X25519_priv(32) || Ed25519_priv(32), without the public halves — these
are derived from the private scalars on load by
Identity.fromPrivateKey. Key files in this format are
interchangeable with Python Reticulum tooling.
64 bytes of private key material.
Get the public key as bytes.
Get the salt for HKDF.
The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target. The event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see Matching event listeners for removal.
Optionaloptions: boolean | EventListenerOptionsSets the application-specific metadata attached to announcements.
Signs information by the identity.
StaticfromLoad an identity from raw bytes.
Accepts both on-disk key formats:
X25519_priv(32) || Ed25519_priv(32) — the canonical format
shared with the Python reference (get_private_key / from_bytes);
the public keys are derived from the private ones.X25519_priv || X25519_pub || Ed25519_priv || Ed25519_pub —
the legacy reticulum-js export written before the format was aligned;
the embedded public halves are used as-is.64 or 128 bytes of stored key material.
StaticfromBuild an identity from a 64-byte private-key blob.
The input is private key material only — the first 32 bytes are the
X25519 private key, the last 32 bytes the Ed25519 private key — and the
public keys are derived from them. This is the Python reference's
canonical format (RNS.Identity.from_bytes / get_private_key), so a
key file saved by Python Reticulum loads here directly.
Identity.fromBytes accepts the same 64 bytes plus the legacy
128-byte private+public export.
Used to instantiate the import("./ifac.js").deriveIfac IFAC identity from an HKDF-derived 64-byte key, matching upstream
Identity.from_bytes(ifac_key). Returns null on invalid input.
64 bytes: [x25519Priv(32) || ed25519Priv(32)].
StaticfromLoad an identity from a public key.
StaticfullGet a SHA-256 hash of passed data.
StaticgenerateCreate a new random identity.
StaticgetReturns Identity.TRUNCATED_HASH_LENGTH (16) fresh random bytes.
Mirrors RNS.Identity.get_random_hash(). Despite the name this is plain
randomness, not a hash of anything. It is the source of the random half
of the announce random_hash (SPEC.md §4.1) and the Resource random-hash
prefix (§10.2 step 3).
16 random bytes.
StaticloadAttempts to load an identity from a storage adapter, or generates and saves a new one.
Fail-loud semantics: an identity is the node's cryptographic address, so
we never silently mint a fresh one over an existing key. Only a genuinely
absent key file (the adapter returns null) leads to generation; a read
error or an unusable/corrupt stored blob is surfaced to the operator
rather than quietly overwritten, which would break every peer that has
cached the old public key.
OptionalstorageAdapter: any
Must implement async loadKey() and async saveKey(bytes)
StatictruncatedGet a truncated SHA-256 hash of passed data.
StaticvalidateValidates an announce exactly like the Python reference's
validate_announce (SPEC.md §4.5 steps 1-3).
Parses the announce body — branching on contextFlag so a ratchet-bearing
announce shifts the signature 32 bytes deeper (§4.5 step 1) — verifies the
Ed25519 signature over the §4.2 signed_data (step 2), and recomputes the
destination hash from (name_hash, public_key) to confirm it matches the
outer packet header (step 3).
The caller is responsible for the §4.5 step 4 public-key collision check and step 6 caching, since those touch the transport's identity cache.
16-byte dest_hash from the outer packet header.
the packet header's context_flag bit (ratchet present).
the announce body (packet payload).
null on any validation failure.
Represents a Reticulum Identity.
Description
Identity creation, signing, and verification