Skip to content

feat(team-vault): add GET vault-key/holders for distribution reconciliation (#41)#2

Open
kipavy wants to merge 1 commit into
mainfrom
fix/41-vault-key-holders-endpoint
Open

feat(team-vault): add GET vault-key/holders for distribution reconciliation (#41)#2
kipavy wants to merge 1 commit into
mainfrom
fix/41-vault-key-holders-endpoint

Conversation

@kipavy

@kipavy kipavy commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Server half of VoltiusApp/voltius#41 (team-vault invitee lockout).

Why

Vault-key distribution on the client is event-driven, so a member who joins while the only key-holder is offline never receives a key. The fix is a client-side reconciliation pass, but to distribute to only the members missing a key (rather than blindly re-wrapping for everyone and re-notifying them via SSE on every login), the key-holder needs to know who already holds one. The server exposed no such signal — only GET vault-key (your own key) and PUT vault-key.

Change

Add GET /v1/teams/:team_id/vault-key/holders["user_id", ...] for users with a row in team_vault_keys.

  • Gated identically to get_my_vault_key: is_team_member (403) + teams-tier (402) + PERM_VIEW_SECRETS (403).
  • Returns only user_ids, never key material — safe for any member who can view the vault.

Tests

DB-backed (test_pool_or_skip!), verified locally against a throwaway Postgres — full suite 138 passed:

  • holders_lists_only_members_with_a_key — a keyless joiner is absent from the list
  • holders_forbidden_for_non_member
  • holders_forbidden_without_view_secrets_permission

Companion

Client PR: VoltiusApp/voltius#49 (consumes this endpoint in reconcileTeamVaultKeys). This endpoint is additive and safe to merge independently.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RnVt37SuhKfm94kpkh8rez

…iation (#41)

A key-holder client needs to know which team members already have a
wrapped vault key so it can distribute to exactly the ones missing it,
without re-wrapping for (and re-notifying) everyone on each pass.

Add GET /v1/teams/:team_id/vault-key/holders returning the user_ids that
hold a row in team_vault_keys. Membership + teams-tier + PERM_VIEW_SECRETS
gated, mirroring get_my_vault_key. Returns only user_ids, no key material.

Tested: lists only members with a key (keyless members absent), forbidden
for non-members, forbidden without view-secrets.
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