# @seek/kms-config

> Decrypt KMS encrypted values in config files

Latest version **1.0.0** (published 2017-01-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install @seek/kms-config
pnpm add @seek/kms-config
yarn add @seek/kms-config
bun add @seek/kms-config
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2017-01-15 |
| First published | 2016-12-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | bcao, benjaminl, bernos, bmabbett, crystalena, dborysiewicz, dduffett, dwhite-sk, etaoins, george_, gmadan, gorankl, jackjseek, jahredhope, jgrigg, jkretchmar, jyenicolson, kunwardeep, levili, mattsjones, mistanorbo, mjt01, mooretodd, pmzara, pokle, rhua, richard.fisk, ryardley, sandymann, shawndsouza, sheltonial, skulkarni, smoss, tristanstraub, xwangau |

## Links

- npm: https://www.npmjs.com/package/@seek/kms-config
- Repository: https://github.com/seek-oss/kms-config
- Homepage: https://github.com/seek-oss/kms-config/tree/master/packages/kms-config
- Issues: https://github.com/seek-oss/kms-config/issues
- npm.io page: https://npm.io/package/@seek/kms-config

## Recent versions

- 1.0.0 (latest) — 2017-01-15
- 0.1.4 — 2016-12-13
- 0.1.3 — 2016-12-13
- 0.1.2 — 2016-12-12

## README

<a name="module_config"></a>

## config ⇒ <code>Promise</code>
Decrypt [KMS](https://aws.amazon.com/kms/) encrypted values in config files. This tool is optimised for use in node 4.3.2 AWS Lambda functions but should work in any modern node runtime.

### Install
```
npm install --save @seek/kms-config
```

### Usage
The user that is running the lambda will need `kms:Decrypt` permission to the master key used for generating the ciphertext.
*Warning** To reduce KMS overhead you should just call this once and cache the result if possible.

#### myConfig.json
```javascript
{
    "foo" : "bar",
    "kms" { //All the values in this object are expected to be KMS ciphertext 
        "secretToHappiness" : "base64_encoded_ciphertext"
    }
}
```
#### handler.js
```javascript
const myConfig = require('./myConfig')
const config  = require('@seek/kms-config')(myConfig)

config.then(resolved => {
    console.log(resolved.foo) // "bar"
    console.log(resolved.kms.secretToHappiness) // "eat more chocolate"
}).catch(err => {
    console.log(err, "Oh dear perhaps you are missing KMS permissions")
})
...
```

**Returns**: <code>Promise</code> - A promise to the loaded config which will be resolved with all kms values decrypted.  

| Param | Type | Description |
| --- | --- | --- |
| config | <code>Object</code> | A config object which may contain a child `kms` object who's values are KMS ciphertext |

---
_Source: https://npm.io/package/@seek/kms-config · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
