joy_core/auth/mod.rs
1// Copyright (c) 2026 Joydev GmbH (joydev.com)
2// SPDX-License-Identifier: MIT
3
4//! Cryptographic identity for Joy's Trust Model.
5//!
6//! Auth provides passphrase-derived Ed25519 identity keys using Argon2id
7//! for key derivation. This is the Trustship pillar of AI Governance:
8//! it answers "who is this?" with cryptographic proof rather than
9//! self-declaration.
10//!
11//! Key hierarchy:
12//! ```text
13//! Passphrase + Salt --[Argon2id]--> DerivedKey --[Ed25519]--> IdentityKeypair
14//! ```
15
16pub mod consumed;
17pub mod delegation;
18pub mod derive;
19pub mod session;
20pub mod sign;
21pub mod token;
22
23/// Cross-module test lock: modules in this tree mutate process-global
24/// `XDG_STATE_HOME` in their unit tests. Cargo runs tests in parallel, so
25/// without one shared mutex the modules would trample each other's
26/// per-test tempdir overrides.
27#[cfg(test)]
28pub(super) static STATE_ENV_LOCK: std::sync::Mutex<()> = std::sync::Mutex::new(());