> For the complete documentation index, see [llms.txt](https://shinkalabs.gitbook.io/hub/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://shinkalabs.gitbook.io/hub/andromeda/getting-started/recovery.md).

# Recovery flow

This is the gas-sponsored, challenge-based pattern in its simplest form: primary recovery. The user signs a 32-byte challenge with the wallet's primary owner credential; Andromeda assembles, signs as gas sponsor, and submits the Solana transaction.

{% hint style="info" %}
Recovery is opt-in per deployment. Check [`/capabilities`](https://api.andromedainfra.pro/capabilities). Exact paths and bodies are in the [OpenAPI spec](https://api.andromedainfra.pro/openapi.json).
{% endhint %}

## Step 1: request a challenge

```bash
curl -X POST https://api.andromedainfra.pro/v1/recovery/primary/challenge \
  -H "X-Api-Key: $ANDROMEDA_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "dwalletAddress": "<DWALLET>",
    "messageHashHex": "<32-BYTE-HEX>"
  }'
# returns { "challengeBase64": "...", "expectedNonce": 7, "primaryScheme": "Ed25519" }
```

## Step 2: the user signs the challenge off-chain

The user signs `challengeBase64` (32 bytes) with whatever they control: an EVM wallet, a Solana wallet, a Bitcoin cold wallet, a passkey, or an OAuth-linked identity. No Solana wallet required, no gas needed on their side.

## Step 3: submit

```bash
curl -X POST https://api.andromedainfra.pro/v1/recovery/primary/submit \
  -H "X-Api-Key: $ANDROMEDA_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "dwalletAddress": "<DWALLET>",
    "messageHashHex": "<32-BYTE-HEX>",
    "signatureBase64": "<USER_SIGNATURE>",
    "expectedNonce": 7
  }'
# returns { "txSignature": "...", "messageApprovalAddress": "..." }
```

Andromeda builds the transaction, adds a precompile instruction so the Solana runtime verifies the user's signature, pays the gas, and broadcasts it. The on-chain `rules-policy` program only proceeds if the precompile check passed; Andromeda cannot forge it.

## Beyond primary recovery

* **Quorum recovery (M-of-N)**: for wallets configured with a recovery roster. It stages member contributions in a PDA so there is no cap on quorum size. See [Run a recovery](/hub/andromeda/guides/run-recovery.md).
* **Configuring recovery**: setting the primary owner, the quorum roster, the daily limit and the cooldown. See [Configure recovery](/hub/andromeda/guides/configure-recovery.md).
* **Discovery**: proving the user owns an external wallet before adding it as a recovery owner. See [Discovery](/hub/andromeda/guides/discovery.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://shinkalabs.gitbook.io/hub/andromeda/getting-started/recovery.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
