Skip to content

Sodium signatures #203

Open
Open
@emilbayes

Description

@emilbayes

Hi! The readme specifically mentions that sodium signatures will not work with BEP44, however I've done some research for my rendezvous-point module and this is not true. ed25519-supercop is based on ref10 and so is sodium. The difference is in the private key encoding, but one can convert to supercop keys if need be: https://github.com/emilbayes/sodium2supercop

However, the secret key is not exposed or used beyond generating signatures and as such any implementation can be used, as long as they generate valid EdDSA signatures. I'm happy to make amends to the readme, I just want to make sure to what extent :) I have a verification script here if anyone is interested: https://gist.github.com/emilbayes/66c955cc49da387ee2ab9c3a76aa9238

The examples would look something like the following, using @mafintosh high-level sodium-signatures module. Straight up sodium-native/sodium-universal could also be used with a bit more boilerplate:

var eddsa = require('sodium-signatures')
var dht = new DHT({ verify: eddsa.verify })
var eddsa = require('sodium-signatures')
var keypair = eddsa.keyPair()

var value = Buffer.alloc(200).fill('whatever') // the payload you want to send
var opts = {
  k: keypair.publicKey,
  seq: 0,
  v: value,
  sign: function (buf) {
    return eddsa.sign(buf, keypair.secretKey)
  }
}

var DHT = require('bittorrent-dht')
var dht = new DHT

dht.put(opts, function (err, hash) {
  console.error('error=', err)
  console.log('hash=', hash)
})

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