Created
December 6, 2019 02:44
-
-
Save Leask/c9f01cda1999312e89013d286342a80c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { randomBytes } = require('crypto') | |
const secp256k1 = require('secp256k1') | |
// or require('secp256k1/elliptic') | |
// if you want to use pure js implementation in node | |
// generate message to sign | |
const msg = randomBytes(32) | |
// generate privKey | |
let privKey | |
do { | |
privKey = randomBytes(32) | |
} while (!secp256k1.privateKeyVerify(privKey)) | |
// output | |
console.log(privKey.toString('hex')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment