Skip to content

feat(vault): create/edit identity ciphers (write path)#27

Merged
UnbreakableMJ merged 1 commit into
mainfrom
identity-write
Jun 15, 2026
Merged

feat(vault): create/edit identity ciphers (write path)#27
UnbreakableMJ merged 1 commit into
mainfrom
identity-write

Conversation

@UnbreakableMJ

Copy link
Copy Markdown
Contributor

What

vault add --type identity and vault edit <identity> now create and update identity (type 4) ciphers — the last cipher type to gain a write path. With this, all four cipher types (login / note / card / identity) are writable from the CLI.

Mirrors the card-write stack (PR #25). The 15 non-secret fields are flags; the three sensitive fields — SSN, passport, license (which PlainIdentity zeroizes) — are read from /dev/tty when their bool flag is set, never argv.

How

  • vault-ipc — typed IdentityWrite (15 Option<String> + ssn/passport/license as secret Vec<u8> with a hand-written Debug that redacts them). Rides a #[serde(default)] identity on Request::Add/Edit. Transport round-trip + redaction tests.
  • vault-corefrom_plain emits an Identity for cipher_type == 4, the exact inverse of the read-path decrypt. from_plaindecrypt round-trip test.
  • vault-agentadd_cipher decodes the secrets (zeroizing) into a PlainIdentity before from_plain; apply_cipher_edits sets only the given identity fields and rejects identity edits on a non-identity item. The edit path reuses identity_write_to_plain to produce an owned PlainIdentity and borrows the overlay from it, so its Drop scrubs the secrets. Unit-tested.
  • vault-cliKindArg::Identity; a #[command(flatten)] IdentityArgs struct shared by add/edit (15 string flags + --ssn/--passport/--license bool flags gating tty prompts). The identity's own username is --identity-username (the bare --username stays the login field).
  • vault-tui — threads identity: None through its Add/Edit request literals.
  • docs — README identity create/edit note, CHANGELOG entry.

Verification

cargo fmt --check, fresh-isolated clippy -D warnings (pedantic+nursery), cargo test --workspace --all-targets (core 7 / ipc 17 / agent 37 with the new identity tests), cargo deny check, and both headless builds all clean.

Out of scope (tracked follow-up)

🤖 Generated with Claude Code

`vault add --type identity` and `vault edit <identity>` now build and
update identity (type 4) ciphers — the last cipher type to gain a write
path. Mirrors the card-write stack.

- vault-ipc: typed `IdentityWrite` (15 non-secret `Option<String>` +
  ssn/passport_number/license_number as secret `Vec<u8>` with a redacted
  `Debug`) rides a serde-defaulted `identity` on `Request::Add`/`Edit`;
  transport round-trip + redaction tests.
- vault-core: `from_plain` emits an `Identity` for cipher_type 4, the
  inverse of the read-path decrypt; from_plain→decrypt round-trip test.
- vault-agent: `add_cipher` decodes the secrets into a `PlainIdentity`
  before `from_plain`; `apply_cipher_edits` sets only the given identity
  fields (reusing `PlainIdentity` as the owned borrow holder so its
  `Drop` scrubs the secrets), rejecting identity edits on a non-identity
  item; unit-tested.
- vault-cli: `KindArg::Identity`; a `#[command(flatten)] IdentityArgs`
  shared by add/edit — 15 string flags + `--ssn`/`--passport`/`--license`
  bools that prompt on /dev/tty (never argv). Identity username is
  `--identity-username` (the login username stays `--username`).
- vault-tui: thread `identity: None` through its Add/Edit literals.
- docs: README identity create/edit, CHANGELOG entry.

All four cipher types are now writable. Identity TUI editing (now
unblocked) is the next follow-up.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@UnbreakableMJ
UnbreakableMJ merged commit 9f1e8fa into main Jun 15, 2026
8 checks passed
@UnbreakableMJ
UnbreakableMJ deleted the identity-write branch June 15, 2026 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant