Skip to content

feat: expand data model to password manager comparable#8

Merged
danpasecinic merged 19 commits intomainfrom
feat/data-model-v2
Jan 28, 2026
Merged

feat: expand data model to password manager comparable#8
danpasecinic merged 19 commits intomainfrom
feat/data-model-v2

Conversation

@danpasecinic
Copy link
Owner

This pull request refactors the CLI command implementation to consistently use the term "item" instead of "entry" throughout the codebase, and updates the logic to support a broader set of item types. The changes affect the add, delete, get, list, passkey, and totp commands, aligning them with a more flexible vault model and improving clarity for users. The most important changes are grouped below.

Terminology and API Updates:

  • Replaced all references to "entry" with "item" in variable names, function calls, user messages, and error handling across command files (add.zig, delete.zig, get.zig, list.zig, passkey.zig, totp.zig). Vault API calls such as addEntry, getEntry, and deleteEntry are now addItem, getItem, and deleteItem respectively, with error types and messages updated to match. [1] [2] [3] [4] [5] [6]

Expanded Item Type Handling:

  • The list and get commands now support a wider range of item types (login, card, note, identity, ssh_key, api_credential, database, wifi, license), displaying relevant information for each type. The output formatting and switch logic have been updated to accommodate these changes. [1] [2]

Passkey Command Improvements:

  • Refactored the passkey command to treat passkeys as part of login items, rather than standalone entries. Listing, showing, and deleting passkeys now operate on login items and their embedded passkeys, with updated help text and error handling. [1] [2] [3]

TOTP Command Consistency:

  • Updated the totp command to use "item" terminology, improving consistency in prompts and error messages.

User-Facing Message Improvements:

  • All CLI prompts, confirmations, and error messages now use "item" instead of "entry," making the user experience more consistent and clear. [1] [2] [3] [4] [5] [6] [7]

These changes modernize the CLI codebase, improve clarity for users, and prepare the vault for supporting more complex item types.

Comprehensive design for expanding zault from basic credential store
to full password manager with:

- 9 item types (login, card, identity, SSH key, etc.)
- Hybrid custom fields system
- Folders and tags organization
- Full-text fuzzy search
- Automatic password history
- Favorites and recents
- Attachments support

Based on research of 1Password SDK and Bitwarden data models.
- Removed v2 naming, directly replaced serializer.zig
- Full serialize/deserialize for all 9 item types
- Roundtrip tests passing
- Vault now stores Items instead of Entries
- Renamed addEntry/getEntry/deleteEntry to addItem/getItem/deleteItem
- Updated error types: EntryNotFound -> ItemNotFound, EntryAlreadyExists -> ItemAlreadyExists
- CLI commands updated to work with new 9-type Item system
- TOTP is now embedded in LoginData.totp instead of separate entry type
- Passkeys are now embedded in LoginData.passkeys instead of separate entry type
- List command shows all 9 item types with appropriate info
- Delete entry.zig which had the old 3-type system (password, totp, passkey)
- Update main.zig to remove entry import and add item/uuid/serializer to tests
- New Item-based system with 9 types is now the only data model
- Add proper errdefer cleanup in all deserialization functions
- Secure zero sensitive data (passwords, keys, SSN, etc.) on errors
- Fix inconsistent null handling for CardBrand enum (return error instead of silent null)
- Bump vault version from 1 to 2 for new item-based format
Avoids confusing vault.items.items pattern by renaming to
vault.item_list.items which reads more naturally.
- Add secureZeroAndFree for non-optional sensitive data
- Add secureFree for optional sensitive data (zero then free)
- Add freeOptional for optional non-sensitive data
- Refactor item.zig deinit functions to use new helpers
- Refactor serializer.zig errdefer blocks to use new helpers
- Reduces code duplication by 76 lines
@danpasecinic danpasecinic self-assigned this Jan 28, 2026
@danpasecinic danpasecinic added the enhancement New feature or request label Jan 28, 2026
@danpasecinic danpasecinic merged commit 37cffc7 into main Jan 28, 2026
4 checks passed
@danpasecinic danpasecinic deleted the feat/data-model-v2 branch January 28, 2026 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant