Skip to content

Thread actual Keyhive types through APIs - #8

Open
expede wants to merge 1 commit into
mainfrom
fixes
Open

expede wants to merge 1 commit into
mainfrom
fixes

Conversation

@expede

@expede expede commented Sep 8, 2026

Copy link
Copy Markdown
Member

No description provided.

@expede
expede requested review from a team and a lite review from Copilot September 8, 2026 20:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new test helper unhex can panic despite returning Result, and should validate/return errors consistently to avoid fragile fixture parsing.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR updates onomancy_keyhive to use the same content-reference type as keyhive_wasm (browser peers), threading that type through the crate’s Keyhive instantiations and carriage parsing so real-world carriages with non-empty after_content decode/verify correctly.

Changes:

  • Introduce ContentRef = Vec<u8> and parameterize Keyhive/Carriage APIs over it instead of [u8; 32].
  • Update authority verification and carriage encoding/decoding paths to use ContentRef.
  • Add a browser-captured carriage fixture and tests to ensure decoding and signing-bar authorization behavior matches browser-emitted evidence.
File summaries
File Description
onomancy_keyhive/tests/fixtures/ark_owner_carriage.hex Adds a real browser-captured carriage entry set used as a decoding/authorization fixture.
onomancy_keyhive/tests/authority.rs Updates tests to use ContentRef in event/carriage plumbing.
onomancy_keyhive/tests/ark_carriage.rs Adds end-to-end tests validating a browser-emitted carriage decodes and authorizes correctly.
onomancy_keyhive/src/mint.rs Mints delegations using StaticDelegation<ContentRef> to align with the new content-ref parameterization.
onomancy_keyhive/src/lib.rs Defines and documents the ContentRef alias to match keyhive_wasm’s bincode layout expectations.
onomancy_keyhive/src/carriage.rs Re-keys Carriage to StaticEvent<ContentRef> so parsing matches browser-emitted encoding.
onomancy_keyhive/src/authority.rs Updates the verifier’s internal Keyhive Instance type parameters to use ContentRef.
Review details
  • Files reviewed: 7/7 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread onomancy_keyhive/tests/ark_carriage.rs Outdated
Keyhive is generic over its content-reference type, and bincode encodes
`[u8; 32]` bare but `Vec<u8>` length-prefixed. A peer instantiating
Keyhive over a variable-width reference therefore emits a different wire
format under the same Keyhive version, and `kh0` — Keyhive's default
`[u8; 32]` hash — cannot read it.

Minted carriages always have an empty `after_content`, which encodes
identically under either type, so no existing test could observe the
mismatch. Freeze a browser-captured carriage whose root delegation
carries a 10-byte reference and pin the outcome: `UndecodableEvent` at
entry 0, nobody authorized, nothing on path. Undecodable vouches
nothing and is never misread into an acceptance.

Document the `[u8; 32]` commitment on `ENVELOPE_TAG` and add a fixture
README with the capture's provenance.
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