@riddledc/riddle-proof-app-contract
v0.4.1
Published
Small browser app contract helpers for Riddle Proof evidence hooks.
Readme
@riddledc/riddle-proof-app-contract
Small, explicit helpers for exposing app state to Riddle Proof checks.
Riddle Proof only inspects a tiny contract; your app should provide only the data needed for reliable checks.
Install
pnpm add @riddledc/riddle-proof-app-contractBrowser contract
Use the browser helper to install the proof contract in runtime pages:
import { installRiddleProofContract } from "@riddledc/riddle-proof-app-contract/browser";
installRiddleProofContract({
version: "my-app.proof.v1",
getState: () => ({
// state is read every time captureDiagnostic/getState is called.
currentMode: "play",
visiblePanel: "hud",
itemCount: 5,
}),
route: location.pathname,
});The helper keeps state compact by redacting common secrets by default and returns callable contract helpers:
getState()for the latest redacted state at read time.captureDiagnostic()for a compactriddle-proof.capture-diagnostic.v1snapshot.
Redaction
Use the redaction helper directly when you prepare contract state.
import { redactObject } from "@riddledc/riddle-proof-app-contract/redaction";
const state = redactObject({
token: "abc",
score: 10,
cart: { user: { email: "[email protected]", token: "secret" } },
});Exports
./browser:installRiddleProofContractreadRiddleProofContractuninstallRiddleProofContractnormalizeRoute
./redaction:redactObjectredactPathcreateDefaultSensitivePaths
./types: shared types and shared contract defaults
CI / profile intent
Apps with this contract can avoid brittle DOM scraping by exposing stable state under a single, reviewable contract.
