secure-string

1.2.1 • Public • Published

secure-string

Travis build status Coverage Status npm version semantic-release

Text that should be kept confidential

The change log is automatically produced with the help of semantic-release.

Features

  • The text is stored in an encrypted buffer
  • The plain text is only available in a callback
  • Prompting the user for a secure string

Getting started

secure-string is available for Node.js and the browser. Most modern browsers are supported. If you want to know if your browser is compatible, run the online test suite.

Install with npm

> npm install secure-string --save

Usage

const SecureString = require('secure-string')
 
const password = new SecureString()
password.appendCodePoint(0x41)
password.value(plainText => {
  console.log('the passowrd is', plainText.toString())
})

See the spec for more examples.

Ask

SecureString.ask prompts the user for some data

const SecureString = require('secure-string')
 
SecureString.ask('password', (err, answer) => {
  if (err) return console.log(err)
  answer.value(plainText => {
    console.log('the passowrd is', plainText.toString())
  })
})

Browser

Include the package from the unpkg CDN

<script src="https://unpkg.com/secure-string/dist/bundle.min"></script>

This creates SecureString as a global object, or define it if you are using AMD.

License

The MIT license.

Copyright © 2017 Richard Schneider (makaretu@gmail.com)

Readme

Keywords

none

Package Sidebar

Install

npm i secure-string

Weekly Downloads

227

Version

1.2.1

License

MIT

Last publish

Collaborators

  • makaretu