@viperhq/secrets
TypeScript icon, indicating that this package has built-in type declarations

1.0.7 • Public • Published

AWS related secret management helpers

npm

Usage

SSM

batchGet

const ssm = new SSM({
  region: "us-east-1"
});
const params = [
  {
    name: "/production/service/secrets.json",
    default: JSON.stringify({
      password: process.env.PASSWORD
    })
  },
  {
    name: "/production/service/private.pem",
    target: path.join(rootDir, "certs", "private.pem")
  }
];
const result = await ssm.batchGet(params);
console.log(result);
/*
{
  "/production/service/secrets.json": "{\"password\":\"123\"}",
  "/production/service/private.pem": "PEM_FILE_CONTENTS"
}
*/

batchDelete

const ssm = new SSM({
  region: "us-east-1"
});
const params = [
  {
    name: "/production/service/secrets.json",
    default: JSON.stringify({
      password: process.env.PASSWORD
    })
  }
];
await ssm.batchDelete(params);
const result = await ssm.batchGet(params);
console.log(result);
/*
{
  "/production/service/secrets.json": "{\"password\":\"process.env.PASSWORD\"}"
}
*/

put

const ssm = new SSM({
  region: "us-east-1"
});
const params = [
  {
    name: "/production/service/secrets.json",
    content: JSON.stringify({
      password: process.env.PASSWORD
    }),
    encrypted: true,
    overwrite: true
  }
];
await ssm.put(params[0]);
const result = await ssm.batchGet(params);
console.log(result);
/*
{
  "/production/service/secrets.json": "{\"password\":\"process.env.PASSWORD\"}"
}
*/

Readme

Keywords

Package Sidebar

Install

npm i @viperhq/secrets

Weekly Downloads

1

Version

1.0.7

License

Apache-2.0

Unpacked Size

24 kB

Total Files

9

Last publish

Collaborators

  • artit91