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:

SourceStable identityShort-lived authorization
AccountSolana wallet public keyThe wallet signs each exact approval directly.
ProgramProgram ID, controller PDA and authenticated application accountsThe program evaluates or commits each exact approval.
PasskeyP-256 credential public key, RP ID and HTTPS originA fresh passkey-bound Ed25519 key signs each exact approval.
OIDC/OAuthIssuer, audience and subjectA 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.

PurposeNamespacePath
Operating treasuryorg/acme/treasury/solana[0]
Treasury reserveorg/acme/treasury/solana[1]
Payroll primaryorg/acme/payroll[0]
Trading strategy 3bot/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?

ChangeNew key?Reason
Policy revision or limitsNoPolicy governs use of an existing key.
Program approval modeNoOnchain and Offchain modes authorize the same program identity.
Numeric pathYesThe path selects another key within the namespace.
Destination chain or suiteYesDestination context is part of derivation.
Namespace labelYesThe label maps to a different namespace ID.
Source identityYesA different wallet, program, credential or OIDC/OAuth subject controls another family.
PairKey deploymentYesThe 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.