1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
//! `aethel-sdk`: a Rust surface over aethel-core's post-quantum identity primitives.
//!
//! ```
//! use aethel_sdk::{verify, Identity};
//!
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // The signing key is derived inside the embedded component from OS entropy
//! // and never enters this process.
//! let mut identity = Identity::generate()?;
//!
//! let message = b"the message that was actually signed";
//! let signature = identity.sign(message)?;
//!
//! // Ok(false) is "this signature does not verify". An Err means the input
//! // could not be processed at all. They are different answers: treating an
//! // error as "invalid" is what makes malformed input look like a failed check.
//! assert!(verify(identity.public_key(), message, &signature)?);
//! assert!(!verify(identity.public_key(), b"something else", &signature)?);
//!
//! // The interoperable form of the public key, for a DID document.
//! println!("{}", identity.public_key_multibase());
//! # Ok(())
//! # }
//! ```
//!
//! # Read this before the feature list
//!
//! This crate is **identity-only** by default: post-quantum signing, sealed
//! persistence, threshold recovery, and context-bound projections that are
//! unlinkable across contexts.
//!
//! **Credentials are off by default, behind the `experimental-credentials`
//! feature, and should not be relied on.** `aethel-core`'s `SECURITY.md`
//! records that the credential commitment does not hide what it commits to: a
//! presentation reveals every attribute it carries, disclosed or not, and two
//! presentations of one credential are linkable. Disclosed attributes are also
//! self-asserted, and a presentation cannot leave the process that made it.
//! Fixing that is a separate line of work, and until it lands the feature
//! exists so the work can continue in public, not for production use.
//!
//! Fuller worked examples are in `examples/` in the published package:
//! `quickstart.rs` (generate, sign, verify, persist, project) and
//! `projection.rs`. Run them with `cargo run --example quickstart` from a
//! checkout of the repository.
//!
//! # Before you add this crate
//!
//! This crate embeds a WebAssembly runtime. `cargo add aethel-sdk` pulls
//! wasmtime and Cranelift, roughly 120 crates, and a cold debug build takes
//! **several minutes** and produces a target directory over a gigabyte. That is
//! a one-time cost and it is not a hung build. Separately, the first
//! verification in a process pays a ~230 ms component compile; [`Verifier`]
//! exists so you can pay that at startup rather than on a caller's request.
//!
//! Host platforms only. wasmtime needs mmap and cannot itself be compiled to
//! `wasm32-unknown-unknown`, so this crate is scoped away from that target: it
//! will not build for a browser. The identity operations still all happen inside
//! WebAssembly; it is the runtime executing them that has to be native.
//!
//! # What you are responsible for
//!
//! Each of these can be got wrong while every call returns `Ok`:
//!
//! - **The sealing key is a single point of failure.** Lose it and the identity
//! is gone, including from a full set of recovery shares. It must be
//! high-entropy key material, never a password.
//! - **Keep the HTSS Merkle root apart from the shares.** A store that holds
//! both can substitute an entire recovery set.
//! - **Projection randomness must be fresh and secret**, and never derived from
//! the context. [`Identity::project_at`] does this for you.
//! - **Entropy quality is yours.** Generation is deterministic in its entropy,
//! so weak entropy means a predictable identity, and the component cannot
//! tell the difference.
//!
//! Out of scope, stated plainly: there has been **no third-party audit**; side
//! channels above L1 (wasmtime, your allocator, your application) are not
//! covered; physical and hardware attacks are not covered; and the security of
//! the constructions rests on `aethel-core`'s stated assumptions rather than on
//! anything this crate's tests can prove.
//!
//! [`SECURITY-MODEL.md`](https://github.com/0x307/aethel-sdk/blob/main/SECURITY-MODEL.md)
//! is the long form of this section, with how each claim is checked. It ships
//! in this package, so it is in the crate you installed even when you are
//! reading these docs online.
//!
//! # What runs today
//!
//! The compiled `aethel:core` component is embedded in this crate, its integrity
//! is checked against a hash the package declares ([`artifact`]), and it loads
//! and executes in an embedded runtime ([`component`]).
//!
//! It is the L1 boundary from the initiative charter: one WebAssembly artifact,
//! embedded by every language, carrying every cryptographic operation. Nothing
//! in this crate implements crypto, and nothing in this crate is allowed to.
//!
//! On top of that, the following work end to end, and every one of them is
//! exercised by the test suite and by `examples/quickstart.rs`, which runs in
//! CI:
//!
//! - [`Identity::generate`] and [`Identity::from_entropy`], keys derived inside
//! the component and never present in this process
//! - [`Identity::sign`], and the free function [`identity::verify`] (there is
//! no `Identity::verify`: verification needs only public material). ML-DSA-65
//! - [`Identity::export_sealed`] and [`Identity::open_sealed`], so an identity
//! survives the process
//! - [`Identity::split_for_recovery`] and [`Identity::recover_from_shares`],
//! authenticated 3-of-5 recovery over the canonical sealed identity
//! - [`Identity::public_key_multibase`] and [`public_key_from_multibase`], W3C
//! Multikey transport and decoding for ML-DSA-65 verification material
//! - [`Identity::sign_typed`] and [`verify_typed`], typed signatures and
//! verification using `pqc-sig` transport representations
//! - [`Identity::project_at`], fresh, context-bound PLP projections
//!
//! With the `experimental-credentials` feature, `Identity::issue_credential`,
//! `Identity::present` and `verify_presentation` are compiled in as well. They
//! run, and their tests pass in CI, but they are not safe to rely on: see the
//! top of this page.
//!
//! # What is not on this surface
//!
//! Callable through the component but not wrapped here: standalone PLP proof
//! (`prove`, `plp-verify`).
//! `ROADMAP.md` has the sequence.
//!
//! # What is not built anywhere
//!
//! - **Key rotation.** There is no way to bind an identity to a successor.
//! - **Everything credential-shaped beyond the experimental feature**: a
//! commitment that hides, issuer-authenticated issuance, two-party issuance,
//! revocation and expiry, and a way to prove a threshold over a hidden value.
//! That is the credential line of work, and the expected `1.0` is identity
//! plus credentials once it lands.
//!
//! # A correction
//!
//! Earlier versions of this comment said the ergonomic surface was "designed and
//! none of them is callable from this crate yet", and that "SAAP selective
//! disclosure does not work in the embedded component" because `saap-verify`
//! denied unconditionally. Both were true once and neither is true now. The
//! credential tests, run in CI with `--features experimental-credentials`,
//! exercise those paths and pass. Passing is not the same as sound, which is why
//! the feature is off by default.
//!
//! ---
//!
//! ## The 0x307 crate family
//!
//! `aethel-sdk` is one of six open-source crates from [0x307](https://0x307.com/crates), held to one
//! audit and stability standard.
//!
//! | Crate | Tier | What it does |
//! |---|---|---|
//! | [pqc-sig](https://crates.io/crates/pqc-sig) | Production | ML-DSA, SLH-DSA and FN-DSA signatures (FIPS 204/205/206) |
//! | [pqc-kem](https://crates.io/crates/pqc-kem) | Production | ML-KEM (FIPS 203), the X25519 + ML-KEM-768 hybrid, X-Wing, and sealed boxes |
//! | [aethel-core](https://crates.io/crates/aethel-core) | Production | Post-quantum anonymous identity: a separate identifier per context, context-bound ML-DSA signing |
//! | [aethel-sdk](https://crates.io/crates/aethel-sdk) (this crate) | Preview | The SDK over aethel-core, and the place to start |
//! | [aethel-vault](https://crates.io/crates/aethel-vault) | Preview | Agent-held wallet: policy-gated x402 / EIP-3009 signing with ML-DSA-65 spend records |
//! | [pqc-privacy](https://crates.io/crates/pqc-privacy) | Lab | Research bundle, kept off every identity and payment path |
//!
//! **Production** crates are thin, standards-bound libraries meant to be depended on today. **Preview** crates work and are published, with APIs still settling. **Lab** crates are research, never on an identity or payment path.
//!
//! **Runnable examples:** [0x307/examples](https://github.com/0x307/examples), one program per
//! crate, pinned to the published versions.
//!
//! **Audit status:** None of these crates has been independently audited, and none holds a CMVP / FIPS 140-3 validation. "FIPS 203/204/205/206" means the algorithms follow those standards, not that the code is certified. Known issues for this crate are in
//! [SECURITY.md](https://github.com/0x307/aethel-sdk/blob/main/SECURITY.md). Versioning and yanks:
//! [STABILITY.md](https://github.com/0x307/aethel-sdk/blob/main/STABILITY.md).
//!
/// Credentials. Off by default: see the crate docs for why.
pub use ;
pub use ;
pub use Purpose;
/// Canonical algorithm-labelled signature transport types supplied by
/// `pqc-sig`. They are representations and encoders only; this SDK continues
/// to perform signing and verification through its embedded aethel-core
/// component.
pub use ;
pub use Verifier;
/// The agent-identity guide's Rust blocks, compiled as doctests so the guide
/// cannot drift from the API.
/// The credential API must not be reachable without its feature.
///
/// This module is compiled only when the feature is off, so its doctest runs in
/// exactly the configuration it checks. Pinned to E0432 (unresolved import), so
/// the doctest cannot pass by failing for some unrelated reason.
///
/// ```compile_fail,E0432
/// use aethel_sdk::Credential;
/// fn main() {}
/// ```