Vault
Encrypted host and end-user credentials stored by Runtime.
The vault holds two scopes.
| Scope | Owner | Stores |
|---|---|---|
| Host | The Runtime process | Model provider credentials. Studio and nylorun configure can keep multiple providers and select the active one. |
| End-user | One ownerUserId | URL-bound credentials for outbound calls such as MCP. |
Secret values are encrypted with AES-256-GCM under a key-encryption key. Set
NYLORUN_VAULT_KEK to 32 bytes encoded as base64, or allow the host to create
.nylorun/vault-kek (mode 0600) on the first write. A database that already
holds vault ciphertext will not open without that key. Reads return metadata
only.
Host model vault
The first interactive nylorun dev / nylorun serve prompts for a provider
and writes it with PUT /v1/host/model. nylorun configure does the same
against a Runtime that is already listening.
If MODEL_PROVIDER, MODEL, and MODEL_PROVIDER_API_KEY are already set, the
first start seeds the vault from them and does not prompt. Existing .env
model settings and .nylorun/auth.json are imported once the same way.
After that, .env is not the live store. Change the provider with
nylorun configure or Studio Model Settings. GET /v1/host/model never
returns the secret. PUT /v1/host/model/selection switches among configured
credentials without a new secret.
See Models.
End-user vaults
Create and attach vaults from a trusted backend:
const vault = await client.createVault({
ownerUserId: authenticatedUser.id,
idempotencyKey,
});
await client.createSession({
agentId: "assistant",
ownerUserId: authenticatedUser.id,
vaultIds: [vault.id],
});A session attaches only vaults with the same ownerUserId. User vaults cannot
see or attach the host vault. Credential responses omit secret values. Creates
and rotations use idempotencyKey.
Use this scope for outbound MCP credentials. See MCP.