Authentication
ID Wispera supports multiple vault authentication modes. All ultimately derive the same AES-256-GCM encryption key — they differ only in how the passphrase is resolved.Passphrase Resolution Chain
The passphrase is resolved through a 4-step priority chain. The first successful method wins:PassphraseSource values
Each SDK returns aPassphraseResult with a source field indicating how the passphrase was resolved:
| Source | Meaning |
|---|---|
session-token | Resolved from IDW_SESSION_TOKEN via sidecar file |
keychain | Retrieved from OS keychain |
env-var | Read from IDW_PASSPHRASE process environment variable |
dotenv-file | Read from a .env file ($CWD/.env or ~/.id-wispera/.env) |
interactive | User entered via TTY prompt |
Authentication Modes
Session Token Mode (CI / Headless)
For CI pipelines and headless environments where a keychain is unavailable. Session tokens wrap the passphrase using Scrypt + AES-256-GCM and are stored in a sidecar file (~/.id-wispera/sessions.json).
Session tokens provide headless vault access without storing the passphrase in plaintext.
A token is generated via idw auth token create, which encrypts your vault passphrase
with a key derived from the token itself (Scrypt + AES-256-GCM). The encrypted passphrase
is stored in a sidecar file (~/.id-wispera/sessions.json). At runtime, the token is used
to decrypt the passphrase in memory — the passphrase is never written to disk or environment.
Create a session token:
24h, 7d, 30d.
Use the token in CI:
The passphrase is always the root recovery path. The session token sidecar (
sessions.json) is a convenience layer, never a dependency. If you lose all session tokens, the passphrase still unlocks the vault.Session Token Sidecar Format
The~/.id-wispera/sessions.json file uses a cross-SDK compatible schema:
| Field | Format |
|---|---|
| Token hash | Hex-encoded SHA-256 |
| Salt | Hex-encoded |
| IV | Hex-encoded |
| Encrypted passphrase | Base64url |
| Created / Expires | ISO 8601 |
| Label | Free-text string |
Keychain Mode (Default for Local Development)
The recommended mode for interactive local development. The passphrase is stored in and resolved from the OS keychain:IDW_PASSPHRASE (Environment Variable and .env File)
IDW_PASSPHRASE is a fully supported authentication method. If the IDW_PASSPHRASE environment variable is set, its value is used directly. Otherwise the provider checks $CWD/.env and then ~/.id-wispera/.env for the key.
This mode is useful for local development in environments without an OS keychain (containers, WSL, minimal Linux).
Environment variable:
.env file:
Only
IDW_PASSPHRASE is read from the .env file. No other variables are loaded into the process environment.- Prefer a
.envfile withchmod 600over exportingIDW_PASSPHRASEin your shell profile - The
.envfile is never loaded into the full process environment — only theIDW_PASSPHRASEvalue is extracted - For higher security, use the OS keychain (interactive) or session tokens (CI)
Interactive Prompt
If none of the above methods succeed, the CLI prompts for the passphrase via a secure TTY prompt (stdin is not echoed). This mode is disabled in headless environments (MCP server, CI).Auth Status
Check the current authentication state and how the passphrase was resolved:Admin Passports
Provider admin credentials (AWS access keys, OpenAI admin keys, etc.) are now stored as encrypted passports inside the vault instead of plaintext environment variables. Each admin passport has:- Visa type:
privilege - Tags:
admin,admin:<provider>,provisioning
Bootstrap Wizard
Theidw auth bootstrap command is an interactive wizard that collects your provider admin credentials and stores them as encrypted admin passports:
Vault-Resolved Provisioning Auth
TheprovisionAndCreatePassport() function now optionally resolves auth from the vault when the auth parameter is omitted. It looks up admin passports by matching the admin:<provider> tag:
Cross-SDK Parity
The auth module exists in all three SDKs with identical behavior:| SDK | Package | Keychain | Crypto |
|---|---|---|---|
| TypeScript | packages/core/src/auth/ | keytar (optional) | Web Crypto API (SubtleCrypto) |
| Python | packages/python/id_wispera/auth/ | keyring (optional) | cryptography library |
| Go | packages/go/pkg/auth/ | Stub (go-keyring not yet wired) | golang.org/x/crypto |
- Same 4-step resolution chain in the same order
- Same
.envfile parser (comments, quote stripping, only readsIDW_PASSPHRASE) - Same world-readable file warning format
- Same
PassphraseSourcevalues - Same
PassphraseProviderOptionsconfiguration (allowInteractive,allowEnvVar,promptFn,sidecarPath)
CLI Reference
| Command | Description |
|---|---|
idw auth login | Authenticate and store passphrase in OS keychain |
idw auth logout | Remove passphrase from keychain |
idw auth status | Show current auth state and source |
idw auth token create [--label <name>] [--expires <duration>] | Create a session token |
idw auth token list | List active session tokens |
idw auth token revoke <hash-prefix> | Revoke a session token |
idw auth bootstrap | Interactive wizard to set up admin passports |
Next Steps
Credential injection
Use
idw exec to inject vault credentials into subprocesses as environment variables.Provisioning
Programmatically create API keys using vault-stored admin credentials.
Security architecture
Encryption model, session token design, and threat model.