DOCS / KEYS & NAMESPACES
Choose stable key identities for each purpose.
A source controls a namespace. The namespace, destination and numeric path select a stable threshold key for one application purpose.
What selects a key?
PairKey derives public keys lazily. No complete private key is assembled, stored in the browser or placed in a PDA. Think of the key identity as:
source identity
+ PairKey deployment
+ namespace
+ destination and signature scheme
+ numeric path
= stable destination key
The source identity depends on how the user or application authenticates:
| Source | Stable identity | Short-lived authorization |
|---|---|---|
| Account | Solana wallet public key | The wallet signs each exact approval directly. |
| Program | Program ID, controller PDA and authenticated application accounts | The program evaluates or commits each exact approval. |
| Passkey | P-256 credential public key, RP ID and HTTPS origin | A fresh passkey-bound Ed25519 key signs each exact approval. |
| OIDC/OAuth | Issuer, audience and subject | A fresh token-bound Ed25519 key signs each exact approval. |
Use namespaces for purposes
A namespace is a case-sensitive NFC string that maps to a stable 32-byte ID. Use it as a business and policy boundary. Prefer stable, non-secret identifiers; avoid email addresses, display names and other values that may change.
org/acme/treasury/solana
org/acme/treasury/evm
org/acme/payroll
customer/01J9Z.../wallet
bot/market-maker/strategy
Create another namespace when ownership, policy, recovery or operational risk should be independent. For the example program, policyScope: 'namespace' gives each namespace its own policy PDA and revision. Use shared scope only when every namespace under the controller should intentionally share one policy.
Use paths for subaccounts
A numeric path selects a subaccount inside the same namespace and policy domain. Keep a documented mapping rather than assigning paths ad hoc.
| Purpose | Namespace | Path |
|---|---|---|
| Operating treasury | org/acme/treasury/solana | [0] |
| Treasury reserve | org/acme/treasury/solana | [1] |
| Payroll primary | org/acme/payroll | [0] |
| Trading strategy 3 | bot/market-maker | [3] |
Paths separate derived keys but do not create an independent authority or policy boundary. Use a namespace when that distinction matters.
What changes the address?
| Change | New key? | Reason |
|---|---|---|
| Policy revision or limits | No | Policy governs use of an existing key. |
| Program approval mode | No | Onchain and Offchain modes authorize the same program identity. |
| Numeric path | Yes | The path selects another key within the namespace. |
| Destination chain or suite | Yes | Destination context is part of derivation. |
| Namespace label | Yes | The label maps to a different namespace ID. |
| Source identity | Yes | A different wallet, program, credential or OIDC/OAuth subject controls another family. |
| PairKey deployment | Yes | The deployment and signer context are part of the namespace. |
Derive keys for one purpose
await pairkey.connect({
source: 'account', wallet,
namespace: 'org/acme/treasury/solana'
});
const operating = await pairkey.key({chain: 'solana', path: [0]});
const reserve = await pairkey.key({chain: 'solana', path: [1]});
The same key, signMessage, signTransaction, signAndSend and recovery methods work after connecting with any authority source. Only the exact-request authentication step changes.
Keep a recovery map
Retain the deployment configuration, source identity, exact namespace label, destination and numeric path for every funded key. Also retain application recovery for the source: wallet recovery for accounts, governance access for programs, credential recovery for passkeys, or continued access to the same OIDC issuer, audience and subject. Ephemeral passkey and OIDC/OAuth authorization keys do not need recovery and do not determine the destination address.