Skip to content

feat(account): command handlers for account management (task 21) - #125

Merged
mpiton merged 9 commits into
mainfrom
feat/task-21-commands-accounts
Apr 28, 2026
Merged

feat(account): command handlers for account management (task 21)#125
mpiton merged 9 commits into
mainfrom
feat/task-21-commands-accounts

Conversation

@mpiton

@mpiton mpiton commented Apr 28, 2026

Copy link
Copy Markdown
Owner

Summary

• Implement 6 command handlers: add, update, delete, validate, import, export
• Add domain ports: AccountValidator, AccountCredentialStore, PassphraseCodec
• Implement KeyringAccountStore and AesGcmPbkdf2Codec adapters
• Add 7 domain events for account operations
• Full test coverage: 91-97% handlers, 95% codec

Type

feat


Summary by cubic

Adds six account command handlers and crypto/keyring plumbing for full account management and encrypted import/export. Implements task 21 with atomic, cross‑platform‑safe exports and stronger rollback/cleanup on keyring failures.

  • New Features

    • Handlers: add, update, delete, validate, export, import.
    • Ports: AccountValidator (+ ValidationOutcome), AccountCredentialStore, PassphraseCodec.
    • Adapters: KeyringAccountStore (per-account passwords), AesGcmPbkdf2Codec (AES‑256‑GCM + PBKDF2; header as AAD).
    • Events via Tauri: account-added/updated/deleted/validated/validation-failed/accounts-imported/accounts-exported.
    • CommandBus wired with builders for the new ports; handlers validate inputs and keep DB/keyring in sync.
    • Dependencies: aes-gcm, pbkdf2, hmac, rand.
  • Bug Fixes

    • add_account: on keyring write failure, roll back row, best‑effort delete partial secret, and log rollback errors.
    • update_account: on rotation failure, roll back row and restore the previous password (or delete if none).
    • delete_account: keyring delete is best‑effort so AccountDeleted always fires.
    • export_accounts: write to a temp file, fsync, then perform a single atomic rename to replace the destination; always clean up the temp file.
    • import/validate hardening: cap PBKDF2 iterations; trim inputs and skip duplicates; atomically roll back the whole batch on any entry failure (including a failed keyring write); emit AccountValidationFailed for transport/storage errors.
    • Preserve created_at across export/import so list ordering remains stable.
    • Tests: rename the test passphrase fixture to avoid secret-scanner false positives (no behavior change).

Written for commit c0a8154. Summary will update on new commits. Review in cubic

Summary by CodeRabbit

  • New Features

    • Account management: add/update/delete accounts with per-account OS keyring credential storage and automatic rollback on secret-store failures
    • Account validation: test credentials, persist validation metadata (timings/traffic/valid-until) and emit success/failure events
    • Encrypted bundles: export/import accounts to an authenticated passphrase format (AES‑GCM + PBKDF2), with pre-validation and duplicate skipping
  • Events

    • UI-facing account lifecycle and import/export events emitted
  • Documentation

    • CHANGELOG expanded with account, credential, and export/import details

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies documentation Improvements or additions to documentation rust

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant