Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

hide-secrets

bcoe11.4kISC2.0.0

for when you want to log objects, but hide certain restricted fields, e.g., passwords.

secret, password, hide, obfuscate

readme

hide-secrets

Build Status Coverage Status NPM version js-standard-style

var hide = require('hide-secrets')

var obj = {
  innerObject: {
    password: 'abc123',
    email: 'ben@npmjs.com',
    token: 'my-secret-token'
  },
  auth: '' // empty strings are left empty.
}

console.log(hide(obj))

outputs

{
  innerObject: {
    password: '[SECRET]',
    email: 'ben@npmjs.com',
    token: '[SECRET]'
  },
  auth: ''
}

Currently the following fields are obfuscated by default:

password, pass, token, auth, secret, passphrase.

If you want to override this list of obfuscated terms, simply:

  1. create your own list of terms:

     const badWords = [
       'super-secret-1', 'double-secret-probation'
     ]
  2. pass this as configuration to hide-secrets:

     console.log(hide(obj, {badWords}))

Any keys within obj that are contained within the badWords array will be hidden.

License

ISC

changelog

Change Log

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

2.0.0 (2019-04-17)

chore

  • update dependencies addressing vulnerabilities (c15a8a5)

BREAKING CHANGES

  • this module hasn't been updated since the beginning of time