wasmtime host: from_material — Rust-held keys as typed handles (#395) - #396
Merged
Conversation
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.
Closes #395.
The native parity for the #392 seams: per-kind constructors on the wasmtime host that place embedder-held signature key material in the store's resource table as typed handles —
SigningKey::from_material(view, SigningKeyMaterial)andVerifyingKey::from_material(view, SigPublic). No WIT change, no guest-visible change: host-implementation API, like the polyengine seam. Unblocks polyvisor's engine-host filling its app-owneddevice-identityimport (bindgen!with-maps thesignatureresources onto these types; the returnedResource<_>is what its import hands the guest).Mechanics
othercondition a guest mint does.CryptoKey,SigningKeyMaterial/SigPubliccarry every binding losslessly — algorithm, ECDSA curve/digest, PSS salt, policy — so the polyengine seam's family-refusal matrix has nothing to refuse here. Every family the core can represent injects; the existing getters answer from the supplied material and policy.SigningKeyMaterial,SigPublic,SigningPolicy, and the coreErrorare re-exported so embedders build material without a version-locked direct dependency on the core crate.Co-dependent core change (the seam makes the gap reachable):
import_ed25519_seedandimport_ecdsa_scalarwere the only public material constructors skipping the at-least-one-usage mint check — both also cited WIT functions that no longer exist. They now enforcecheck_usefullike every sibling, so injection cannot admit a usage-less key the WIT mints refuse (the polyengine seam'snot-permittedrefusal, relocated to material construction). No guest-visible effect: every WIT path already checked before reaching them.Scope: signing/verifying now (the blocked consumer); derivation kinds on demand, mirroring the browser seam's v1.
Gates:
just fmt-check,just clippy,just test(new core refusal tests,embedder_key_tests— getter/sign-verify round trip through injected handles, retention-pool parity with delete-readmits — and the runnable doctest),just rust-docswarning-free.