bonjs-keygen

1.3.4 • Public • Published

Repository

The purpose of this library is for managing keys in local storage. This is designed to derive and cache keys but also needs a password manager to store a "root" key. This library does not have secure or password protected storage. It does however figure out permission hierarchies and is configurable enough to only store keys you feel are safe to store.

General purpose cryptography is found in bonjs-ecc library. Hierarchical deterministic key generation uses PrivateKey.getChildKey in bonjs-ecc.

Usage

let {Keystore, Keygen} = require('bonjs-keygen')
Bon = require('bonjs')

sessionConfig = {
  timeoutInMin: 30,
  uriRules: {
    'owner' : '/account_recovery',
    'active': '/(transfer|contracts)',
    'active/**': '/producers'
  }
}

keystore = Keystore('myaccount', sessionConfig)
bon = Bon.Testnet({keyProvider: keystore.keyProvider})

Keygen.generateMasterKeys().then(keys => {
  // create blockchain account called 'myaccount'
  console.log(keys)

  bon.getAccount('myaccount').then(account => {
    keystore.deriveKeys({
      parent: keys.masterPrivateKey,
      accountPermissions: account.permissions
    })
  })

})

See ./API

Development

let {Keystore, Keygen} = require('./src')

Use Node v8+ (updates package-lock.json)

Browser

git clone https://github.com/betterchainio/bonjs-keygen.git
cd bonjs-keygen
npm install
npm run build
# builds: ./dist/bonjs-keygen.js
<script src="bonjs-keygen.js"></script>
<script>
//kos.Keystore
//kos.Keygen
//...
</script>

Runtime Environment

Node 6+ and browser (browserify, webpack, etc)

Built with React Native in mind, create an issue if you find a bug.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.3.41latest

Version History

VersionDownloads (Last 7 Days)Published
1.3.41
1.3.30
1.3.20

Package Sidebar

Install

npm i bonjs-keygen

Weekly Downloads

1

Version

1.3.4

License

MIT

Unpacked Size

112 kB

Total Files

18

Last publish

Collaborators

  • zyxiao