-
Notifications
You must be signed in to change notification settings - Fork 50
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
[SM-865] Part 2 Use new get secrets by IDs endpoint #150
Conversation
No New Or Fixed Issues Found |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good on quick review, nice work! Just got a couple of comments:
- Please update the changelog inside the bitwarden crate to mention this PR on the unreleased section
- We're trying as much as we can to keep PRs small, and the autogenerated bindings definitely don't make this easy 😅, would you mind extracting the autogenerated bindings to a separate PR, which we can get merged quickly, and just keeping this one for the secrets changes? Thanks!
crates/bitwarden-napi/binding.js
Outdated
@@ -11,7 +11,8 @@ function isMusl() { | |||
// For Node 10 | |||
if (!process.report || typeof process.report.getReport !== "function") { | |||
try { | |||
return readFileSync("/usr/bin/ldd", "utf8").includes("musl"); | |||
const lddPath = require("child_process").execSync("which ldd").toString().trim(); | |||
return readFileSync(lddPath, "utf8").includes("musl"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes to this file don't seem related to this PR, can we move it to a separate PR with some explanation on why they are needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is auto generated when running npm run build
in the napi crate.
Looks like my M1 Macbook generates a different file for both master and this branch.
I'm reverting it back 143cd6e to what is in master.
In the future, this probably should be built during the build/release workflows and not handled by source control.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
The base branch was changed.
## Type of change - [ ] Bug fix - [ ] New feature development - [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc) - [ ] Build/deploy pipeline (DevOps) - [x] Other ## Objective Allow secret fetching by a list of IDs, rather than requesting multiple secrets individually. Exposes the functionality from #150 in Go. ## Code changes - **languages/go/secrets.go:** Add `GetByIDS` func. - **languages/go/example/example.go:** Get secrets by ID. Added JSON output for QA/ease-of-use.
Type of change
Objective
The purpose of this PR is to expose the new get secrets by IDs endpoint in the SDK and use that in the bws CLI and napi.
Code changes
crates/bitwarden-json/src/client.rs:
crates/bitwarden-json/src/command.rs:
Exposing
GetByIds
as a secret command.crates/bitwarden-napi/src-ts/bitwarden_client/index.ts:
Exposing
getByIds
in typescript/ napi-rs implementation.crates/bitwarden/src/secrets_manager/client_secrets.rs:
crates/bitwarden/src/secrets_manager/secrets/get_by_ids.rs:
crates/bitwarden/src/secrets_manager/secrets/mod.rs:
Source code for
get_by_ids
secret command.crates/bitwarden/src/secrets_manager/secrets/secret_response.rs:
Add support for parsing the
BaseSecretResponseModel
and createSecretsResponse
for returning a vec of SecretResponses.crates/bws/src/main.rs:
Use
get_by_ids
in bws secret listing command instead of individually making an HTTP request for each secret.crates/sdk-schemas/src/main.rs:
Add
SecretsResponse
as a result of SDK command.Screenshots
Before you submit