feat: mock platform#258
Draft
decrypto21 wants to merge 13 commits into
Draft
Conversation
a3bd662 to
52e642f
Compare
This was referenced Jul 3, 2026
…in, JS oracle parity
…igner, new review/storage variants)
…ductRuntimeConfig, WasmPairingHostRuntime, mock.dot id)
52e642f to
c68127e
Compare
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.
feat: mock host foundation — MockPlatform + mock wallet + createMockHost, on the real core
Summary
A mock host that swaps the seams while running the real Rust core. Tests, CI, and product
test-suites exercise the actual
truapi-serverdispatcher, permission service, storage, andstatement-store logic — with the device and wallet supplied by config-driven, in-memory doubles
instead of a real phone or paired wallet. Deterministic, deviceless, scriptable.
Why "swap the seam, keep the core"
TrUAPI is one core with two seams: the platform seam (
truapi-platformcapability traits) andthe wallet seam (SSO + statement store). The mock replaces only those seams. Because every
request still flows through the real core, the mock is faithful by construction — it can't drift
from real host semantics the way a hand-rolled fake would.
What this delivers
truapi-platform—MockPlatform(behind themockfeature, dev-only)MockConfig: permission policy (AllowAll/DenyAll, device + remote), feature support, theme,confirmation control, chain behavior (
Silent/Scripted/Closed/ConnectError), andMockFaultserror injection.(navigations, notifications, confirmations, auth-state, sent RPC) for assertions.
truapi-server—mock_wallet(behind themockfeature)MockWalletPlatform+MockWalletConnection: in-process, deterministic SSO pair + sign overthe statement-store channel (sr25519 proofs, P-256 ECDH → HKDF → AES-GCM). It reuses the real
statement-store signing helper, so it stays in lockstep with production framing. Slice-0:
in-process-valid, not chain-valid — real on-chain signing is Headless pairing + signing hosts #264 (below).
Through-core proof — tests build the real core from the mock
(
from_platform_with_config+ SCALE) and assert on the wire envelopes the dispatcher emits.truapi-host-wasm—createMockHost— an in-memoryHostCallbacks(tsc-enforced complete),a headless WASM-bridge test proving the real WASM core drives the mock across JS↔SCALE↔WASM, and
a
host-wasmCI job. (The one-linecreateMockClient+ real-browser E2E are in #261.)Relationship to the real headless host (#264) and simulation (#36)
This is the deterministic, deviceless tier. It is complementary to
#264 (a real headless pairing/signing host: real
People-chain statement store, real mnemonic signer) — #264 has no mock, this has no real signer, and
the two do not overlap. Real-chain and real-signing capabilities are deliberately deferred to #264,
not reimplemented here. The simulation program
(sdk-team#36) builds on both: deterministic scale on
this mock, real-API runs through #264.
Status (rebased onto current #104, green)
truapi-platform(MockPlatform)truapi-server(mock_wallet+ through-core)truapi-host-wasm(createMockHost+ WASM bridge)tscclean; fresh WASM bundlefmt·clippy --all-features -D warnings·test --workspace --all-features2 through-core tests parked (
#[ignore]d + flagged, not deleted): the mock wallet'ssigning-response framing and preimage-submit path depend on #104 SSO internals that are still in
flight (opaque SSO ids / statement-proof routing; preimage now needs a bulletin allowance signer).
Un-park once those settle.
Scope & safety
mockfeature is a dev-dependency only — never in the default/production build.Stacked on
#104 (Rust core port). Merge order: #104 → #258 → #261. Tracked by #257.