GithubHelp home page GithubHelp logo

isabella232 / keyringcontroller Goto Github PK

View Code? Open in Web Editor NEW

This project forked from brave/keyringcontroller

0.0 0.0 0.0 537 KB

A module for managing groups of Ethereum accounts and using them.

JavaScript 100.00%

keyringcontroller's Introduction

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.

keyringcontroller's People

Contributors

alextsg avatar bbondy avatar bitpshr avatar brunobar79 avatar cg505 avatar chikeichan avatar cshung1994 avatar danfinlay avatar danjm avatar diracdeltas avatar frankiebee avatar gudahtt avatar kumavis avatar logvik avatar rekmarks avatar ryanml avatar silto avatar ukstv avatar whymarrh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.