-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
## Type of change ``` - [ ] Bug fix - [ ] New feature development - [x] Tech debt (refactoring, code cleanup, dependency upgrades, etc) - [ ] Build/deploy pipeline (DevOps) - [ ] Other ``` ## Objective Implement support for projects, accesstokenlogin and response unwrapping. Also added a small example
- Loading branch information
1 parent
400a173
commit 575dd19
Showing
6 changed files
with
189 additions
and
82 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const { BitwardenClient: BitwardenClientWasm, LogLevel } = require("@bitwarden/sdk-wasm"); | ||
const sdk = require("@bitwarden/sdk-client"); | ||
|
||
async function main() { | ||
const settings = { | ||
apiUrl: process.env.API_URL, | ||
identityUrl: process.env.IDENTITY_URL, | ||
}; | ||
|
||
const client = new sdk.BitwardenClient( | ||
new BitwardenClientWasm(JSON.stringify(settings), LogLevel.Debug), | ||
); | ||
|
||
const organization_id = process.env.ORGANIZATION_ID; | ||
await client.accessTokenLogin(process.env.ACCESS_TOKEN); | ||
|
||
const project = await client.projects().create("test", organization_id); | ||
const projects = await client.projects().list(organization_id); | ||
console.log(projects.data); | ||
|
||
const secret = await client | ||
.secrets() | ||
.create("test-secret", "My secret!", "This is my secret", [project.id], organization_id); | ||
const secrets = await client.secrets().list(organization_id); | ||
console.log(secrets.data); | ||
|
||
console.log(project, secret); | ||
|
||
await client.projects().delete([project.id]); | ||
await client.secrets().delete([secret.id]); | ||
} | ||
main(); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "sdk-example", | ||
"main": "index.js", | ||
"scripts": { | ||
"start": "node index.js" | ||
}, | ||
"dependencies": { | ||
"@bitwarden/sdk-client": "../sdk-client", | ||
"@bitwarden/sdk-wasm": "../wasm" | ||
} | ||
} |
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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