Skip to main content

Crate rusty_esp_mid_core

Crate rusty_esp_mid_core 

Source
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:

ModuleHoldsInteroperates with
didDid — did:mata:<base58btc(33-byte SEC1)>, no-alloc encode/parsemid-verify::did_from_pubkey
keyDeviceKey — generate from a TRNG, persist through the Kv seam, ECDH
signerDeviceSigner — byte-for-byte the trait mid’s kms-client defineskms-client::DeviceSigner
kmsthe NonceEnvelope canonical form and the SignedAssertion a gateway verifieskms-types, kms-verifier
jws · roster · tokenJWS ES256, the self-signed genesis roster, the self-issued mID tokenmid-issuer, mid-verify
capcomponent:action@scope matchingmata-cap
adoptionthe owner-signed Adoption grant: who this device answers to(Janus-defined)
noncea bounded single-use nonce window
manifestsigning the rusty_esp_core capability manifest
setupthe 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-cap semantics, over borrowed strings.
did
did:mata — the self-certifying identifier.
jws
JWS compact form for ES256, as mid-issuer builds it.
key
The device key: generated once from the chip’s TRNG, persisted through the Kv seam, never leaving the process in plaintext except to that seam.
kms
The gateway handshake: a server-issued NonceEnvelope, signed by the device into a SignedAssertion. Byte-identical to kms-types.
manifest
Signing the rusty_esp_core capability 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 Kv whose 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’s DeviceSigner, 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§

DeviceSigner
The abstract capability a device’s signing key provides.

Functions§

sha256
SHA-256 of data, the prehash every signature in this crate is over.