You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
11 lines
329 B
11 lines
329 B
const sodium = require('sodium-universal')
|
|
|
|
module.exports = function createKeyPair (seed) {
|
|
const publicKey = Buffer.alloc(32)
|
|
const secretKey = Buffer.alloc(32)
|
|
|
|
if (seed) sodium.crypto_kx_seed_keypair(publicKey, secretKey, seed)
|
|
else sodium.crypto_kx_keypair(publicKey, secretKey)
|
|
|
|
return { publicKey, secretKey }
|
|
}
|
|
|