Skip to content

Derived inputs: wallet-computed cryptographic values#88

Merged
iamalwaysuncomfortable merged 1 commit into
examples/private-inputs-examplefrom
feat/derived-inputs
May 28, 2026
Merged

Derived inputs: wallet-computed cryptographic values#88
iamalwaysuncomfortable merged 1 commit into
examples/private-inputs-examplefrom
feat/derived-inputs

Conversation

@iamalwaysuncomfortable

Copy link
Copy Markdown
Member

Description

Adds a fourth InputRequest variant { type: "derived", algorithm, args }. The wallet runs a named cryptographic algorithm over its own state (view key, wallet-maintained counters) plus dapp-supplied args, and substitutes the result into the transaction input slot. The dapp never observes the wallet-side inputs — only the output.

Strictly opt-in

A new algorithmsAllowed?: AlgorithmGrant[] field on ConnectOptions authorizes derived inputs at exact (algorithm, program, function, inputPosition) call sites. All four fields are required and exact-match — there is no wildcard and no broad default. The wallet refuses every derived request whose tuple is not present in the allowlist.

A new adapter method algorithmsSupported(): Promise<string[]> lets a dapp discover which algorithms a wallet implements before populating the allowlist. Wallets without derived-input support return [].

Inaugural algorithm

program-scoped-address-blind — produces a per-program blinded address.

Property Value
args (dapp-provided) { "domain-separator": field }
wallet-derived inputs program address, active view key, wallet-maintained counter
output type address
valid input slot positions address, group, scalar, field

Backward compatibility

Existing connect() calls and inputs: string[] keep working — the new type: "derived" variant is opt-in per-slot and algorithmsAllowed defaults to undefined. Adapters that do not yet implement derived inputs throw WalletConnectOptionsNotSupportedError via the existing hasUnsupportedConnectOptions path when a dapp sets the new field. Shield forwards the option through to the extension, which is expected to implement the receiving side.

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 📚 Documentation update

Packages Changed

  • @provablehq/aleo-types
  • @provablehq/aleo-wallet-standard
  • @provablehq/aleo-wallet-adaptor-core
  • @provablehq/aleo-wallet-adaptor-react
  • @provablehq/aleo-wallet-adaptor-shield
  • Other wallets (fox/leo/puzzle/soter): no direct edits — the existing hasUnsupportedConnectOptions path already rejects algorithmsAllowed for legacy wallets.
  • Example app — adds a Derived mode to primitive slots on the PrivateInputs demo and a connect-time AlgorithmGrant[] editor
  • Documentation — docs/adapter-privacy-extension.md § "Derived inputs"; docs/dapp-privacy-quickstart.md quickstart section

Changeset

  • .changeset/derived-inputs.md

Testing

  • pnpm lint clean.
  • pnpm --filter react-app-example build succeeds.
  • Per-package builds (aleo-types, aleo-wallet-standard, aleo-wallet-adaptor-core, aleo-wallet-adaptor-shield, aleo-wallet-adaptor-react, plus all legacy wallet adapters) clean.
  • End-to-end against a Shield extension build implementing the receiving side. Gated on wallet-side work, same staging pattern as the prior privacy-extension PRs.

Additional Notes

  • PR base is examples/private-inputs-example (Private inputs example + dapp quickstart doc #87), not master — this builds on the example branch that introduces the PrivateInputs demo.
  • Spec: docs/adapter-privacy-extension.md § "Derived inputs".
  • Quickstart: docs/dapp-privacy-quickstart.md § "Derived inputs (type: "derived")".

@vercel

vercel Bot commented May 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
aleo-dev-toolkit-documentation Ready Ready Preview, Comment May 28, 2026 3:41am
aleo-dev-toolkit-react-app Ready Ready Preview, Comment May 28, 2026 3:41am

Request Review

…lues

Adds a fourth `InputRequest` variant `{ type: "derived", algorithm, args }`
that asks the wallet to run a named cryptographic algorithm over its own
state (view key, wallet-maintained counters, etc.) plus dapp-supplied args,
and substitutes the result into a transaction input slot. The dapp never
observes the wallet-side inputs — only the output.

Strict opt-in via a new `algorithmsAllowed?: AlgorithmGrant[]` field on
`ConnectOptions`: each grant authorizes exactly one
`(algorithm, program, function, inputPosition)` call site, all four fields
required and exact-match. The wallet refuses every derived request whose
tuple is not present. No broad default.

A new `algorithmsSupported(): Promise<string[]>` adapter method lets dapps
discover what a wallet implements before populating the allowlist.
Wallets without derived-input support return `[]` (default) and connections
with non-empty `algorithmsAllowed` throw `WalletConnectOptionsNotSupportedError`
via the existing `hasUnsupportedConnectOptions` path.

Inaugural algorithm: `program-scoped-address-blind`. Inputs: `{ "domain-separator": field }`.
Output: `address`. Valid slot positions: `address`, `group`, `scalar`, `field`.

Updates the PrivateInputs example with a fourth `Derived` mode on primitive
slots whose baseType is in an algorithm's `validSlotTypes`, plus a
connect-time `AlgorithmGrant[]` editor with an "Auto-grant this function's
eligible slots" convenience button. The grant JSON preview now includes
`algorithmsAllowed`.

See docs/adapter-privacy-extension.md §"Derived inputs" for the spec and
docs/dapp-privacy-quickstart.md for an implementor's guide.
@iamalwaysuncomfortable iamalwaysuncomfortable changed the base branch from examples/private-inputs-example to master May 28, 2026 03:48
@iamalwaysuncomfortable iamalwaysuncomfortable changed the base branch from master to examples/private-inputs-example May 28, 2026 03:48
@iamalwaysuncomfortable iamalwaysuncomfortable merged commit 756011a into examples/private-inputs-example May 28, 2026
3 checks passed
@iamalwaysuncomfortable iamalwaysuncomfortable deleted the feat/derived-inputs branch May 28, 2026 17:44
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.

1 participant