Giter Site home page Giter Site logo

updated dht_store method signatures about gittorrent HOT 2 OPEN

cjb avatar cjb commented on July 21, 2024
updated dht_store method signatures

from gittorrent.

Comments (2)

cjb avatar cjb commented on July 21, 2024

@substack Thanks, I'll take a look. I'm using ed25519 via the elliptic module, which provides utility functions such as creating a keypair object from text:

  var key = JSON.parse(fs.readFileSync(config.key).toString())
  return ed25519.keyPair({
    priv: key.priv,
    privEnc: 'hex',
    pub: key.pub,
    pubEnc: 'hex'
  })

Is that possible with ed25519-supercop too?

from gittorrent.

 avatar commented on July 21, 2024

Instead of a keypair object, you get the buffers directly that you can pass to signing functions:

generate.js:

var ed = require('ed25519-supercop')
var kp = ed.createKeyPair(ed.createSeed())
console.log(JSON.stringify({
  secretKey: kp.secretKey.toString('hex'),
  publicKey: kp.publicKey.toString('hex')
}))

sign.js:

var ed = require('../')
var path = require('path')
var concat = require('concat-stream')
var kp = require(path.resolve(process.argv[2]))

process.stdin.pipe(concat(function (body) {
  var sig = ed.sign(body, kp.publicKey, kp.secretKey)
  console.log(sig.toString('hex'))
}))
$ node generate.js > keys.json
$ echo wow | node sign.js keys.json
d5b606ace3228afe5fbd63b03ce2f569999f32557b0c7cf5cad43195a43022d043de10c349c9dd7ba41f3ec1be6f205af629135566c711f933dce5937b677b0c

from gittorrent.

Related Issues (20)

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.