Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactored PUT /api/vaults/{v}/access-tokens/{u}POST /api/vaults/{v}/access-tokens #242

Merged
merged 2 commits into from
Nov 13, 2023

Conversation

overheadhunter
Copy link
Member

The new API accepts multiple access grants in a single requests, making bulk requests easier, as can be seen here:

let tokens: AccessGrant[] = [];
for (const user of users) {
if (user.publicKey) { // some users might not have set up their key pair, so we can't share secrets with them yet
const publicKey = base64.parse(user.publicKey);
const jwe = await props.vaultKeys.encryptForUser(publicKey);
tokens.push({ userId: user.id, token: jwe });
}
}
await backend.vaults.grantAccess(props.vault.id, ...tokens);

replacing `PUT /api/vaults/{v}/access-tokens/{u}`, accepting multiple user-token-pairs
@overheadhunter overheadhunter added this to the 1.3.0 milestone Nov 13, 2023
Copy link
Member

@SailReal SailReal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM; As discussed, we should add in the future an HTTP status code 207 like in WebDAV but we can enhance that later.

@SailReal SailReal merged commit b138e64 into develop Nov 13, 2023
@SailReal SailReal deleted the feature/multi-access-grant branch November 13, 2023 16:42
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.

2 participants