Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

🔐network_auth

Struct NetworkAuth

Shared registry for identity key bindings.

Fields

id: sui::object::UIDObject ID of the registry.

Struct NetworkAuthInnerV1

Version one stored layout for [NetworkAuth].

Fields

registered_key_witness: sui::object::UIDSingleton witness for the registered key verifier.identities: sui::vec_set::VecSet<nexus_registry::network_auth::IdentityKey>Discoverable set of identities that have a [KeyBinding]. This enables indexers/tooling to enumerate which identities have created bindings, without needing to guess identities and derived addresses.

Struct KeyBinding

Per-identity key binding stored at a deterministic derived address.

This object holds the full key lifecycle state for one identity:

  • key registration (with PoP),

  • active key selection (the only key verifiers accept),

  • revocations (for incident response / decommissioning).

Fields

id: sui::object::UIDObject ID of the binding.

Struct KeyBindingInnerV1

Version one stored layout for [KeyBinding].

Fields

identity: nexus_registry::network_auth::IdentityKeyIdentity this binding belongs to.description: std::option::Option<vector<u8>>Optional description for operators and tooling.next_key_id: u64Monotonically increasing key identifier. This is used as the key id for the next registration and as the PoP nonce to prevent replay of PoP signatures.active_key_id: std::option::Option<u64>Active key identifier for verification. Offchain verifiers MUST accept signatures from this key only. This allows key rotation while keeping verification unambiguous.keys: sui::table::Table<u64, nexus_registry::network_auth::KeyRecord>Key records indexed by key id.

Struct KeyRecord

Single key record stored in a binding.

Keys are append only (registered under a new key_id) and can be revoked.

Fields

scheme: u8Key scheme identifier (Ed25519 only).public_key: vector<u8>Raw public key bytes.added_at_ms: u64Timestamp when the key was registered.revoked_at_ms: std::option::Option<u64>Timestamp when the key was revoked, if any.

Struct ProofOfIdentity

Ephemeral proof that the caller is authorized to act for an identity.

This prevents unauthorized parties from creating bindings or registering keys for identities they do not control.

Fields

identity: nexus_registry::network_auth::IdentityKeyIdentity proven by on-chain capabilities.

Struct ProofOfKey

Ephemeral proof that a key is controlled by the signer.

This proves possession of the private key corresponding to public_key without revealing it, and is valid only for a single registration slot (bound to [KeyBinding::next_key_id]).

Fields

scheme: u8Key scheme identifier (Ed25519 only).public_key: vector<u8>Public key proven by proof-of-possession.key_id: u64Key id this proof is valid for. This must match [KeyBinding::next_key_id] when registering the key.

Struct NetworkAuthCreatedEvent

Emitted when a new network auth registry is created.

Fields

registry: sui::object::IDRegistry object ID.registered_key_witness: sui::object::IDRegistered key verifier witness ID.

Struct KeyBindingCreatedEvent

Emitted when a new key binding is created.

Fields

binding: sui::object::IDBinding object ID.identity: nexus_registry::network_auth::IdentityKeyIdentity associated with the binding.

Struct KeyRegisteredEvent

Emitted when a key is registered.

Fields

binding: sui::object::IDBinding object ID.key_id: u64Registered key identifier.scheme: u8Key scheme identifier.public_key: vector<u8>Public key bytes.added_at_ms: u64Timestamp when the key was registered.

Struct KeyRevokedEvent

Emitted when a key is revoked.

Fields

binding: sui::object::IDBinding object ID.key_id: u64Revoked key identifier.revoked_at_ms: u64Timestamp when the key was revoked.

Struct ActiveKeyUpdatedEvent

Emitted when the active key changes.

Fields

binding: sui::object::IDBinding object ID.active_key_id: std::option::Option<u64>New active key identifier, or none if cleared.

Enum IdentityKey

Canonical identity key namespace for key bindings.

This value is used as:

  • the key for the derived [KeyBinding] address, and

  • the identity commitment inside PoP signatures (via bcs(IdentityKey)).

Variants

Variant LeaderLeader identity keyed by leader capability ID.leader_cap_id: sui::object::IDID of the leader's CloneableOwnerCap<leader_cap::OverNetwork> capability object.Variant ToolTool identity keyed by stable Tool object ID.tool_id: sui::object::ID

Constants

Required byte length of an Ed25519 public key.

Required byte length of an Ed25519 signature.

Identifier for Ed25519 keys.

Default domain separator for proof-of-possession.

Function prove_leader

Create proof for the leader (sender) using its leader capability.

The leader capability serves as the on-chain authorization to act as a Leader identity and register/rotate keys for IdentityKey::Leader { leader_cap_id: object::id(leader_cap) }.

Function prove_offchain_tool

Creates identity proof for an off-chain Tool using its owner capability.

The owner cap is validated against the Tool object before binding its stable ID.

Function proof_identity

Return the identity proven by the proof.

Function identity_key_leader

Build a leader identity key from a leader capability id.

Function identity_key_tool

Build a tool identity key from a stable Tool object ID.

Function new_proof_of_key

Create proof_of_possession for registering the given public key. Only Ed25519 keys are supported.

The signature must verify over POP_DOMAIN || bcs(IdentityKey) || bcs(key_id) || public_key using the same public key, proving control of the private key for this specific identity and key-id slot.

Function binding_address

Deterministic derived address for the key binding.

Uses the registry object ID and the identity as the derivation key.

This allows any caller to deterministically compute where the [KeyBinding] for an identity lives on-chain.

Function binding_exists

Check whether a binding has been created for the given identity.

Function registered_key_witness

Returns the singleton registered key verifier witness ID.

Function create_binding

Create a new key binding for the given identity.

This claims the derived object ID, initializes the binding state, and inserts the identity into the registry's discovery set.

Function key_binding_identity

Return the identity associated with a key binding.

Function key_binding_active_key_id

Return the active key id for a binding.

Offchain verifiers must accept signatures from this key only.

Function key_binding_next_key_id

Return the next key id that will be assigned on registration.

This value is also committed into PoP signatures to make them one-time-use.

Function key_binding_key

Borrow a key record by id.

Function active_key_is_usable

Returns whether the current active slot is a live, correctly-sized Ed25519 key.

Function verify_active_key_signature

Verify an Ed25519 signature against the currently active key for this binding.

Returns false unless:

  • the active key record exists and is not revoked,

  • the key scheme and sizes are valid Ed25519 values, and

  • signature verification succeeds.

Function register_key

Register a new key and set it as active.

This assigns a monotonically increasing key id, stores the key record, and updates the active key pointer.

Function revoke_key

Revoke an existing key.

This sets the revocation timestamp and clears the active key if needed.

Function set_active_key

Set the active key to an existing, non-revoked key.

This switches the active key pointer without altering key records.

Last updated