npm.io
8.36.0 • Published 3d ago

@zowe/secrets-for-zowe-sdk

Licence
EPL-2.0
Version
8.36.0
Deps
0
Size
4.1 MB
Vulns
0
Weekly
0
Stars
131
Install scriptsThis package runs scripts during installation (preinstall/install/postinstall)

Secrets Package

Contains APIs for secure credential management.

keyring API Examples

Developers that reference the dependency keytar directly in their code need to use the new keyring module from this package.

Use the keyring module in the same fashion as keytar.

Storing and loading credentials

const { keyring } = require("@zowe/secrets-for-zowe-sdk");
await keyring.setPassword("ServiceName", "AccountName", "SomePassword");

const password = await keyring.getPassword("ServiceName", "AccountName");
// password should equal "SomePassword"
Finding a credential
const { keyring } = require("@zowe/secrets-for-zowe-sdk");
const password = await keyring.findPassword("ServiceName/AccountName");
// password should equal "SomePassword"
Finding all credentials matching service
const { keyring } = require("@zowe/secrets-for-zowe-sdk");
const matchingCredentials = await keyring.findCredentials("ServiceName");
// returns: 
// [
//    { account: "AccountName", password: "SomePassword" },
//    ...
// ]
Deleting a credential
const { keyring } = require("@zowe/secrets-for-zowe-sdk");
const wasDeleted = await keyring.deletePassword("ServiceName", "AccountName");
// wasDeleted should be true; ServiceName/AccountName removed from credential vault

For more detailed information, see src/keyring/EXTENDERS.md.