Skip to content
This repository has been archived by the owner on Jun 16, 2022. It is now read-only.

Commit

Permalink
chore(ark): log errors for keypair derivation
Browse files Browse the repository at this point in the history
  • Loading branch information
faustbrian committed Jan 14, 2022
1 parent a86837e commit 9e22048
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions packages/ark/source/crypto/identities/keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,22 @@ export class Keys {
public static fromPrivateKey(privateKey: Buffer | string, compressed = true): KeyPair {
privateKey = privateKey instanceof Buffer ? privateKey : Buffer.from(privateKey, "hex");

return {
compressed,
privateKey: privateKey.toString("hex"),
publicKey: secp256k1.publicKeyCreate(privateKey, compressed).toString("hex"),
};
try {
return {
compressed,
privateKey: privateKey.toString("hex"),
publicKey: secp256k1.publicKeyCreate(privateKey, compressed).toString("hex"),
};
} catch (error) {
console.error({
error,
message: error.message,
privateKeLength: privateKey.length,
privateKey,
});

throw error;
}
}

public static fromWIF(wif: string, network?: Network): KeyPair {
Expand Down

0 comments on commit 9e22048

Please sign in to comment.