Skip to content

feat(vault): vault register + vault login (account profile)#7

Merged
UnbreakableMJ merged 2 commits into
mainfrom
register-login
Jun 13, 2026
Merged

feat(vault): vault register + vault login (account profile)#7
UnbreakableMJ merged 2 commits into
mainfrom
register-login

Conversation

@UnbreakableMJ

Copy link
Copy Markdown
Contributor

Summary

Implements the last two PRD §7.1 verbs — register and login — as an account-profile flow (the Bitwarden personal API-key model stays a tracked follow-up, per the scoping decision). Beyond one optional IPC field this is CLI-only: no new vault-api surface, no agent auth split.

register

Records the account — server, lower-cased email, and a freshly minted stable device_id — into a new [account] table in config.toml. No agent or network; a light http(s):// check is the only validation (real errors surface at first login). Re-registering preserves the existing device_id.

login

Authenticates against the registered account (master password → Request::Unlock) and ends on a status-backed sync summary (logged in as <email> · <n> items · synced <ts>, or --json). Auto-spawns the agent, so a cold vault login brings everything up.

unlock

Now resolves server/email from the profile too, so its flags (and $VAULT_SERVER/$VAULT_EMAIL) are optional once registered. Precedence: explicit flag/env → profile → error. login and unlock share one Request::Unlock — the difference is resolution and login's verbose, status-backed success.

Stable device id

Request::Unlock gains a serde-defaulted device_id: Option<String>; the agent uses it as the Bitwarden deviceIdentifier instead of minting a fresh UUID each unlock, so the account stops accumulating a new device per session. Old Unlock frames without the field still decode (regression-tested).

Tests

[account] round-trip + "no empty table until set" + device-id mint/preserve + email lower-casing; resolve_account precedence (flag → profile → error); the Unlock device-id round-trip and old-frame-decode regression. Workspace: 126 tests green, clippy -D warnings clean, cargo deny clean, headless build green. Verified live: register (lower-case + mint + --json), non-http rejection, no-profile login error (exit 2), and flag-less unlock resolving from the profile.

New dependency

uuid on vault-cli (device_id mint) — already in the workspace tree.

🤖 Generated with Claude Code

UnbreakableMJ and others added 2 commits June 14, 2026 01:25
Add the last two PRD §7.1 verbs as an account-profile flow (not the
Bitwarden personal API-key model, which stays a tracked follow-up).

register: records the account — server, lower-cased email, and a freshly
minted stable device_id — into a new [account] table in config.toml. No
agent or network; a light http(s):// check is the only validation, with
real errors surfacing at first login. Re-registering preserves the
existing device_id.

login: authenticates against the registered account (master password →
Request::Unlock) and ends on a status-backed sync summary ("logged in as
<email> · <n> items · synced <ts>", or --json). Auto-spawns the agent, so
a cold `vault login` brings everything up.

unlock: now resolves server/email from the profile too, so its flags
(and $VAULT_SERVER/$VAULT_EMAIL) are optional once registered. Precedence
is explicit flag/env → profile → error. login and unlock share one
Request::Unlock; the difference is resolution and login's verbose,
status-backed success.

Stable device id: Request::Unlock gains a serde-defaulted
device_id: Option<String>; the agent uses it as the Bitwarden
deviceIdentifier instead of minting a fresh UUID each unlock, so the
account stops accumulating a new device per session. Old Unlock frames
without the field still decode (regression-tested).

CLI-only beyond that one optional IPC field: no vault-api surface, no
agent auth split. New uuid dep on vault-cli (already in the workspace).

Tests: [account] round-trip + no-empty-table-until-set + device-id
mint/preserve + email lower-casing; resolve_account precedence
(flag → profile → error); Unlock device-id round-trip and
old-frame-decode regression. Verified live: register (lower-case +
mint), --json, non-http rejection, no-profile login error, and flag-less
unlock resolving from the profile.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
A newer stable clippy than the local one flagged three lints in the
register/login code: a missing-backticks doc item (`device_id`) and two
`format!` appended to a String via push_str. Backtick the doc term and
switch print_login_summary to write! (fmt::Write).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@UnbreakableMJ
UnbreakableMJ merged commit 23b00f7 into main Jun 13, 2026
8 checks passed
@UnbreakableMJ
UnbreakableMJ deleted the register-login branch June 13, 2026 22:36
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