Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/bls/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"benchmark": "node -r ./.babel-register test/benchmarks"
},
"dependencies": {
"@chainsafe/bls-keygen": "^0.0.2",
"@chainsafe/eth2-bls-wasm": "^0.2.0",
"@chainsafe/eth2.0-types": "^0.2.0",
"assert": "^1.4.1",
Expand Down
7 changes: 3 additions & 4 deletions packages/bls/src/privateKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {SECRET_KEY_LENGTH} from "./constants";
import assert from "assert";
import {BLSSecretKey, Domain, bytes32} from "@chainsafe/eth2.0-types";
import {SecretKeyType} from "@chainsafe/eth2-bls-wasm";
import {generateRandomSecretKey} from "@chainsafe/bls-keygen";
import {getContext} from "./context";
import {PublicKey} from "./publicKey";
import {Signature} from "./signature";
Expand Down Expand Up @@ -38,10 +39,8 @@ export class PrivateKey {
}

public static random(): PrivateKey {
const context = getContext();
const secretKey = new context.SecretKey();
secretKey.setByCSPRNG();
return new PrivateKey(secretKey);
const randomKey: Buffer = generateRandomSecretKey();
return this.fromBytes(randomKey);
}

public getValue(): SecretKeyType {
Expand Down
Loading