1# is-secret
2
3A distributed maintained collection of patterns that indicate that
4something probably is secret.
5
6This is useful if you want to filter sensitive values in a data set.
7
8This module uses a very simple algorithm that will not catch everthing.
9Use at your own risk.
10
11[![npm](https://img.shields.io/npm/v/is-secret.svg)](https://www.npmjs.com/package/is-secret)
12[![Build status](https://travis-ci.org/watson/is-secret.svg?branch=master)](https://travis-ci.org/watson/is-secret)
13[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard)
14
15## Installation
16
17```
18npm install is-secret --save
19```
20
21## Usage
22
23```js
24var isSecret = require('is-secret')
25
26var data = {
27  username: 'watson',
28  password: 'f8bY2fg8',
29  card: '1234 1234 1234 1234' // credit card number
30}
31
32Object.keys(data).forEach(function (key) {
33  if (isSecret.key(key) ||
34      isSecret.value(data[key])) data[key] = '********'
35})
36
37console.log(data)
38// {
39//   username: 'watson',
40//   password: '********',
41//   card: '********'
42// }
43```
44
45_If you need functionality similar to what is shown in this example, I
46suggest you take a look at the
47[redact-secrets](https://github.com/watson/redact-secrets) module._
48
49## API
50
51### `secret.key(string)`
52
53Validates the given `string` against a list of key names known to
54typically indicate secret data.
55
56Returns `true` if the `string` is considered secret. Otherwise `false`.
57
58### `secret.value(string)`
59
60Validates the given `string` against a list of patterns that indicates
61secret data.
62
63Returns `true` if the `string` is considered secret. Otherwise `false`.
64
65## License
66
67[MIT](LICENSE)
68