git ssb

1+

Dominic / ssb-keys



Tree: 636ed354c6f8428f86e8fe9aa7ba2796ca043152

Files: 636ed354c6f8428f86e8fe9aa7ba2796ca043152 / README.md

1016 bytesRaw

SSB-Keys

A common module for secure-scuttlebutt projects, provides an API to create or load elliptic-curve keypairs and to execute related crypto operations.

var ssbkeys = require('ssb-keys')

ssbkeys.create(path, function(err, k) {
  console.log(k) /* => {
    id: String,
    public: String,
    private: String
  }*/
})

ssbkeys.load(path, function(err, k) {
  console.log(k) /* => {
    id: String,
    public: String,
    private: String
  }*/
})

var k = ssbkeys.createSync(path)
console.log(k) /* => {
  id: String,
  public: String,
  private: String
}*/

var k = ssbkeys.loadSync(path)
console.log(k) /* => {
  id: String,
  public: String,
  private: String
}*/

var k = ssbkeys.generate()
console.log(k) /* => {
  id: String,
  public: String,
  private: String
}*/

var hash = ssbkeys.hash(new Buffer('deadbeef', 'hex'))
ssbkeys.isHash(hash) // => true

var sig = ssbkeys.sign(k, hash)
ssbkeys.verify(k.public, sig, hash)

ssbkeys.hmac(new Buffer('deadbeef', 'hex'), k.private) // => String

Built with git-ssb-web