feat(team-vault): add GET vault-key/holders for distribution reconciliation (#41)#2
Open
kipavy wants to merge 1 commit into
Open
feat(team-vault): add GET vault-key/holders for distribution reconciliation (#41)#2kipavy wants to merge 1 commit into
kipavy wants to merge 1 commit into
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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) andPUT vault-key.Change
Add
GET /v1/teams/:team_id/vault-key/holders→["user_id", ...]for users with a row inteam_vault_keys.get_my_vault_key:is_team_member(403) + teams-tier (402) +PERM_VIEW_SECRETS(403).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 listholders_forbidden_for_non_memberholders_forbidden_without_view_secrets_permissionCompanion
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