Low-level constructor. Prefer the static factories (Identity.generate,
Identity.fromPublicKey, Identity.fromBytes).
StaticTRUNCATED_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 (64 bytes).
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.
StaticfromBuild an identity from a 64-byte private-key blob.
This is the JavaScript analog of the Python reference's
Identity.from_bytes / load_private_key: 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 (rather than supplied, as in Identity.fromBytes, which takes
the full 128-byte priv+pub 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 16 fresh random bytes (TRUNCATED_HASHLENGTH//8).
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 RNS/Identity.py::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 Destination.knownDestinations.
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