Skip to content

implement method createFactory() #1

@jprichardson

Description

@jprichardson

Implement a new method that returns a function that creates a CoinKey instance with specified versions. For example:

CoinKey.createFactory = function(versions) {
  return function(privateKey) {
    return new CoinKey(privateKey, versions)
  }
}

example usage:

var secureRandom = require('secure-random')
var CoinKey = require('coinkey')

var dogecoinCreator = CoinKey.createFactory({public: 0x9E: private: 0x1E})

var privateKey = secureRandom.randomBuffer(32)
var ck = dogecoinCreator(privateKey)

Any thoughts on a less Java-y name than createFactory()?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions