barrel_p2p_dist_keys (barrel_p2p v0.1.0)
View SourceSummary
Functions
Delete a trusted key
SHA-256 fingerprint of an Ed25519 public key. Pure helper for diagnostics (logs, key-mismatch reports). The store/lookup API is keyed by node atom, not by fingerprint.
Get current trust mode
Check if a node's public key is trusted. Thin wrapper around lookup_pin/1 kept for back-compat with existing boolean callers.
List all trusted nodes
Lookup the public key for a node
Tri-state pin lookup. Distinguishes "no pin recorded" from "pin exists" so callers can refuse re-pin attempts. Accepts a node atom or a (peer-supplied) name binary; a binary resolves through binary_to_existing_atom so a lookup never mints a new atom. An unknown name is not_pinned.
Set trust mode (strict or tofu)
Start the key storage server
Store a public key for a node, overwriting any existing pin unconditionally. This is an operator API and is NOT reachable from the wire; the handshake path uses store_key_if_new/2, which refuses to re-pin a different key. To rotate a peer's pin deliberately, delete_key/1 then store_key/2.
Store a key if no key exists for this node (TOFU mode)
Functions
-spec delete_key(node()) -> ok.
Delete a trusted key
SHA-256 fingerprint of an Ed25519 public key. Pure helper for diagnostics (logs, key-mismatch reports). The store/lookup API is keyed by node atom, not by fingerprint.
-spec get_trust_mode() -> strict | tofu.
Get current trust mode
Check if a node's public key is trusted. Thin wrapper around lookup_pin/1 kept for back-compat with existing boolean callers.
-spec list_trusted() -> [#peer_key{node :: node() | undefined, fingerprint :: binary() | undefined, public_key :: binary(), added_at :: integer(), last_seen :: integer(), trust_level :: permanent | tofu}].
List all trusted nodes
Lookup the public key for a node
Tri-state pin lookup. Distinguishes "no pin recorded" from "pin exists" so callers can refuse re-pin attempts. Accepts a node atom or a (peer-supplied) name binary; a binary resolves through binary_to_existing_atom so a lookup never mints a new atom. An unknown name is not_pinned.
-spec set_trust_mode(strict | tofu) -> ok.
Set trust mode (strict or tofu)
Start the key storage server
Store a public key for a node, overwriting any existing pin unconditionally. This is an operator API and is NOT reachable from the wire; the handshake path uses store_key_if_new/2, which refuses to re-pin a different key. To rotate a peer's pin deliberately, delete_key/1 then store_key/2.
Store a key if no key exists for this node (TOFU mode)