mid-types: the wire format as a no_std leaf; mid-verify no_std over it - #1
Open
Ttimmahlax wants to merge 1 commit into
Open
mid-types: the wire format as a no_std leaf; mid-verify no_std over it#1Ttimmahlax wants to merge 1 commit into
Ttimmahlax wants to merge 1 commit into
Conversation
mid-issuer's wire types (the JWT payload, embedded rosters and verification methods) and the canonical signing bytes move to a new `mid-types` crate that is `no_std` + `alloc` (`std` forwards to serde and serde_json). mid-issuer re-exports them from the same module paths, so nothing that named `mid_issuer::MidJwtPayload` or `mid_issuer::canonical` changes. mid-verify depends on mid-types instead of mid-issuer, is `#![no_std]` with `alloc`, and gains a `std` default feature that only forwards to its dependencies; thiserror moves to 2.x for the no_std derive. One API change: `VerifyError::Base64Decode`'s field is `cause` (base64 implements the error trait only with std, so the field cannot be an implicit `source` on the no_std arm; `#[source]` is kept under `std`), and `PayloadJson` keeps its `From<serde_json::Error>` by hand. Why: a device that signs its own genesis roster and self-issued token (the Janus ESP32 family) should carry these types from here rather than keep a copy; a verifier should fit a chip. Gates: `cargo test -p mid-types -p mid-verify` (10 + 26 green), `cargo check -p mid-types -p mid-verify --no-default-features --target riscv32imac-unknown-none-elf`, `cargo check --workspace`. clippy on kms-client already fails on a `generic-array` deprecation on main; mid-types and mid-verify are clippy-clean. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This was referenced Sep 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
mid-types(new): the mID wire-format types (MidJwtPayload,ClaimValue,AttestedBy,EmbeddedGenesisRoster,EmbeddedRosterChainEntry,VerificationMethod,EmbeddedVerificationMethod, the request types) andcanonical::{genesis_canonical_bytes, chain_entry_canonical_bytes}, moved verbatim out ofmid-issuer.no_std+alloc;std(default) only forwards to serde and serde_json. The unit tests moved with them.mid-issuerdepends onmid-typesand re-exports everything from the same module paths (mid_issuer::types::*,mid_issuer::canonical::*, and thepub usein the root), so no consumer changes.mid-verifydepends onmid-typesinstead ofmid-issuer, is#![no_std]withalloc, and gains astddefault feature that forwards to its dependencies.thiserrormoves to 2.x for the no_std derive.Why
A device that signs its own genesis roster and self-issued token — the Janus ESP32 family (
rusty_esp_mid) — was carrying a copy of these types. It now imports them frommid-types; its oracle tests, which compare its canonical bytes withmid-issuer's and verify its tokens withmid-verify, pass unchanged (28 unit + 7 oracle tests, including a byte-identical genesis-roster canonical form). A verifier that fits a chip is the second half of the same seam.API changes (please read)
VerifyError::Base64Decode { segment, source }→{ segment, cause }.base64implements the error trait only withstd, so the field cannot be an implicitsourceon the no_std arm; understdit is still marked#[source].VerifyError::PayloadJsonkeepsFrom<serde_json::Error>(hand-written) and its#[source]understd.Gates run here
cargo test -p mid-types -p mid-verifycargo check -p mid-types -p mid-verify --no-default-features --target riscv32imac-unknown-none-elfcargo check --workspacecargo clippy -p mid-types -p mid-verify --all-targets -- -D warningskms-clientalready fails clippy onmain(ageneric-arraydeprecation insigner.rs:94), untouched hererusty_esp_mid-coreon this branchalloc🤖 Generated with Claude Code