Skip to content

Let users delete their account and turn off enclave recovery - #49

Merged
adrianvrj merged 2 commits into
mainfrom
end-user-deletion
Nov 2, 2026
Merged

adrianvrj merged 2 commits into
mainfrom
end-user-deletion

Conversation

@adrianvrj

@adrianvrj adrianvrj commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds deleteAccount(), disableEnclaveRecovery() and enableEnclaveRecovery() to useCavos(), released as 0.5.1. Needs the backend in cavos-labs/cavos (/api/end-users/me/*).

  • Consent in the vault. New vault methods consent and erase. consent reads which action the server challenge names, shows a sheet the embedding page cannot draw or skip (deleting asks the user to type delete; same arming and visibility guard as transaction review), then signs Cavos Consent:\n<len>\n<challenge> with the connected chain's spend key derived from the DEK. It returns null when this browser holds no key.
  • Domain separation. signMessage already signs only Cavos Signed Message:-prefixed bytes, Stellar signs only hashes, and Starknet consent signs starknetKeccak of the text. The one raw-bytes path, signSolanaTransaction, now refuses bytes starting with the consent prefix.
  • Erase. eraseLocalAccount removes the wrap, the device unwrap key and the Solana/Stellar control keys for the user in the vault's scope. deleteAccount calls it, then logout().
  • Opt-out. enrollDek maps recovery_revoked to { kind: "opted-out" }, so the background re-seal on sign-in ends silently. A new device of an opted-out user gets "recovery by sign-in is turned off for this wallet" instead of a failed recovery.
  • enableEnclaveRecovery lifts the opt-out; the record is sealed at the next sign-in, through the existing path.
  • React Native is unchanged; it has no vault.

Test plan

  • npm test: 521 pass (new: src/account/consent.test.ts, vault consent and guard tests in host.test.ts, opt-out tests in EnclaveDekPort.test.ts and DeviceSecret.test.ts).
  • npx tsc --noEmit and npm run build clean.
  • Proofs from signConsent verified by the cavos-web verifier on all three chains (one-off cross-repo test).
  • End to end in a local app against the cavos-web branch, before merging (merging to main publishes 0.5.1).

useCavos() gains deleteAccount(), disableEnclaveRecovery() and
enableEnclaveRecovery(). Each is confirmed in a sheet the vault draws and
signed with the wallet's spend key over a challenge from the Cavos backend,
so the embedding app cannot act for the user. Deleting also removes this
browser's keys and wraps.

A user who turned recovery off is not re-enrolled on sign-in, and a new device
gets a clear error instead of a failed recovery. The vault refuses to sign a
consent message as a Solana transaction.
@adrianvrj
adrianvrj merged commit 08ff3af into main Nov 2, 2026
2 checks passed
@adrianvrj
adrianvrj deleted the end-user-deletion branch November 2, 2026 17:24
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