Expand description
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).
Re-exports§
pub use adoption::Adoption;pub use adoption::AdoptionFields;pub use adoption::OwnerPin;pub use did::Did;pub use key::DeviceId;pub use key::DeviceKey;pub use nonce::NonceWindow;pub use signer::verify_prehash;pub use rusty_esp_core as esp_core;
Modules§
- adoption
- Adoption — the owner-signed grant that tells a device who it belongs to and who it may talk to. It is the Pi-mission bind record, signed.
- cap
- Capability matching with
mata-capsemantics, over borrowed strings. - did
did:mata— the self-certifying identifier.- jws
- JWS compact form for ES256, as
mid-issuerbuilds it. - key
- The device key: generated once from the chip’s TRNG, persisted through the
Kvseam, never leaving the process in plaintext except to that seam. - kms
- The gateway handshake: a server-issued
NonceEnvelope, signed by the device into aSignedAssertion. Byte-identical tokms-types. - manifest
- Signing the
rusty_esp_corecapability manifest. - nonce
- A bounded single-use nonce window: the replay defence for control frames that arrive with a nonce (adoption tickets, local control, signal-session handshakes). Fixed capacity, no heap; the oldest entry is evicted.
- prelude
- The names a firmware or a backend wants in scope.
- roster
- The self-signed genesis roster — the identity proof embedded in a
self-issued mID token. Types, field names and the canonical byte form are
those of
mid-issuer; the device’s genesis roster has exactly one verification method: itself. - seal
- Secrets at rest: a
Kvwhose values are sealed under a device key. - settings_
adoption - An adoption delivered with the settings — the owner’s grant written on the cable alongside the network, taken into the device’s identity at boot, before any network starts.
- setup
- The setup session’s identity pieces (enc-ble; the protocol is the Janus
umbrella’s
docs/setup-protocol.md, v1): the device’s signature over a session’s Reply, and the names the session’s two records are stored under. - signer
- The signing seam — upstream
mid-signer’sDeviceSigner, re-exported, plus the family’s verifier. - status
- The signed status — how a device proves, on a local network, who it is and who it belongs to, in answer to a verifier’s fresh nonce.
- token
- The self-issued mID token: what a device presents to any relying party
that runs
mid-verify— including the home computer’s sign-in kit.
Constants§
- VERSION
- Crate version, for capability manifests and logs.
- VM_
TYPE_ ECDSA_ P256 - The verification-method type string mID uses for every P-256 key.
Traits§
- Device
Signer - The abstract capability a device’s signing key provides.
Functions§
- sha256
- SHA-256 of
data, the prehash every signature in this crate is over.