> ## Documentation Index
> Fetch the complete documentation index at: https://docs.openagents.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Identity & Wallet

> How Autopilot generates and uses Nostr and Spark keys.

## Overview

Autopilot uses a single BIP-39 **seed phrase** to derive both:

* a **Nostr identity** (NIP-06 keypair)
* a **Spark wallet identity** (Spark keyset)

This keeps identity and wallet recovery unified: one seed phrase restores both.

**Note:** The seed phrase and `nsec` are secrets. Treat them like a password.

## The Keys You See in Autopilot

* **Nostr public key** (`npub...`): your public Nostr identity. Safe to share.
* **Nostr secret key** (`nsec...`): private signing key for Nostr events. Never share.
* **Spark public key** (hex): public identity for your Spark wallet. Safe to share.
* **Seed phrase** (12 words): root secret that regenerates *all* of the above. Never share.

## How They Relate

* The **seed phrase is the root**.
* The **Nostr keypair** is derived via **NIP-06** from the seed phrase.
* The **Spark wallet keys** are derived from the same seed phrase using Spark's
  keyset derivation path.
* The **nsec** is only one derived key; if you have the seed phrase, you can
  re-derive the same nsec.

## Recovery Requirements

To recover **both** Nostr and Spark identities later, keep:

* the **seed phrase** (12 words)
* the **passphrase**, if one was used (optional)
* the **network** (mainnet/testnet/regtest)
* the **Spark keyset + account number** (derivation path)

If any of those change, you may derive different wallet keys.

## Default Behavior in Autopilot

* Generates a **12-word BIP-39 seed phrase**.
* Uses that seed to derive:
  * **NIP-06** Nostr keys
  * **Spark** keys with the default keyset

## CLI Equivalents

You can reproduce the same flows with the CLI:

```bash theme={null}
# Nostr: new seed + keypair
oa nostr new --words 12

# Spark: derive wallet keys from a mnemonic
oa spark derive --mnemonic "word1 ... word12" --json
```

## Security Tips

* Do not paste `nsec` or the seed phrase into chat or logs.
* Prefer a secure offline backup of the seed phrase.
* Treat any screenshot showing the seed phrase as sensitive.
