Index of every page on this site: llms.txt
All skills
1shot-api avatar

/webauthn-prf-wallet

@01cfb41
by 1Shot API1shot-api/skills1 stars
Run it yourself

Build an iframe-isolated, passkey-derived Ethereum wallet using the WebAuthn PRF extension. Use when the user wants to implement a passkey-based wallet, derive an EVM private key from a passkey without server custody, add a non-custodial wallet pattern to a web app, harden wallet key handling against XSS via an isolated iframe, or check whether a client platform supports the WebAuthn PRF extension. Covers PRF + HKDF → secp256k1 key derivation, LongBlob fallback for compatibility, cross-frame RPC via Postmate, and browser/OS platform support gating.

Use this Skill: https://skilld.dev/gh/1shot-api/skills/webauthn-prf-wallet

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

README.md

≈1.3k tokens on demand. Your agent reads this file only when SKILL.md points to it.

webauthn-prf-wallet

An Agent Skill for implementing an iframe-isolated, passkey-derived Ethereum wallet using the WebAuthn PRF extension.

This skill teaches an AI coding agent how to build a non-custodial EVM wallet where:

  • The private key is deterministically derived from a user's passkey via the WebAuthn PRF extension + HKDF-SHA-256.
  • The key lives only inside an isolated, same-origin iframe — the parent page's JavaScript can never read it, substantially reducing XSS and supply-chain risk.
  • Users on platforms without PRF support fall back to LongBlob (credBlob / largeBlob) and/or an AES-encrypted recovery phrase, so nobody is locked out.
  • The server never sees the private key, the PRF output, or anything derived from it — it only verifies WebAuthn signatures.

It was extracted from a production implementation and distilled into framework-agnostic guidance plus a concrete Next.js example.

What's in this skill

webauthn-prf-wallet/
├── SKILL.md                          # Top-level entry point — read first
├── README.md                         # You are here
├── references/
│   ├── prf-derivation.md             # PRF output → secp256k1 key (HKDF)
│   ├── platform-support.md           # Browser/OS/webview compatibility gating
│   ├── iframe-isolation.md           # Postmate RPC + the display:none gotcha
│   ├── longblob-fallback.md          # credBlob / largeBlob / recovery phrase
│   ├── server-integration.md         # WebAuthn RP endpoints (framework-agnostic)
│   └── nextjs-example.md             # Concrete Next.js App Router walkthrough
└── assets/
    ├── prfToValidEthPrivKey.ts       # Copy-ready HKDF derivation (Web Crypto)
    ├── platformSupport.ts            # Copy-ready isWebview / isPlatformSupported
    └── WalletIframeSketch.ts         # Copy-ready iframe wallet helper

How to use this skill

With a Cursor / Claude / other agent

Point your agent at SKILL.md. The frontmatter description is written to trigger on prompts like:

  • "add a passkey-based Ethereum wallet"
  • "derive a private key from a WebAuthn credential"
  • "I want a non-custodial wallet that doesn't require a seed phrase"
  • "check if the browser supports WebAuthn PRF"

The agent will then read SKILL.md, pull in relevant references/*.md files, and copy / adapt the files in assets/ into the host project.

Manually

  1. Read SKILL.md end-to-end first — it's the overview and lists the critical nuances.
  2. Copy assets/prfToValidEthPrivKey.ts and assets/platformSupport.ts into your project's client utilities.
  3. Use assets/WalletIframeSketch.ts as the starting point for the iframe page's helper class.
  4. Follow references/iframe-isolation.md to set up the parent WalletProxy and the Postmate handshake.
  5. Follow references/server-integration.md (or references/nextjs-example.md for Next.js specifically) to wire up the WebAuthn relying party endpoints.
  6. Add references/longblob-fallback.md if you need to support devices without PRF.

Prerequisites

  • A web app you control (SPA, Next.js, SvelteKit, etc.) with HTTPS in production.
  • A server endpoint for WebAuthn registration/authentication with a short-TTL challenge store (Redis, Cloudflare KV, DynamoDB with TTL, etc.).
  • A database for users and passkey credentials.

Runtime dependencies

The snippets in assets/ assume:

npm install @simplewebauthn/browser @simplewebauthn/server ethers postmate bowser

@simplewebauthn/server and ethers versions work with any recent major; the code does not depend on bleeding-edge features.

License

MIT. Adapt freely. If you publish derivatives, a link back is appreciated but not required.

Security considerations

This skill documents a pattern that hardens wallet key handling, but does not magically make your app secure. At minimum:

  • Serve the iframe from the same origin as the parent. Cross-origin iframes break the security model (and most browsers will refuse the publickey-credentials-get permission anyway).
  • Set a strict Content-Security-Policy on both the parent and iframe routes.
  • Never log or transmit the PRF output, derived private key, or ceremony extension results. Audit your logging paths.
  • Require a fresh passkey ceremony for every wallet operation. The iframe may cache the wallet in memory for a single user action, but do not persist across navigations.
  • Version your derivation label (see references/prf-derivation.md). Changing the label after users register breaks their wallets.
  • Run a security review before shipping. This is wallet-adjacent code; treat it accordingly.

Credits

Extracted from the 1Shot Payments implementation. Thanks to the W3C WebAuthn WG for the PRF extension and to the MetaMask Snap / Delegation Toolkit teams for demonstrating non-custodial patterns on the EVM.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 warning1d3 checks · Risk SAFE
  • Gen Agent Trust Hub6mo

    The skill provides a high-quality implementation guide for building non-custodial Ethereum wallets using the WebAuthn PRF extension. It follows industry security best practices, such as isolating cryptographic keys within a same-origin iframe and requiring user biometric verification for signing operations. No malicious patterns or vulnerabilities were detected.

  • Socket1d

    No alerts

  • Snyk6mo

    Risk: MEDIUM · 1 issue

Signed by skilld at 01cfb41. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last week.

Activeupdated 3 weeks ago
Other metadata
metadata
{
  "author": "1Shot-API",
  "version": "1.0.0",
  "repository": "https://github.com/1Shot-API/skills"
}

README badge

README badge for 1shot-api/skills/webauthn-prf-wallet