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
//! `rusty_esp_mid-core` — MATA mID on the chip, the pure core.
//!
//! A Janus device is its own `did:mata`: a P-256 key generated on the chip,
//! whose compressed public key *is* the identifier. This crate holds
//! everything about that identity that needs no driver:
//!
//! | Module | Holds | Interoperates with |
//! |---|---|---|
//! | [`did`] | [`Did`] — `did:mata:<base58btc(33-byte SEC1)>`, no-alloc encode/parse | `mid-verify::did_from_pubkey` |
//! | [`key`] | [`DeviceKey`] — generate from a TRNG, persist through the `Kv` seam, ECDH | |
//! | [`signer`] | [`DeviceSigner`] — **byte-for-byte** the trait `mid`'s `kms-client` defines | `kms-client::DeviceSigner` |
//! | [`kms`] | the `NonceEnvelope` canonical form and the `SignedAssertion` a gateway verifies | `kms-types`, `kms-verifier` |
//! | [`jws`] · [`roster`] · [`token`] | JWS ES256, the self-signed genesis roster, the self-issued mID token | `mid-issuer`, `mid-verify` |
//! | [`cap`] | `component:action@scope` matching | `mata-cap` |
//! | [`adoption`] | the owner-signed **Adoption** grant: who this device answers to | (Janus-defined) |
//! | [`nonce`] | a bounded single-use nonce window | |
//! | [`manifest`] | signing the `rusty_esp_core` capability manifest | |
//! | [`setup`] | the setup session's Reply signature and stored records (enc-ble) | `rusty_esp_signal-core::setup` |
//!
//! Every canonical byte form that the `mid` repository defines is reproduced
//! here exactly and gated by tests against the real `mid` crates on the host
//! (`tests/oracle.rs`). Formats this crate *defines* (adoption, manifest
//! signature) use the same discipline: a domain separator, length prefixes,
//! big-endian integers, SHA-256, low-s ECDSA.
//!
//! Feature ladder: `std` ⊃ `alloc` ⊃ core-only. The core-only rung is what a
//! `no_std` firmware without a heap uses: keys, signatures, the borrowed kms
//! canonical form, adoption, the nonce window, manifest signing. `alloc` adds
//! the JSON envelopes, JWS and the self-issued token.
//!
//! What is deliberately not here: any driver, NVS encryption (the `-esp`
//! backend's guarantee to state), a roster-chain verifier (the upstream `mid`
//! no_std refactor's job), ed25519 (the family has none).
extern crate alloc;
pub use ;
pub use Did;
pub use ;
pub use NonceWindow;
pub use rusty_esp_core as esp_core;
pub use ;
/// The names a firmware or a backend wants in scope.
/// Crate version, for capability manifests and logs.
pub const VERSION: &str = env!;
/// The verification-method type string mID uses for every P-256 key.
pub const VM_TYPE_ECDSA_P256: &str = "EcdsaSecp256r1VerificationKey2019";
/// SHA-256 of `data`, the prehash every signature in this crate is over.