| Crates.io | enigma-identity |
| lib.rs | enigma-identity |
| version | 0.1.0 |
| created_at | 2025-12-15 11:25:35.534219+00 |
| updated_at | 2025-12-15 11:25:35.534219+00 |
| description | Enigma Identity: local identity + X3DH bundle + shared secret derivation |
| homepage | |
| repository | https://github.com/Gladius33/enigma-identity |
| max_upload_size | |
| id | 1985876 |
| size | 40,672 |
A standalone, production-oriented Rust crate implementing local identity creation and X3DH bootstrap for the Enigma ecosystem.
This crate is intentionally self-contained, fully testable, and reusable in other projects. It focuses exclusively on functional block (1) of Enigma: identity and cryptographic session bootstrap.
enigma-identity is responsible for:
This crate does not:
It provides the cryptographic root of trust for all higher-level Enigma modules.
+------------------+ +------------------+
| LocalIdentity | | RemoteIdentity |
|------------------| |------------------|
| Ed25519 keypair | | X3DH Bundle |
| X25519 PreKey |<------>| (public only) |
| UUID / username | | |
+--------+---------+ +--------+---------+
| |
| X3DH Initiation | X3DH Response
v v
SharedSecret (32 bytes)
The resulting SharedSecret is intended to seed:
| Type | Purpose |
|---|---|
LocalIdentity |
Own identity + secret material |
LocalUser |
Stable local user reference |
X3dhBundle |
Public identity data for peers |
X3dhInitiation |
Initiator handshake message |
X3dhResponderKeys |
Responder private keys |
SharedSecret |
Derived symmetric secret |
| Function | Role |
|---|---|
LocalIdentity::new() |
Create a new local identity |
LocalIdentity::bundle() |
Export public X3DH bundle |
LocalIdentity::verify_bundle() |
Verify remote bundle |
x3dh_initiate() |
Initiate X3DH handshake |
x3dh_respond() |
Respond to X3DH handshake |
pub struct LocalUser {
pub uuid: Uuid,
pub username: String,
}
uuid is generated locally and never transmittedusername is the human-readable identifier (future @user)A LocalIdentity owns all private cryptographic material.
Internally it contains:
Creation:
let id = LocalIdentity::new("alice")?;
Validation rules:
pub struct X3dhBundle {
pub username: String,
pub identity_public_key: [u8; 32],
pub signed_prekey_public_key: [u8; 32],
pub signed_prekey_signature: [u8; 64],
}
This structure is fully public and intended to be:
Verification ensures:
LocalIdentity::verify_bundle(&bundle)?;
If verification fails, the bundle MUST be rejected.
This crate implements a reduced, deterministic X3DH suitable for bootstrapping.
let (init, secret) = x3dh_initiate(&remote_bundle)?;
Steps:
The initiator sends:
X3dhInitiation {
initiator_ephemeral_public_key
}
let secret = x3dh_respond(&responder_keys, &init)?;
Steps:
pub struct SharedSecret([u8; 32]);
Properties:
| Component | Algorithm |
|---|---|
| Identity keys | Ed25519 |
| Key agreement | X25519 |
| KDF | HKDF-SHA256 |
| Entropy source | OS RNG |
All primitives are modern, constant-time, and memory-safe.
This crate provides:
It does not provide:
Those are responsibilities of higher layers.
Each functional responsibility is tested independently.
All tests can be run with:
cargo test
Typical integration flow:
Create LocalIdentity
Publish X3dhBundle to directory/nodes
Resolve peer bundle
Perform X3DH handshake
Feed SharedSecret into:
This crate is designed to be imported unchanged by:
This crate implements Block 1: Identity & Bootstrap of Enigma.
Subsequent blocks:
enigma-ratchetenigma-aeadenigma-transportenigma-node-protocolEach block is designed to remain independently testable and replaceable.