esdb_identity (reckon_gater v1.3.0)
View SourceIdentity management for capability-based security
Provides Ed25519 keypair generation and DID (Decentralized Identifier) encoding/decoding using the did:key method.
DID Key Method
DIDs are encoded as: did:key:z{base58btc(multicodec_prefix + public_key)}
For Ed25519: multicodec prefix is 0xed01
NIF Acceleration
Base58 encoding/decoding can be accelerated via optional Rust NIFs. When the NIF is available (Enterprise Edition), operations are 5-10x faster. Pure Erlang fallbacks are always available (Community Edition).
Example
Generate new identity and get DID:
Identity = esdb_identity:generate(), DID = esdb_identity:did(Identity), {ok, PubKey} = esdb_identity:public_key_from_did(DID).
Summary
Functions
Decode Base58 to binary
Encode binary to Base58 (Bitcoin alphabet)
Get the DID from an identity
Create an identity from an existing Ed25519 keypair
Create an identity from a public key only (for verification)
Generate a new Ed25519 identity with random keypair
Check if NIF acceleration is available
Check if a binary is a valid did:key DID
Get the private key from an identity (may be undefined)
Get the public key from an identity
Extract public key from a did:key DID
Types
Functions
Decode Base58 to binary
Uses NIF acceleration when available, otherwise pure Erlang.
Encode binary to Base58 (Bitcoin alphabet)
Uses NIF acceleration when available, otherwise pure Erlang.
Get the DID from an identity
Create an identity from an existing Ed25519 keypair
Create an identity from a public key only (for verification)
-spec generate() -> identity().
Generate a new Ed25519 identity with random keypair
-spec is_nif_available() -> boolean().
Check if NIF acceleration is available
Returns true if the Rust NIF is loaded and functional. When false, pure Erlang implementations are used.
Check if a binary is a valid did:key DID
Get the private key from an identity (may be undefined)
Get the public key from an identity
Extract public key from a did:key DID