feat(lit-api-server): unsigned POST /prepare_wallet derived-address endpoint#576
Open
clawdbot-glitch003 wants to merge 3 commits into
Open
feat(lit-api-server): unsigned POST /prepare_wallet derived-address endpoint#576clawdbot-glitch003 wants to merge 3 commits into
POST /prepare_wallet derived-address endpoint#576clawdbot-glitch003 wants to merge 3 commits into
Conversation
… endpoint
Adds the no-signature equivalent of `create_wallet_with_signature`: returns a
freshly derived `{wallet_address, derivation_path}` with no EIP-712 signature
and no API key, so a ChainSecured client can obtain a PKP address before
registering it on-chain and collapse the owner ceremony into a single signed
bind UserOp (flows#532: new EVM wallet 3->1 prompts, first exchange connect
2->1).
The EIP-712 signature on the sibling endpoint authorizes nothing durable (it
only gates the mint API's shape and is trivially self-signed); the real
attach step is the client's own on-chain `registerWalletDerivation`. Dropping
it removes UX friction, not a security check.
Server generates the derivation path (256-bit CSPRNG); clients cannot supply
their own, which avoids low-entropy keys and the cross-account path-collision
vector tracked in chipotle#575. The endpoint carries the same `CpuAvailable`
load-shedding guard as `lit_action` since it is unauthenticated and drives a
dstack KDF call per request.
Docs + code comments call out that the endpoint is NOT idempotent: every call
mints a new wallet, retries return a different address, and concurrent callers
each get their own wallet with no server-side dedup.
Codex adversarial review: DoS exposure (added CpuAvailable guard), auth-boundary
overclaim (corrected comment, cross-ref #575), collision-doc overclaim (reworded).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
Contributor
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
Adds the prepare_wallet operation to spec.json and the generated k6 TypeScript client, fixing the openapi-to-k6 drift CI check. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
GTC6244
approved these changes
Jul 17, 2026
|
|
||
| Pass `derivation_path` verbatim into `registerWalletDerivation(adminHash, wallet_address, derivation_path, name, description)` on the AccountConfig contract — until that lands, the PKP exists in MPC but is not registered to any account. | ||
|
|
||
| <Note> |
Contributor
There was a problem hiding this comment.
Do we want any additional documentation around "why" you might do this ?
It's very much a flows thing ATM ...
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.
What
Adds
POST /core/v1/prepare_wallet— the no-signature equivalent ofcreate_wallet_with_signature. It returns a freshly derived{ wallet_address, derivation_path }with no EIP-712 signature and no API key, so a ChainSecured client can obtain a PKP address before registering it on-chain and fold the whole owner ceremony into a single signed bind UserOp.Addresses the Chipotle "derived-wallet-address endpoint" side of flows#532:
Why this is safe (and why it's just a new endpoint)
The existing
*_with_signature"mint" endpoints don't mint anything on-chain — they generate a random derivation path, derive the key deterministically from the TEE/dstack KDF, and return the address. The client does the real authorization step itself: an on-chainregisterWalletDerivationinside its owner-signed UserOp. The EIP-712 signature authorizes nothing durable — it only gates the mint API's shape and is trivially self-signed. Dropping it removes UX friction, not a security check. An un-registered response is equivalent to a discarded keypair (compute-only cost).The
xpub/client-side-derivation alternative was ruled out: the current derivation is hardened-KDF (no EC structure to retrofit), and Chipotle exports derived secrets as usage API keys, so a published xpub + one leaked child key would compromise the whole tree.Design choices
_with_signaturesiblings — the ChainSecured ceremony has no API key at this point.CpuAvailableload-shedding guard (same onelit_actionuses): since it's unauthenticated and drives a dstack KDF call per request, this bounds an anonymous caller under CPU saturation.Changes
prepare_wallet()handler +PrepareWalletResponsemodel, route + OpenAPI registration.e2e/tests/api/prepare-wallet.spec.ts) + client method: asserts well-formed address/path and non-idempotency.POST /prepare_walletsection indocs/management/api_direct.mdxwith the concurrencyWarning.plans/prepare-wallet-endpoint.md.Codex adversarial review
Ran
codex challenge(high). 3 findings, all addressed:CpuAvailableguard.Testing
cargo check -p lit-api-serverpasses.Follow-ups (out of scope)
create_wallet_with_signature/add_usage_api_key_with_signatureonce flows migrates.🤖 Generated with Claude Code