Montara Pass
Architecture

Data model

The tables behind the vault and the rules the database enforces.

Vault tables are created by migration 000004_create_vault. Sign-in data lives in the separate authula schema; public.users mirrors authula.users and adds the application role.

Tables

user_keys

One row per user: the key set.

ColumnNotes
user_idPrimary key, references users
kdfAlways argon2id
kdf_salt16 to 64 bytes
kdf_memory_kib, kdf_iterations, kdf_parallelismAt least 19456, 2 and 1
encrypted_vault_keyVault key wrapped by the master key, up to 512 bytes
public_keyUp to 1024 bytes
encrypted_private_keyWrapped by the vault key, up to 8192 bytes

folders

Personal and flat: a folder belongs to one user and has no parent.

ColumnNotes
iduuidv7()
user_idOwner
encrypted_nameEncrypted with the owner's vault key, up to 1024 bytes

items

The shared part of an item.

ColumnNotes
iduuidv7()
owner_idDeleting the owner deletes the item for everyone
typelogin, secure_note, card or identity; the clients create the first two
cipher_versionFormat of encrypted_data, currently 1
encrypted_dataUp to 65536 bytes
revisionIncremented on every write
deleted_atSet while the item is in the trash

item_members

Who can open an item, the owner included, and each member's own view of it.

ColumnNotes
item_id, user_idPrimary key
roleowner, editor or viewer
encrypted_item_keyThe item key wrapped for this member, up to 1024 bytes
folder_idThis member's folder for the item, or null
favoriteThis member's favorite flag
last_used_atWhen this member last filled the item into a page, or null. Added by 000005
shared_byWho shared it; null on the owner's row

Rules the database enforces

  • One owner per item: a partial unique index on item_members (item_id) where role = 'owner'.
  • No filing in someone else's folder: (folder_id, user_id) is a composite foreign key to folders (id, user_id).
  • Deleting a folder keeps its items: that foreign key is ON DELETE SET NULL (folder_id), so the items become unfiled.
  • Size limits: every encrypted column has a CHECK on its length, matched by the validation in internal/dtos/vault.go.

Trash

Moving an item to the trash sets deleted_at and hides it from every member. Only the owner can trash, restore or permanently delete an item.

On this page