Skip to content

settings_adoption: an owner's adoption taken from the settings at boot - #4

Merged
Ttimmahlax merged 1 commit into
mainfrom
settings-adoption
Oct 17, 2026
Merged

Ttimmahlax merged 1 commit into
mainfrom
settings-adoption

Conversation

@Ttimmahlax

Copy link
Copy Markdown
Contributor

The boot half of an adoption delivered on the cable with a device's settings: rusty_esp_mid_core::settings_adoption::apply(settings, identity, my_did).

Reads adopt from the settings store and always removes it. Then:

  • Accepted: the container stored verbatim in identity (mid.adopt, kind in mid.adopt.kind), the owner pinned (mid.owner), the pin marked provisional (mid.owner.prov).
  • Rehomed: the pinned owner's grant at a roster version ≥ the pin.
  • Refused with a reason: malformed, another device, another owner, an older roster, over 8 KiB. Never silently rebound.

The kind is mata-statement-v1 (a wallet's {"content","jws"} container), checked structurally: header ES256/JWT, context = janus-adoption-v1, content_hash = b64url(sha256(content)), content v1 with device_did = this device and owner_did = the payload's iss, a key did:mata. The signature and roster chain wait for a no_std mid-verify; until then the pin is provisional and is re-checked once the verifier exists. Writes are ordered so a power cut is redone harmlessly.

Generic over Kv + ?Sized so a firmware's boxed stores go straight in. Tests: 6 (first adoption stored byte for byte and cleared; rehome; older roster refused; another owner refused and cleared; each structural refusal; oversize; unsized stores). mid-core 64 pass, clippy clean, no_std+alloc builds for riscv32imac.

🤖 Generated with Claude Code

The boot half of an adoption delivered on the cable (JN3): `apply`
reads `adopt` from the settings store and, whatever happens, removes it,
so a reflash of the settings slot can neither replay it nor leave it to
be read twice.

- Accepted: the container stored verbatim in identity (mid.adopt, its
  kind in mid.adopt.kind), the owner pinned (mid.owner), the pin marked
  provisional (mid.owner.prov).
- Rehomed: the pinned owner's grant at a roster version >= the pin.
- Refused, with a reason for the log: malformed, another device, another
  owner than the pinned one, an older roster, longer than 8 KiB. Never
  silently rebound.

The kind is mata-statement-v1, the wallet's {"content","jws"} container,
checked STRUCTURALLY: header ES256/JWT, context janus-adoption-v1,
content_hash = b64url(sha256(content)), content v1 with device_did this
device and owner_did == the payload's iss, a key did:mata. Signature and
roster chain wait for a no_std mid-verify; until then the pin is
provisional and the first boot with the verifier re-checks it. Writes
are ordered so a power cut between any two is redone harmlessly.

Generic over `Kv + ?Sized`, so a firmware's boxed stores go straight in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Ttimmahlax
Ttimmahlax merged commit 10a3600 into main Oct 17, 2026
8 checks passed
@Ttimmahlax Ttimmahlax mentioned this pull request Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants