cfx-keyring-controller
A module for managing various keyrings of Ethereum accounts, encrypting them, and using them.
Last updated 7 days ago by yqrashawn .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install cfx-keyring-controller 
SYNC missed versions from official npm registry.

Eth Keyring Controller CircleCI

A module for managing groups of Ethereum accounts called "Keyrings", defined originally for MetaMask's multiple-account-type feature.

To add new account types to a KeyringController, just make sure it follows The Keyring Class Protocol.

The KeyringController has three main responsibilities:

  • Initializing & using (signing with) groups of Ethereum accounts ("keyrings").
  • Keeping track of local nicknames for those individual accounts.
  • Providing password-encryption persisting & restoring of secret information.

Installation

npm install eth-keyring-controller --save

Usage

const KeyringController = require('eth-keyring-controller')
const SimpleKeyring = require('eth-simple-keyring')

const keyringController = new KeyringController({
  keyringTypes: [SimpleKeyring], // optional array of types to support.
  initState: initState.KeyringController, // Last emitted persisted state.
  encryptor: { // An optional object for defining encryption schemes:
               // Defaults to Browser-native SubtleCrypto.
    encrypt (password, object) {
      return new Promise('encrypted!')
    },
    decrypt (password, encryptedString) {
      return new Promise({ foo: 'bar' })
    },
  },
})

// The KeyringController is also an event emitter:
this.keyringController.on('newAccount', (address) => {
  console.log(`New account created: ${address}`)
})
this.keyringController.on('removedAccount', handleThat)

Methods

Currently the methods are heavily commented in the source code, so it's the best place to look until we aggregate it here as well.

Current Tags

  • 5.6.10                                ...           latest (7 days ago)

10 Versions

  • 5.6.10                                ...           7 days ago
  • 5.6.9                                ...           5 months ago
  • 5.6.8                                ...           5 months ago
  • 5.6.7                                ...           7 months ago
  • 5.6.6                                ...           8 months ago
  • 5.6.5                                ...           8 months ago
  • 5.6.4                                ...           8 months ago
  • 5.6.3                                ...           8 months ago
  • 5.6.1                                ...           8 months ago
  • 5.6.0                                ...           8 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 13
Last Day 0
Last Week 13
Last Month 0
Dependencies (10)
Dev Dependencies (14)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |