Skip to content

feat(stellar): add passkey smart-account wallet mode - #166

Merged
truthixify merged 5 commits into
wraith-protocol:developfrom
collinsezedike:feat/passkey-smart-account-wallet
Aug 26, 2026
Merged

feat(stellar): add passkey smart-account wallet mode#166
truthixify merged 5 commits into
wraith-protocol:developfrom
collinsezedike:feat/passkey-smart-account-wallet

Conversation

@collinsezedike

@collinsezedike collinsezedike commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #150.

  • Adds browser-side WebAuthn PRF plumbing (src/lib/stellar/passkey.ts): credential creation, re-authentication, PRF extension result parsing, and a documented session ceiling (30 min or 20 signatures, whichever comes first) on how long the derived key stays resident in memory.
  • Adds PasskeyAdapter implementing the shared StellarWallet interface, registered alongside Freighter/Albedo/xBull/LOBSTR/WalletConnect in src/wallets/stellar/index.ts. First-run creates a passkey, deterministically derives a Stellar Ed25519 keypair from its PRF secret, and funds it via friendbot on testnet — no extension prompt at any point.
  • Adds a PasskeyUnsupportedCard next-step card, rendered by StellarWalletPicker in place of the generic error string when a device can't complete the PRF ceremony, pointing at passkeys.dev's device-support page.
  • Unit tests for the PRF extension result parser, base64url helpers, and the session ceiling.

Important scope correction (read this before reviewing)

The issue describes a Soroban smart account with on-chain fee sponsorship and a contract-delegated session key, authorized via an SDK export called WebAuthnPasskeyStealthSigner. I checked every version of @wraith-protocol/sdk published to npm (1.0.0 through the current latest, 1.4.5) — that export does not exist anywhere. A real smart-contract account would also need a deployed Soroban wallet contract (Rust/WASM) that doesn't exist anywhere in this repo.

Since neither the SDK export nor a deployed contract exist, this PR ships an honestly-scoped-down but fully working alternative: a classic Ed25519 Stellar account whose signing key is deterministically derived from the passkey's PRF secret via Keypair.fromRawEd25519Seed (@stellar/stellar-sdk, already a dependency — no new packages added). It satisfies "no extension prompt, funds itself on testnet, PRF-gated, session ceiling" end to end with real, working code. What it does not do is on-chain fee sponsorship or contract-delegated session keys — those need the missing smart-wallet contract and are natural follow-up work once one exists. See the scope note at the top of PasskeyAdapter.ts for the full reasoning.

Pre-existing gap found during this work

StellarWalletPicker and StellarWalletButton (the multi-wallet adapter system this issue extends) are not currently mounted anywhere in the app — Header.tsx renders WalletConnect.tsx, which uses a separate, Freighter-only StellarWalletContext that predates the adapter registry. This means Albedo, xBull, LOBSTR, and WalletConnect were already unreachable in the running app before this PR, and Passkey inherits that same gap. I scoped this PR to exactly the files the issue lists rather than also rewiring Header.tsx off the legacy context, since that touches shared wallet state consumed by Send/Receive/Vault/batch-withdraw/notifications. Flagging for a maintainer decision on whether that's a separate issue.

Acceptance criteria status

  • Wallet picker lists Passkey as a peer of Freighter / Albedo / xBull / LOBSTR (structurally — see reachability gap above)
  • First-run flow signs with no browser-extension prompt
  • PRF-absent state renders a next-step card, not a silent failure
  • Adapter compiles without @ts-nocheck; PRF assertion parser has unit tests
  • "Smart account" / fee sponsorship / contract session-key delegation — descoped, see correction above; needs a deployed Soroban wallet contract
  • Cross-browser recordings (Chrome desktop, iOS Safari, Android Chrome) — not produced in this environment; needs real devices/browsers

Test plan

  • pnpm test:unit for src/lib/stellar/passkey.test.ts
  • Manual: mount StellarWalletButton/StellarWalletPicker (or a temporary harness) to click through first-run passkey creation, friendbot funding, and a stealth send/withdraw on testnet
  • Manual: verify the PRF-unsupported card on a browser/device without PRF support
  • Manual: verify a returning session re-derives the same address and that signing after the 30 min / 20 signature ceiling re-prompts the passkey

@vercel

vercel Bot commented Aug 26, 2026

Copy link
Copy Markdown

@collinsezedike is attempting to deploy a commit to the truthixify's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Aug 26, 2026

Copy link
Copy Markdown

@collinsezedike Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@truthixify
truthixify merged commit 3a7eb3d into wraith-protocol:develop Aug 26, 2026
1 of 2 checks passed
@truthixify

Copy link
Copy Markdown
Contributor

Merged. Dedicated tests around the PRF assertion parser and a real unsupported-authenticator card rather than a silent failure. Careful piece of work @collinsezedike.

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.

Passkey smart-account wallet mode

2 participants