Skip to content

Commit

Permalink
feat: create random private key with optional entropy
Browse files Browse the repository at this point in the history
  • Loading branch information
yknl committed Sep 28, 2020
1 parent f701fe2 commit dc192d4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/transactions/src/keys.ts
Expand Up @@ -136,9 +136,9 @@ export function createStacksPrivateKey(key: string | Buffer): StacksPrivateKey {
return { data, compressed };
}

export function makeRandomPrivKey(): StacksPrivateKey {
export function makeRandomPrivKey(entropy?: Buffer): StacksPrivateKey {
const ec = new EC('secp256k1');
const options = { entropy: randomBytes(32) };
const options = { entropy: entropy || randomBytes(32) };
const keyPair = ec.genKeyPair(options);
const privateKey = keyPair.getPrivate().toString('hex', 32);
return createStacksPrivateKey(privateKey);
Expand Down

0 comments on commit dc192d4

Please sign in to comment.