Introducing a new way to review your PRs.

Read the announcement

fwdai / rowel

🔑 Local-first Secrets Manager

View on GitHub

23 documents · Updated Oct 9, 2026

docs / credential-entry-models

Credential entry models and editing

Credential entries are the user-facing records in a vault. Each record has one kind-specific set of secret fields, shared filing data, and metadata that lets the vault list and manage it without opening the secret payload. The model supports web logins, secure notes, payment cards, identity documents, SSH keys, environment files, and API keys while keeping edit, archive, favorite, and restore actions consistent across kinds.

Entry kinds

The entry kind defines the purpose of a record and the fields that make it useful. The vault presents each kind through the same list and detail flow, but each kind supplies its own validation, main secret, list subtitle, and read/edit fields through the kind registry in src/…/index.ts.

KindMain purposeMain secret or protected contentImportant supporting data
LoginStore an account credential for a site or service.Password or a passkey-backed login.Website, username, email, OTP, note, and passkeys.
NoteStore protected free text.Note body.Title and optional custom fields.
CardStore payment card data.Card number.Cardholder name, expiry, CVC, PIN, and note.
IdentityStore an identity document.Document number and personal data.Document type, holder name, dates, country, nationality, authority, and note.
SSH itemStore an SSH keypair and its related data.Private key.Public key, fingerprint, passphrase, and note.
Environment entryStore a .env file as one protected file.Verbatim file body.Original file name and note.
API keyStore a token for an API.API token.Environment, base URL, scopes, expiry date, and note.

The shared title identifies the record in the list. Tags and custom fields extend the model without changing the kind-specific fields. An entry can also carry creation and update times, and a login can carry passkeys that the editor can keep or remove but cannot create or inspect as signing keys.

References: src/…/index.ts• L14-23 src/…/types.ts• L8-26 src/…/types.ts• L49-149 src/…/types.ts• L18-61

Kind-specific field behavior

Each kind has a small set of required values that makes a record usable. The editor applies the same rule as the field display, so a value that is marked required is also required at save time.

  • Logins require a title and username, plus either a password or at least one passkey. An email is optional but must be valid when present. OTP data can be added when needed.
  • Notes require a title and a non-empty note body.
  • Cards require a title, card number, CVC, and both parts of the expiry. A PIN is optional because many cards do not have one. The editor keeps the number as digits, groups it for display, and derives a card network while the number changes. A known network gets its mark; an unknown network keeps a generic card mark.
  • Identities use a document template. The document type selects the fields and required values, so different document types can require different dates or identifiers.
  • SSH items require a title and private key. The key model is ed25519, with the public key and fingerprint kept beside it.
  • Environment entries require a title and file body. The file name is optional because pasted content may have no source file.
  • API keys require a title and token. The target environment, base URL, scopes, and expiry are supporting context and can be empty.

An environment entry keeps the file body as the source of truth. Its variable table is a view of that body, so edits made in the table and edits made in the file view update the same content. Identity fields follow the selected document template; changing the type clears fields that no longer belong to the new template.

References: src/…/meta.ts• L5-29 src/…/meta.ts• L5-12 src/…/meta.ts• L5-29 src/…/index.tsx• L21-44 src/…/cardBrand.ts• L1-45 src/…/meta.ts• L7-31 src/…/meta.ts• L5-16 src/…/meta.ts• L6-17 src/…/meta.ts• L7-21 src/…/index.tsx• L16-20 src/…/index.tsx• L35-50

Related entry data

Tags, custom fields, passkeys, and timestamps provide data that crosses kind boundaries. They extend an entry without making every kind know about every other kind.

  • Tags are ordered, unique labels. The editor adds one when the user confirms it and removes one when the user clicks its chip or presses Backspace on an empty tag input.
  • Custom fields are ordered label/value pairs. Any kind may use them for data that has no fixed row. Blank pairs are useful while editing but are removed before save.
  • Passkeys belong to login entries. The list can show that a login has a passkey, but the private signing key stays in the core and never enters the webview. The editor can remove an existing passkey; it cannot create one through ordinary text editing.
  • Timestamps record when the entry was created and last changed. A password change also records a password-change time for age and audit views.

References: src/…/types.ts• L10-46 src/…/draft.ts• L4-23 src/…/TagsInput.tsx• L12-56 src/…/index.tsx• L11-62 src/…/index.tsx• L15-47 src/…/useDraft.ts• L97-119

Entry metadata

Entry metadata is the safe, searchable projection used by the list. It contains enough information to group, search, filter, sort, and manage records without decrypting each payload; the secret fields arrive only when one entry is opened.

The list metadata includes the following concepts:

MetadataRole
ID, kind, and titleIdentify and label the row.
TagsSupport exact tag filtering and show filing labels.
Website host and login usernameSupport useful login subtitles and search without exposing passwords.
Card brandShow a card network derived from the number when known.
Passkey flagMark a login that has at least one passkey without sending passkey data.
Environment file name and variable countDescribe an environment entry without revealing its body.
Favorite flagDrive the Favorites view and star state.
Created and updated timesSupport recency and record history.
Deleted timeMark an archived record in the archive list.

Search uses title, website host, username, and tags. It does not search passwords, note bodies, card numbers, key material, file bodies, or API tokens. A row can therefore be found and filed without first exposing its secret content.

References: src/…/types.ts• L151-182 src-tauri/…/models.rs• L329-358 src/…/entries.ts• L18-60 src-tauri/…/migrate.rs• L17-157

Metadata and payload boundary

The stored record combines queryable metadata with one opaque encrypted payload. The boundary lets list operations read titles, tags, and derived hints while keeping secret fields sealed until a detail or edit action needs them.

When a record is saved, the system derives only list-safe values such as a card brand, environment variable count, login username, and passkey presence. The entry payload remains the source for all kind-specific secrets. A favorite is different: it is user-managed metadata, so starring an entry does not reveal or re-seal its payload.

The front end receives one entry at a time through reveal. A revealed entry is redacted before it crosses the boundary, which is especially important for passkeys. The list receives only the metadata projection, so a UI component must not treat EntryMeta as a complete credential.

References: src-tauri/…/mod.rs• L55-108 src-tauri/…/vault.rs• L14-46 src-tauri/…/models.rs• L150-181 src-tauri/…/models.rs• L329-385 src/…/cardBrand.ts• L1-45

Editing lifecycle

Editing is a draft session that starts from either a kind's empty defaults or the revealed entry. The same kind-specific field set renders the read view and the editor, which keeps the meaning and order of fields stable while the user changes values.

The main edit flow is:

flowchart TD
    A[Select a live entry or choose a new kind] --> B{Existing entry?}
    B -- Yes --> C[Reveal one encrypted payload]
    B -- No --> D[Load kind defaults]
    C --> E[Create draft and pristine baseline]
    D --> E
    E --> F[Edit fields tags and custom fields]
    F --> G{Valid draft?}
    G -- No --> H[Show required-field errors and keep editing]
    H --> F
    G -- Yes --> I[Save one entry]
    I --> J[Seal payload and refresh list metadata]
    J --> K[Select saved entry and schedule sync]

The draft records its original state so the UI can show unsaved changes. Cancel closes at once when nothing changed; otherwise the first cancel arms an inline discard confirmation. Save accepts one write at a time, keeps the editor open on failure, and updates the password-change timestamp only when the password differs from its starting value.

References: src/…/index.tsx• L15-39 src/…/index.tsx• L10-63 src/…/useDraft.ts• L34-66 src/…/useDraft.ts• L82-119

Existing entry edits

An existing entry is edited from its current decrypted values. The editor keeps the draft tied to that entry, so a later list refresh does not replace what the user is typing. The backend saves the changed entry as one record and restamps its update time.

Passkey edits follow a special rule. The webview receives passkey identity data with private keys removed. On save, the core matches each remaining passkey by credential ID and restores its stored private key. Removing a passkey removes it from the saved entry; adding an unknown passkey or supplying private key material is rejected.

References: src/…/useDraft.ts• L39-66 src-tauri/…/vault.rs• L32-80 src-tauri/…/models.rs• L164-271 src/…/index.tsx• L15-44

New entry creation

A new entry starts with the defaults for the selected kind. The add picker offers the supported kinds and also provides separate paths to scan a card or document and to receive a shared secret; those paths fill or hand off to the relevant flow without becoming new entry kinds. It receives a new ID and creation/update timestamps when the save request is built. Scan results may prefill fields before the editor opens, but the prefill is consumed once so it cannot leak into a later entry.

The kind's validation decides whether the draft can be saved. The saved row then becomes the current selection, and any active kind or tag view is adjusted if the new metadata would otherwise hide the row that was just created.

References: src/…/vault.ts• L78-103 src/…/vault.ts• L126-155 src/…/useDraft.ts• L47-80 src/…/types.ts• L38-43 src/…/index.tsx• L30-52 src/…/ActionRow.tsx• L6-56 src/…/ScanAction.tsx• L18-41 src/…/ReceiveAction.tsx• L11-24

Favorites and tags

Favorites and tags are separate filing tools. Favorites are a boolean marker for high-use entries, while tags are one or more user labels that also support exact filtering and direct navigation from the detail footer.

The favorite toggle performs a metadata-only write and updates the row without opening its secret payload. Archived entries cannot be favorited. Removing a favorite while viewing Favorites removes the row from that view and clears the selection rather than leaving a detail pane for an entry that is no longer in scope.

Tags are edited in the entry footer and shown as filterable chips. A saved change that removes the active tag leaves the tag view because the selected entry no longer matches that scope. Search combines a kind filter and tag filter before it ranks the query across list metadata.

References: src/…/Favorite.tsx• L7-27 src/…/vault.ts• L143-155 src/…/vault.ts• L198-208 src/…/Footer.tsx• L59-105 src/…/entries.ts• L18-60

Archive and restore

Archive is a reversible removal from the live list. It marks the stored row as a tombstone, which means the record remains available for sync and for the Archive view but is not available for normal reveal or editing.

The archive flow is:

sequenceDiagram
    participant U as User
    participant V as Vault UI
    participant S as Vault store
    U->>V: Choose Archive and confirm
    V->>S: Mark live row as tombstone
    S-->>V: Remove row from live list
    U->>V: Open Archive
    V->>S: List tombstoned records with content
    U->>V: Restore or delete permanently
    alt Restore
        V->>S: Clear tombstone and refresh metadata
        S-->>V: Return row to live list
    else Delete permanently
        V->>S: Empty the content and keep a sync tombstone
        S-->>V: Remove row from Archive
    end

Archive uses a two-press confirmation. An archived record has no edit, copy, favorite, or reveal action because its content is not served through the live entry path. Restore makes it live again and updates its time so the restore can win against an older tombstone during sync. Permanent deletion removes the payload and metadata content while keeping a content-free tombstone so another device cannot restore the old secret on a later merge.

References: src/…/MoreMenu.tsx• L26-107 src/…/Archived.tsx• L18-45 src/…/vault.ts• L158-195 src-tauri/…/vault.rs• L82-112 src-tauri/…/sqlite.rs• L527-669

Entry models are the shared data layer for the broader credential experience. The list and edit behavior described here provide the record shape; other pages explain the surrounding capabilities.

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the EntryType union, kind registry, kind defaults, and kind-specific validation aligned. A new or renamed kind must be present in all of them before it can be created or displayed.
  • Keep the front-end entry fields and Rust Entry serialization names aligned. In particular, identity fields use snake case while SSH, environment, and API key fields use their defined wire names.
  • Keep EntryMeta, the Rust metadata DTO, and the metadata derivation rules aligned. A list subtitle or filter can silently stop working if a derived column is missing or renamed.
  • Preserve the metadata/payload boundary when adding a list feature. Secret fields must not enter EntryMeta or list search.
  • Keep card network ranges and supported card marks aligned between the front-end mirror and the backend derivation. A mismatch can show one network while storing another in list metadata.
  • Preserve passkey redaction and credential-ID matching when changing login save behavior. A save must not accept private key material from the webview or save an unmatched keyless credential.
  • Keep the add picker kind choices separate from scan and receive actions. Changes to those routes can alter whether a prefill is consumed or whether a shared entry starts its own flow.
  • Keep archive, restore, purge, and sync tombstone rules together. A change that removes or revives rows locally can change how another device resolves the same entry.
  • Keep favorite changes separate from ordinary entry saves. The editor does not own the favorite flag, so an ordinary save must not clear it.

Important failure modes

TriggerConsequenceGuard
A required field is empty or an optional login email is invalidSave is refused and the editor stays open with field feedback.Kind validation is shared with the field rules and runs before the write.
A login edit sends passkey private key materialThe save is refused instead of replacing the core-held signing key.Reveal redacts keys and save rejects supplied private keys.
A passkey is added with no matching stored credential IDThe whole save fails rather than storing a credential that cannot sign.The core matches every incoming passkey before moving any key.
Front-end and backend card network rules disagreeA card can show a different network mark in the editor than in the saved list row.The TypeScript detector mirrors the backend ranges and the supported mark set.
A favorite is toggled on an archived entryNo favorite is set and the tombstone is not given a new sync timestamp.Favorite writes target live rows only.
A permanently deleted row is removed instead of purged to a shellA peer can reintroduce its old sealed payload during sync.Purge clears content but retains a content-free tombstone.
An environment editor treats parsed variables as a second source of truthComments, quoting, blank lines, or variable references can be lost.The verbatim file body remains canonical and the table edits that same string.

Key files

FileWhy to read it
src/…/types.tsDefines the entry kinds, kind-specific shapes, shared metadata, passkeys, and wire names.
src/…/index.ts and src/…/types.tsDefine the kind registry and the behavior contract shared by list, read, and edit surfaces.
src/…/meta.tsShows the defaults, validation, primary secret, and list subtitle for each kind.
src/…/useDraft.tsExplains draft state, dirty tracking, discard confirmation, save rules, and password-change stamps.
src/…/Footer.tsxShows how tags and record timestamps are displayed and edited.
src/…/index.tsxShows the kind-agnostic custom field behavior.
src/…/index.tsxShows why passkeys can be kept or removed but not created in the editor.
src/…/index.tsx and src/…/ActionRow.tsxShows how users choose a kind or enter through scan and receive actions before editing starts.
src/…/cardBrand.ts and src/…/index.tsxShows how card numbers are normalized, displayed, and mapped to network marks.
src/…/vault.tsConnects save, favorite, archive, restore, purge, selection, and sync scheduling.
src-tauri/…/models.rsDefines the sealed entry model and the safe metadata projection.
src-tauri/…/vault.rsDefines reveal, save, archive, restore, purge, favorite, and environment-file boundaries.
src-tauri/…/migrate.rsDefines which entry values become list metadata and how records are assembled.
src-tauri/…/sqlite.rsDefines live rows, tombstones, favorite writes, and permanent purge behavior.