Skip to main content

Programmatic usage

Each SDK exposes the same core operations as a library, so you can integrate credential governance directly into your application code.
import {
  initVault,
  unlockVault,
  createPassport,
  listPassports,
  accessCredential,
  detectCredentials,
} from '@id-wispera/core';

// Initialize a new vault (first time only)
const vault = await initVault('my-secure-passphrase');

// Or unlock an existing vault
// const vault = await unlockVault('my-secure-passphrase');

// Scan text for credentials
const detections = detectCredentials('OPENAI_API_KEY=sk-proj-abc123...');
console.log(`Found ${detections.length} credential(s)`);

// Create a passport for a detected credential
const passport = await createPassport(vault, {
  name: 'OpenAI Production Key',
  agentId: 'my-agent',
  credentialType: 'api-key',
  credentialValue: 'sk-proj-abc123...',
  visaType: 'api-access',
  platforms: ['openai'],
  scope: ['chat.completions', 'embeddings'],
  humanOwner: 'you@company.com',
  tags: ['production', 'openai'],
  notes: 'Production API key for the summarization agent',
});

console.log(`Created passport: ${passport.id}`);

// List all active passports
const passports = await listPassports(vault, { status: 'active' });
for (const p of passports) {
  console.log(`${p.name} [${p.status}] - ${p.credentialType}`);
}

// Access a credential (logs the access in the audit trail)
const apiKey = await accessCredential(
  vault,
  passport.id,
  'my-agent',       // actor
  'openai',         // platform
  'chat-completion' // purpose
);

Viewing credentials

List all passports in your vault:
idw list
Filter by status, platform, or tags:
idw list --status active
idw list --platform openai
idw list --tags "source:.env"
Inspect a specific passport by ID:
idw show <id>
To reveal the actual credential value (requires vault passphrase):
idw show <id> --reveal

Audit trail

Every action in ID Wispera is logged: creation, access, modification, revocation, sharing, and delegation. View the full audit trail:
idw audit
See the Audit log page for details on compliance support, export formats, and incident response procedures.

Command reference

ActionTypeScriptPythonGo
Init vaultidw initidw-py initidw init
Scan directoryidw scan [path]idw-py scan [path]idw scan [path]
Scan systemidw scan --systemidw-py scan --systemidw scan --system
Import allidw import <path> --allidw-py import <path> --allidw import <path> --all
Import by confidenceidw import <path> --min-confidence 0.9idw-py import <path> --min-confidence 0.9idw import <path> --min-confidence 0.9
Import fileidw import <file>idw-py import <file>idw import <file>
Import OpenClawidw import --format openclaw
List passportsidw listidw-py listidw list
Show passportidw show <id>idw-py show <id>idw show <id>
Show with secretidw show <id> --revealidw-py show <id> --revealidw show <id> --reveal
Revoke passportidw revoke <id>idw-py revoke <id>idw revoke <id>
Create (stdin)echo "sk-..." | idw create --name "Key" --stdinecho "sk-..." | idw-py create --name "Key" --stdinecho "sk-..." | idw create --name "Key" --stdin
Audit logidw auditidw-py auditidw audit
Exec (inject creds)idw exec -p <ref> -- <cmd>idw-py exec -p <ref> -- <cmd>idw exec -p <ref> -- <cmd>
Auth loginidw auth loginidw-py auth loginidw auth login
Auth logoutidw auth logoutidw-py auth logoutidw auth logout
Auth statusidw auth statusidw-py auth statusidw auth status
Create session tokenidw auth token createidw-py auth token createidw auth token create
List session tokensidw auth token listidw-py auth token listidw auth token list
Revoke session tokenidw auth token revoke <hash>idw-py auth token revoke <hash>idw auth token revoke <hash>
Bootstrap admin keysidw auth bootstrapidw-py auth bootstrapidw auth bootstrap

Framework integrations

Each SDK includes integration providers that give AI agent frameworks governed credential access.
IntegrationTypeScriptPythonGo
Base ProviderWisperaCredentialProviderWisperaBaseProviderCredentialProvider
OpenAI Agents SDKYesYesYes
Google A2A ProtocolYesYesYes
SlackYesYesYes
LangChainYesYes (existing)N/A
CrewAIN/AYes (existing)N/A
All providers support in-memory credential caching, audit logging, and platform filtering. See the Framework integrations guide for full details.

Next steps

Credential injection

Use idw exec to inject vault credentials into subprocesses as environment variables.

Framework integrations

Connect AI agent frameworks to governed credentials in the vault.

Passport model

Understand the data model behind credential governance.

MCP integration

Connect ID Wispera to AI agents via the Model Context Protocol.