1.0.1 • Published 7 years ago

kms-auto-decrypt v1.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

node-kms-auto-decrypt

CircleCI

Install

npm install kms-auto-decrypt

Usage

First configure an AWS access and secret key. Then use aws kms encrypt to encrypt a JSON.stringifyed object containing secret values. For example, consider this object:

{
  "foo": {
    "two": {
      "b": "secret"
    },
    "three": "secret"
  }
}

After encrypting, you will have a CiphertextBlob. Insert this as a root key, kmsCiphertextBlob, in an object containing other non-encrypted values.

const kmsAutoDecrypt = require('kms-auto-decrypt');

const myConf = {
  kmsCiphertextBlob: 'encrypted-secrets',
  foo: {
    one: '1',
    two: {
      a: 'A'
    }
  }
};

kmsAutoDecrypt(myConf).then((decryptedConf) => { /* ... */ });

Now you can use decryptedConf which will contain both decrypted and plain (originally non-encrypted) values:

{
  foo: {
    one: '1',
    two: {
      a: 'A',
      b: 'secret'
    },
    three: 'secret'
  }
};