Cavos

Hardware-isolated recovery

Restore a Starknet, Solana, or Stellar MasterDEK by signing in again. Verified inside an attested Nitro enclave. Cavos never holds a key that can spend.

A stored backup secret asks the user to keep it safe forever, and most will not. Hardware-isolated recovery lets them recover the embedded wallet (embedded wallets, embedded wallet SDK) the way they expect to: by signing in again with Google, Apple, GitHub, Telegram, or an email code.

The obvious way to build that would be for Cavos to hold a key and hand it over once a login checks out. That would make Cavos custodial and every Cavos employee a target. Instead the check runs inside an AWS Nitro Enclave, an isolated environment whose exact software is measured by hardware and attested by AWS, holding a sealed copy of the wallet's MasterDEK that it re-encrypts only to a device of the enrolled identity. The MasterDEK is opened only inside the attested enclave and leaves it only encrypted to the device's key; account keys are derived and used to sign only on the user's device.

Availability. Hardware-isolated recovery is opt-in per environment and off by default. Turn it on in Dashboard → App → Environments before socialRecovery: true or deviceApproval: "enclave" can resolve. Every other recovery path in Recovery works without it.

Call this hardware-isolated, non-custodial recovery, never trustless recovery. No Cavos employee holds a key that can move funds, but the measured enclave, AWS's attestation and KMS, and the approved image-upgrade policy all remain inside the trust model. Section Why this is still self-custodial is explicit about both halves.

One model on every chain. On Starknet, Solana, and Stellar the enclave seals and unwraps the MasterDEK. It does not sign transfers. Set deviceApproval: "enclave" (or socialRecovery: true). Passkey approval is a different, single-chain path.

How it works

The feature has two moments: enrolment, once, on a device the user already controls, and recovery, later, on a device that has nothing.

Enrolment

  1. The user signs in. Before redirecting, the SDK creates a login key: a non-extractable ECDH P-256 key pair held in the vault iframe's IndexedDB on web (in the page's IndexedDB when vault: false), out of reach of scripts on the page. Only the hash of its public key goes into the sign-in request. The provider's id_token comes back carrying that hash, stays in memory only, and is never persisted or logged by the SDK.
  2. The SDK asks for the enclave's attestation document: a statement signed by the AWS Nitro Attestation PKI describing exactly which image is running. It verifies the signature against the AWS root certificate pinned in the SDK, checks the measurement against the ones this release accepts, and aborts if anything differs.
  3. Satisfied, the browser encrypts the job, which carries the token, directly to an ephemeral key belonging to that enclave, using the login key. The key is read from inside the signed document rather than from the response that carried it, so there is nothing to cross-check: substituting a key would mean forging an AWS signature. The Cavos control plane relays ciphertext it cannot read. The enclave's answer comes back sealed to the same session, so the control plane cannot rewrite it either.
  4. Inside, the enclave verifies the token and seals the MasterDEK (dek_enroll) so a later device can unwrap it. There is no extra on-chain recovery authority: the wrap is the restore path. Reconnect reseals if this device already has the DEK locally, so a first enroll that failed after claiming the address still recovers. From 0.2.2 that reseal runs in the background: the wallet is ready before it finishes, and a reseal that fails is logged, never a failed login.

Recovery

The user signs in on the new device and the same channel is established. The enclave verifies the token and unwraps the MasterDEK to this device's wrap key. The device then derives the same account key (Ed25519 on Solana and Stellar, a stark key on Starknet). Recovery completes immediately: there is no waiting period, and no on-chain transaction.

The result is worth stating plainly: an attacker who fully compromises the Cavos backend gets ciphertext they cannot decrypt. Recovering a wallet also needs a fresh sign-in the enclave accepts for the enrolled identity.

What the enclave verifies

Inside, before it opens anything, the enclave checks the provider signature, issuer, audience, token fingerprint, configured provider, and the enrolled subject: the recovery only proceeds for the identity that enrolled.

The authentication must be no more than five minutes old. Every token must carry an OIDC nonce of the form <app id>.<BASE64URL(SHA-256(login public key))>, where the login public key is the 65-byte uncompressed SEC1 point and base64url has no padding. The enclave checks that the nonce commits to the app the wallet belongs to and to the key that encrypted the job, comparing in constant time. A token is therefore only accepted for the app it was issued for, and only on the channel of the device that started that sign-in: the same construction as PKCE's S256 challenge (RFC 7636), applied to the OIDC nonce. A stolen token or page state is unusable without the login key. The SDK makes the same comparison before it uses a login at all.

What binds a token to this session is its SHA-256 fingerprint, committed when the session opens and compared in constant time. The API stores only a second hash of that fingerprint, so a token can be used once and replays are rejected. Email uses the enclave's own signed token (issuer https://enclave.cavos.xyz), issued after the user enters the emailed code. The code is bound to the login key that requested it. GitHub is the same shape with a different issuer: the enclave redeems the authorization code with the client's PKCE verifier and signs an ES256 token (iss https://enclave.cavos.xyz/github, aud cavos-github, keys at https://enclave.cavos.xyz/.well-known/jwks.json). The subject is hex(SHA-256("cavos-github-subject-v1:" + client_id + ":" + github_id)), so identity is per OAuth app (see Authentication → GitHub). Telegram follows the same pattern with its own issuer: the enclave redeems the code, verifies Telegram's id_token, and signs an ES256 token (iss https://enclave.cavos.xyz/telegram, aud cavos-telegram). The subject is hex(SHA-256("cavos-telegram-subject-v1:" + bot_id + ":" + telegram_user_id)), so identity is per bot (see Authentication → Telegram). Cavos-signed compatibility tokens are never accepted.

What the enclave holds

The enclave's authority is not "a key that can sign for the wallet". It holds a sealed wrap of the MasterDEK and re-encrypts it, only for the enrolled identity, to the requesting device's key.

ChainWhat the enclave does
StarknetSeals / unwraps the MasterDEK. The stark key is grindKey(HKDF(DEK, appSalt, "cavos-stark-starknet-v1")). The account is the standard OpenZeppelin AccountUpgradeable; no on-chain recovery role.
SolanaSeals / unwraps the MasterDEK. The spend key is HKDF of that DEK. No recovery PDA, no add_signer.
StellarSame MasterDEK wrap as Solana (cavos-ed25519-stellar-v1). A new device unwraps the DEK and gets the same G….

The SDK never persists the social token.

Why this is still self-custodial

"Someone else can restore my wallet" sounds like the opposite of self-custody, so it is worth being precise about what the enclave can and cannot do. Three things hold, and each is enforced by something other than a Cavos promise.

Nobody can read the recovery key, not even the people who run it. The private half is sealed under a key AWS KMS releases only to an enclave whose measured image matches the one that sealed it, and that rule is final: no one, Cavos's AWS administrators included, can change it (see One sealing key per release). There is no console, no debugger, no support tool that reveals it: an enclave started in debug mode reports zeroed measurements, which no pinned policy accepts, and KMS refuses to release the key to it. A Cavos employee asked to hand over a user's key has nothing to hand over.

The enclave is not a spender. It holds a wrap of the MasterDEK, not a hot signing key. Compromise of the wrap would still mean restore of the account key, which is why attestation pins and the 5-minute token window exist. Compare that with a custodial provider, where the operator's key is the spending key.

Nothing is added on-chain. Enroll is a wrap, not an extra on-chain authority.

Put together: the account key stays derived from a DEK the user's devices hold, the enclave keeps a sealed copy under a narrow policy, and the Cavos control plane only relays ciphertext it cannot read. That is what makes this self-custodial: not the fact that a TEE is involved.

What you are still trusting

Self-custodial is not the same as trustless, and the difference is not a formality:

  • The measured enclave image. You are trusting that this specific code does what it claims. Pin the digest, or accept only releases signed by the workflow below, and review changes the way you would review a key rotation.
  • AWS. Attestation and KMS are what make the measurement meaningful and the sealed key openable. Each release's KMS key policy is final, so a Cavos AWS administrator cannot widen it. What is left is AWS itself, including an AWS Support case on the account, which is the documented way back into a key whose policy locks everyone out.
  • The image-upgrade policy. A new digest is a new trust decision unless your installed policy includes release and the new image was signed by that policy's workflow on a vN tag. You are then trusting that GitHub Actions workflow, on that repository, on a GitHub-hosted runner, not cavos.xyz. On cavos-labs/cavos-recovery, the Release workflow runs in the release environment with required reviewers.
  • The sign-in. Recovery follows whoever completes a fresh sign-in as the enrolled identity. That means the identity provider, and the service that runs the sign-in flow: Cavos, when you use Cavos-hosted Google, Apple, GitHub, Telegram, or email login.

In short, recovery is as strong as the measured enclave image and the sign-in behind it. Nobody, Cavos included, can take a sealed key out of the enclave or use one without a sign-in the enclave accepts.

Keep a second factor regardless. Encourage a passkey or a second device, and treat social recovery as one path among several rather than the only one.

One sealing key per release

Since 20 November 2026 each enclave release seals under a KMS key of its own, and that key's policy is sealed to the release's image:

  • Only an enclave measuring to that release's PCR0 can decrypt with it.
  • Nobody can write the policy, create a grant, or encrypt with the key. That includes the root user of the AWS account that owns it.
  • The key can still be disabled or scheduled for deletion. That stops the release and reveals nothing.

Before this, an administrator of the Cavos AWS account could rewrite the key policy and obtain the root sealing key. Alerts made that loud; they did not prevent it. The key of release v4 was sealed on 20 November 2026. The Terraform that defines a sealed key and the script that checks one are public in cavos-recovery/infra. The live policy can only be read from inside the AWS account.

Nothing is migrated between releases

No step moves a key to another image, so a recovery record can only be opened by the release that sealed it. When a new release ships:

  • A device that still has the wallet seals it again with the new release at the user's next sign-in. There is nothing to do in your app.
  • A user who lost their device before that recovers through the release that sealed their record. Cavos keeps earlier releases available for that. Google and Apple users see no difference.
  • Email, GitHub and Telegram users in that case sign in twice. Those tokens are signed by the enclave with a key of its release, so the first connect fails with SIGN_IN_AGAIN_TO_RECOVER, and the next sign-in within the hour runs on the release that holds the record. This needs @cavos/kit 0.6.1. See Troubleshooting.

An earlier release can only recover while its signed release is still valid: 365 days from its build. A user who signs in once in that time is moved to the newer release. One who does not, and then loses every device, can no longer recover through the enclave, so keep a second factor such as a passkey.

Turning it on

Enable it in Dashboard → App → Environments. Google, Apple, email, GitHub, and Telegram are all accepted; each wallet recovers through the provider its owner signed in with. GitHub is live and tested in production, optional, web only, and not recommended over Google, Apple, or email. See Authentication → GitHub. Telegram (kit 0.5.2) is live and tested in production, optional, and web only. See Authentication → Telegram and Telegram account security.

app/provider.tsx
<CavosProvider
  config={{
    appId,
    environment: "production",
    chains: ["starknet", "solana", "stellar"], // one MasterDEK wrap for all
    defaultChain: "solana",
    network: "mainnet",
    appSalt: "my-app",
    paymasterApiKey,               // for Starknet gasless
    socialRecovery: true,
  }}
  modal={{ appName: "My App" }}
>
  {children}
</CavosProvider>

That is the whole integration. <CavosProvider> enrolls after a fresh login when this device has the DEK (the reseal runs in the background) and unwraps on a device that does not. A 409 not_enrolled on a new phone means the creating device never sealed: open that wallet once more on the original device.

The attestation pin

socialRecovery: true uses DEFAULT_SOCIAL_RECOVERY_ATTESTATION from the package you installed. Those values answer "which code am I trusting with my users' recovery?", and they must not come from the service being checked. If cavos.xyz told the client which image to expect, anyone who compromised cavos.xyz would answer with their own, and the attestation would prove nothing.

From @cavos/kit 0.6.0 the default policy pins no image. The only default path is a signed release: the SDK fetches {backendUrl}/api/enclave/releases/{pcr0} (default host https://cavos.xyz) and verifies a Sigstore v0.3 bundle in the client: Rekor inclusion, the public-good trusted root (one TUF refresh on failure, then fail closed), signer identity, PCR0/PCR1/PCR2 equal to the live Nitro attestation, version >= minVersion, and an unexpired expiresAt. An all-zero PCR0 (debug mode) is rejected.

The Cavos API is an untrusted pass-through. It can withhold a bundle; it cannot make the SDK accept one. A new enclave deploy therefore does not require an SDK bump, as long as the release was signed by the workflow below. Kits below 0.6.0 no longer work against the production enclave for email, GitHub and Telegram sign-in and enclave recovery, because the wire protocol changed. Upgrade with npm install @cavos/kit@^0.6.1.

The default release policy shipped in 0.6.0:

FieldValue
repositorycavos-labs/cavos-recovery
repositoryId1333734222
ownerId216094156
workflow.github/workflows/release.yml
environmentrelease
minVersion3

A release is trusted when GitHub Actions, on a GitHub-hosted runner, signed it for that repository and owner, using that workflow as both build config and build signer, on a refs/tags/vN push (N a positive integer that matches the statement's version), and the signing certificate carries the deployment environment release. The signature is public in Rekor. Releases before v3 are refused.

On cavos-labs/cavos-recovery, the Release workflow refuses tags whose commit is not on main. The release environment only deploys from v* tags and waits for a required reviewer, and repository rulesets restrict who can create a v* tag and forbid moving or deleting one. Releases are immutable. So pushing a tag does not publish a release on its own. The browser library that checks the bundle (@freedomofpress/sigstore-browser 0.1.15) has not received an independent security audit.

Release v4

The current production enclave is release v4 (version 4, expires 2027-11-19). Kits from 0.6.0 on accept it through the signed-release path.

MeasurementValue
PCR0466a4cbe5089af98486b1ce1953cc5acf98c40d22d9c8fb24049ca364c67cbc277c7b94263fc962e346f72627d1a51ab
PCR13b4a7e1b5f13c5a1000b3ed32ef8995ee13e9876329f9bc72650b918329ef9cf4e2e4d1e1e37375dab0ba56ba0974d03
PCR26b2c28394a49db055c0109c6d9035751a2230347a775c939d8695179d51e7e7669afc54590f4d5b3a65b2308afd2c7da

Kits below 0.6.0 do not work against release v4. Verify these values against the release's measurements.json, as described below.

The AWS signature on the attestation document still anchors authenticity outside Cavos. The policy only fixes which workload you are willing to talk to.

Strict pinning

Pass only pcr0 when you run your own enclave, or when you want the SDK to refuse any image you did not list. A policy with only pcr0 pins strictly: it has no Sigstore fallback. The default policy has no pcr0 list.

TypeScript
socialRecovery: {
  pcr0: ["<pcr0 from the release you audited>"], // list to overlap a rollout
}

pcr0 is the SHA-384 measurement of the enclave image, the value nitro-cli build-enclave reports. A list lets a redeploy overlap; the attested measurement must still match one entry exactly. An empty list accepts nothing.

The config key is socialRecovery (boolean, or this policy object). socialRecoveryAttestation is the older name for an explicit policy: it still works and takes precedence over socialRecovery, so an app that pinned its own measurements is never silently repointed onto the shipped defaults.

How to verify a published measurement

Do not copy hashes out of older docs. Each signed release publishes three assets: enclave.eif (the image), measurements.json, and enclave-<pcr0>.sigstore.json (the bundle the SDK verifies). measurements.json is the output of nitro-cli build-enclave. For release v4 it is:

measurements.json (v4)
{
  "Measurements": {
    "HashAlgorithm": "Sha384 { ... }",
    "PCR0": "466a4cbe5089af98486b1ce1953cc5acf98c40d22d9c8fb24049ca364c67cbc277c7b94263fc962e346f72627d1a51ab",
    "PCR1": "3b4a7e1b5f13c5a1000b3ed32ef8995ee13e9876329f9bc72650b918329ef9cf4e2e4d1e1e37375dab0ba56ba0974d03",
    "PCR2": "6b2c28394a49db055c0109c6d9035751a2230347a775c939d8695179d51e7e7669afc54590f4d5b3a65b2308afd2c7da"
  }
}

PCR0 measures the whole image, PCR1 the kernel and boot ramdisk, and PCR2 the application. The SDK requires all three to equal the live attestation. To check a release yourself:

Terminal
gh release download v4 -R cavos-labs/cavos-recovery -p measurements.json
jq -r '.Measurements.PCR0' measurements.json

The enclave build is reproducible. Rebuild the tagged source and compare the PCR0 it reports with the one above:

Terminal
git clone --branch v4 https://github.com/cavos-labs/cavos-recovery
cd cavos-recovery/enclave
./scripts/build-enclave.sh

Two independent builds of the same source produce the same PCR0. If they did not, a published measurement would prove nothing about the published code.

Content-Security-Policy

A strict connect-src must allow:

  • {backendUrl}/api/enclave/releases/* (hosted default https://cavos.xyz)
  • the Sigstore TUF CDN, https://tuf-repo-cdn.sigstore.dev/, used if the bundled trusted root needs a refresh

The hosted vault already uses connect-src 'self' https:.

Telegram account security

Per Telegram's FAQ, a Telegram account is reachable with an SMS code to its phone number unless Two-Step Verification (a cloud password) is on. Inactive Telegram accounts are deleted after 18 months by default. Recommend that users turn on Two-Step Verification and keep a second recovery method, for example a passkey. Recovery follows whoever completes a fresh sign-in as the enrolled identity, so a Telegram wallet is only as safe as that Telegram account.

With your own auth

Social recovery works when you authenticate users yourself (Clerk, Auth0, Firebase, your own backend), as long as a real Google or Apple sign-in happens somewhere underneath. Your users never sign in twice: you pass the provider token your login already obtained. Works on Starknet, Solana, and Stellar. GitHub is not on this path: the enclave redeems the GitHub authorization code itself and issues its own token, so recovery for a GitHub user requires the Cavos-hosted GitHub flow (getGitHubOAuthUrl / login('github')), not a token from Clerk or Auth0. You can still bring your own GitHub OAuth app per environment so the consent screen shows your app: see Authentication → GitHub. Telegram is the same: a Telegram user recovers by signing in with Telegram again through the Cavos-hosted flow (getTelegramOAuthUrl / login('telegram')), not with a token from Clerk or Auth0. You can bring your own Telegram bot per environment: see Authentication → Telegram.

Not available for Google and Apple (since 0.2.6). The enclave requires the nonce described in What the enclave verifies, which commits to a login key and only a sign-in started by the SDK carries. A token obtained by your own login does not, so submitSocialRecoveryToken is rejected for Google and Apple until the SDK exposes the nonce for you to pass to your provider. Use Cavos-hosted sign-in for enclave recovery in the meantime. The rest of this section describes the intended flow.

Register your OAuth client ID once in Dashboard → App → Environments (the Google client ID or Apple client ID field). The enclave then accepts tokens minted for your client instead of only Cavos's.

app/secure-account.tsx
const { submitSocialRecoveryToken } = useCavos();

// Enrols when this device is ready and recovers when it is not; the wallet's
// state decides, so the same call serves both screens.
async function secureAccount() {
  const idToken = await getGoogleIdTokenFromYourAuth();
  await submitSocialRecoveryToken(idToken);
}

Two requirements, both easy to miss:

  • Pass the provider's raw id_token, not your own session JWT. The token has to be verifiable against Google's or Apple's keys, and your session token is signed by you. Passing the wrong one fails immediately with a message saying so. Clerk, Auth0 and Firebase all expose the underlying token, usually behind an explicit call.
  • Pass a fresh one. The enclave requires the authentication to be under five minutes old. This falls out naturally (enrolment follows a login, recovery happens as the user signs in on the new device), but a token cached from an earlier session is rejected.

Changing the registered client ID never affects wallets already enrolled. The enclave enforces the policy sealed at enrolment, so the setting only applies to enrolments made after it changes.

The email provider has no per-app client ID: its tokens are issued by the enclave itself. The dashboard's email "Firebase project ID" field no longer affects email sign-in codes.

How long it takes

There is nothing to call and nothing to warm up. The enclave is a long-lived service, so enrolment and recovery are two synchronous requests.

In practice the enclave accounts for 1–2 seconds. Nothing is submitted on-chain.

Earlier releases ran this on Google Confidential Space, which booted a confidential VM per session. That cost 49–134 seconds of boot for the same ~2 seconds of work, and failed outright when a zone had no capacity. If you are reading older integration notes that mention prewarming, prewarm(), or a warm pool, they describe that design; none of it exists now.

On this page