Where Pipedash keeps provider tokens, how the vault binds to its first password, and how the stores encrypt tokens.
Pipedash keeps provider tokens in the system keyring or an encrypted database store. The selected store depends on the platform, database backend and vault password. The desktop and iOS apps pick one at startup.
Environment references supply tokens during config sync. Pipedash stores the resolved credentials in the selected token store.
Token stores
| Store | Used when | Where tokens live |
|---|---|---|
| Keyring | Desktop or mobile, SQLite backend, no vault password and no encrypted tokens | One JSON map in the system keyring, service pipedash, account tokens. On iPhone the keyring is the device Keychain. On Android it is the Android Keystore. |
| Encrypted SQLite | SQLite backend with a vault password | Columns providers.encrypted_token and providers.token_nonce |
| Encrypted PostgreSQL | PostgreSQL backend | Table encrypted_tokens with provider_id, nonce, ciphertext, created_at and updated_at |
PIPEDASH_TOKEN_<provider_id> has no effect today, and token references cover that need. The Configuration page covers it.
Desktop selection
At startup the desktop app checks 3 facts: the backend, whether PIPEDASH_VAULT_PASSWORD has a value, and whether pipedash.db already holds encrypted tokens. It applies the first matching row.
| Order | Condition | Result |
|---|---|---|
| 1 | SQLite, no password, no encrypted tokens | Keyring store |
| 2 | SQLite with encrypted tokens and no password, or PostgreSQL with no password | Locked vault |
| 3 | SQLite with a password | Encrypted SQLite store with the keyring as fallback |
| 4 | Anything else, which means PostgreSQL with a password | Encrypted PostgreSQL store |
The server never uses the keyring. For SQLite it requires the password, and for PostgreSQL it uses the encrypted store.
iPhone default
The iPhone app uses the same rules, and a new install lands in row 1. It stores data in SQLite inside the app container and keeps provider tokens in the device Keychain. The setup wizard shows "Database: SQLite" and "Provider tokens: Device Keychain", and it asks for no vault password.
Android default
The Android app follows the same rules as the iPhone app. Provider tokens go to the Android Keystore through android-native-keyring-store, and the setup wizard shows "Provider tokens: Android Keystore". The Keystore key never leaves the device, and the app excludes its data from cloud backup and device transfer, so copied app data cannot be decrypted elsewhere.
Keyring fallback migration
In row 3 the encrypted SQLite store is primary and the keyring is the fallback. Tokens move from the keyring to the database as Pipedash reads them.
- Read: the store asks the encrypted store first. On a miss it reads the keyring, copies the token to the encrypted store and then deletes the keyring entry.
- Write: the store writes to the encrypted store and deletes any keyring copy.
- Delete: the store deletes from both.
If the copy fails, Pipedash returns the token anyway and retries on the next read.
Vault password binding
The first password that opens an encrypted vault stays bound to it. Pipedash stores a verifier in the table vault_verifier, which exists in SQLite and in PostgreSQL. The verifier is a known value that the store encrypts with the key derived from the first password.
- Later opens: a different password fails to decrypt the verifier, and the store answers
Wrong vault password. - Empty vault: the binding holds before the first provider exists.
- Factory reset: a reset deletes providers and tokens and leaves the verifier in place, so the first password still applies.
- No password on PostgreSQL: a random key replaces the password and Pipedash stores no verifier.
Vault locking and opening
A vault stays locked while Pipedash needs a password and has none. Locked behavior differs by platform.
- Desktop: the app starts with a locked vault and no providers. It waits to load tokens and start the background tasks, including the refresh loop, until the vault opens.
- Web server: an existing configuration can start with a locked vault when the password is missing, and token loading waits for the vault to open. First-run setup requires a matching password of at least 8 characters unless
PIPEDASH_VAULT_PASSWORDis set.
The /unlock page is public. When the vault needs a password and is locked, the UI redirects every other page to /unlock. A browser session also needs the bearer token that a successful open stores. Settings, then Storage, shows a Lock vault button while a password-protected vault is open.
| Action | Web route |
|---|---|
| State | GET /api/v1/vault/status |
| Open | POST /api/v1/vault/unlock with { "password": "..." } |
| Lock | POST /api/v1/vault/lock |
| Variable status | GET /api/v1/storage/vault-password-status |
Opening the vault on desktop sets PIPEDASH_VAULT_PASSWORD for the process and checks the password by decrypting every token. A wrong password returns Invalid password. On success the app loads the providers, starts the background tasks, and the UI refetches providers and pipelines. With a SQLite backend that holds no encrypted tokens, it only stores the password for a later migration.
Locking returns Vault locked. It clears the session's PIPEDASH_VAULT_PASSWORD, removes the active core and stops its background tasks. The web server also clears pending log-download tickets. Opening the vault creates a new core and loads the providers again. A restart is not required for locking to take effect.
The web server keeps its API bearer token after locking. Protected requests still need that token.
App lock on iPhone
The iPhone app can ask for Face ID, Touch ID or the device passcode before it shows pipelines and tokens. The Android app asks for fingerprint, face unlock or the screen lock. The Mobile page covers the setting. When the vault needs a password, turning app lock on saves that password in the device Keychain on iPhone and in the Android Keystore on Android. A successful prompt then opens the vault with it.
The password has two jobs
PIPEDASH_VAULT_PASSWORD derives the encryption key, and the web server also uses it as the API bearer token.
- Encryption: the encrypted stores derive their AES key from it.
storage.vault_passwordinconfig.tomltakes priority over the variable. - API access: protected
/api/v1/routes acceptAuthorization: Bearer <password>for the operator or a paired-device bearer token. A paired-device token cannot change host-managed setup, storage, vault or push settings. The server compares the operator token in constant time and answers401on a mismatch.
The bearer check skips paths outside /api/v1/, health and setup routes, /api/v1/vault/status, /api/v1/ws and /api/v1/plugins. It also skips GET /api/v1/downloads/<ticket>. A download ticket expires after 60 seconds and can be used once.
The WebSocket uses an authentication message instead of an HTTP bearer header: { "type": "auth", "token": "..." } as its first message when the server holds an API token. The REST API page covers authentication and paired devices.
The server keeps the API token in memory and not in the variable.
- Start: the server copies
PIPEDASH_VAULT_PASSWORDinto the token when the variable has a value. - Open:
POST /api/v1/vault/unlocksets the token to the password of a successful request. A failed attempt leaves it unchanged. - Setup and migration: a first setup with a vault password sets the token when none exists. A migration with a token password sets it.
- Lock:
POST /api/v1/vault/lockleaves the token in place, so protected routes keep requiring the bearer token.
POST /api/v1/vault/lock and POST /api/v1/vault/unlock need the bearer token whenever the server holds one. The REST API page covers the routes.
Encryption
Both encrypted stores use AES-256-GCM with a 32-byte key and a random 12-byte nonce per token. Each store derives its key with Argon2id version 0x13.
| Use | Memory | Passes | Parallelism |
|---|---|---|---|
| SQLite token key | 65536 KiB | 3 | 1 |
| PostgreSQL token key | 4096 KiB | 1 | 1 |
| SQLite export key | 65536 KiB | 3 | 1 |
| PostgreSQL export key | 4096 KiB | 1 | 1 |
| Keyring export key | 4096 KiB | 1 | 1 |
The export keys protect the token blob that a storage migration moves between stores. The Setup wizard page covers it.
The PostgreSQL store with no password generates a random 64 character password and does not save it. Tokens it writes cannot be read after a restart. The SQLite store refuses to start without a password.