LOOMAL
Concepts

Vault

Encrypted credential store for agent secrets

The Vault stores third-party credentials (API keys, OAuth tokens, database passwords, etc.) that your agent needs at runtime. Credentials are encrypted at rest and only returned to an authenticated identity with the right scope.

How It Works

Store:   User adds credential → Loomal encrypts it → stores ciphertext
Retrieve: Agent calls vault.get → Loomal decrypts → returns plaintext to agent

Credentials are never stored in plaintext.

Credential Types

TypeSecret FieldsMetadata
LOGINpassworduri, username
API_KEYkeyservice, prefix
OAUTHaccessToken, refreshTokenprovider, scopes, expiresAt
TOTPsecret (base32 seed), backupCodes (string[]), usedBackupCodes (string[])issuer, account, algorithm
SSH_KEYprivateKey, passphrasepublicKey, keyType
DATABASEpassword, connectionStringengine, host, port, database
SMTPpasswordhost, port, username, encryption
AWSsecretAccessKey, sessionTokenaccessKeyId, region
CERTIFICATEprivateKeycertificate, chain, domain, expiresAt
CUSTOMany key-value pairsany key-value pairs

Each credential is stored as one encrypted JSON blob. Secret fields go in data (encrypted), non-secret fields go in metadata (plaintext, for display).

Scopes

ScopeAllows
vault:readList credentials, retrieve decrypted values
vault:writeStore, update, and delete credentials

MCP Tools

ToolScopeDescription
vault.listvault:readList all credentials (metadata only)
vault.getvault:readGet decrypted credential by name
vault.totpvault:readGenerate TOTP code from a credential
vault.totp_use_backupvault:writeAtomically consume one TOTP backup code
vault.storevault:writeStore or update a credential
vault.deletevault:writeDelete a credential

API Endpoints

MethodPathScopeDescription
GET/v0/vaultvault:readList credentials (metadata)
GET/v0/vault/:namevault:readGet decrypted credential
GET/v0/vault/:name/totpvault:readGenerate TOTP code
POST/v0/vault/:name/totp/backupvault:writeConsume one TOTP backup code
PUT/v0/vault/:namevault:writeStore/update credential
DELETE/v0/vault/:namevault:writeDelete credential

Example: Store an API Key

curl -X PUT https://api.loomal.ai/v0/vault/stripe \
  -H "Authorization: Bearer loid-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "API_KEY",
    "data": { "key": "sk_live_abc123..." },
    "metadata": { "service": "stripe", "prefix": "sk_live_...c123" }
  }'

Example: Retrieve a Credential

curl https://api.loomal.ai/v0/vault/stripe \
  -H "Authorization: Bearer loid-your-api-key"

Returns the decrypted data along with metadata.

TOTP and Backup Codes

When you enable 2FA on a service, the provider gives you a TOTP secret (base32 seed) plus a set of single-use backup/recovery codes. Both are stored together in the same credential:

{
  "type": "TOTP",
  "data": {
    "secret": "JBSWY3DPEHPK3PXP",
    "backupCodes": ["abcd-1234", "efgh-5678", "ijkl-9012"]
  },
  "metadata": { "issuer": "GitHub" }
}
  • vault.totp / GET /v0/vault/:name/totp returns the live 6-digit code plus backupCodesRemaining (a count). It does NOT return the actual codes.
  • vault.get / GET /v0/vault/:name returns the full data.backupCodes (unused) and data.usedBackupCodes (audit trail) arrays. The secret and totp fields are redacted; backup arrays are not — you need them readable to use them.
  • vault.totp_use_backup / POST /v0/vault/:name/totp/backup is the safe consumption path: it atomically pops one code off data.backupCodes, appends it to data.usedBackupCodes, and returns it. Agents should call this rather than mutating the array via vault.store to avoid races and keep the audit trail intact.

Security

  • Encrypted at rest — credentials are never stored in plaintext.
  • Authenticated encryption — ciphertext is tamper-evident.
  • Per-credential isolation — every credential is encrypted individually.
  • Scoped access — credentials are bound to the owning identity. No other identity can read them.
  • Usage trackinglastUsedAt updates on every retrieval.

On this page