Module em_pop_crypto

ed25519 identity + signing for the em_pop mesh (OTP crypto).

Description

ed25519 identity + signing for the em_pop mesh (OTP crypto). Peer id = SHA-256(pubkey)[0:16]. Canonical byte formats here MUST match Emquest's em_pop_crypto verbatim so cross-node verification works.

Function Index

canonical_identity/1
canonical_response/1Deterministic bytes over a response's item list.
id_of/1
keypair/0
load_or_create/1Load the node keypair from Dir/node_ed25519.key, creating+persisting it if absent.
node_id/0
privkey/0
pubkey/0
sign/2
sign_response/1Sign a response item list.
verify/3
verify_selfsig/1

Function Details

canonical_identity/1

canonical_identity(M::map()) -> binary()

canonical_response/1

canonical_response(Items::list()) -> binary()

Deterministic bytes over a response's item list. Covers the rendered fields (url, title/label, resume/value/description) in list order. No JSON dependency so both signer and verifier compute identical bytes.

id_of/1

id_of(Pub::binary()) -> binary()

keypair/0

keypair() -> {binary(), binary()}

load_or_create/1

load_or_create(Dir::file:filename()) -> {binary(), binary()}

Load the node keypair from Dir/node_ed25519.key, creating+persisting it if absent. Caches it in persistent_term for pubkey/0,privkey/0,sign_response/1.

node_id/0

node_id() -> binary() | undefined

privkey/0

privkey() -> binary() | undefined

pubkey/0

pubkey() -> binary() | undefined

sign/2

sign(Msg::binary(), Priv::binary()) -> binary()

sign_response/1

sign_response(Items::list()) -> {binary(), binary()} | undefined

Sign a response item list. Returns {SignerIdBase64, SigBase64} or undefined when no keypair is loaded (so callers stay backward-compatible).

verify/3

verify(Msg::binary(), Sig::binary(), Pub::binary()) -> boolean()

verify_selfsig/1

verify_selfsig(M::map()) -> boolean()


Generated by EDoc