Skip to content

Commit

Permalink
Merge pull request #1298 from LimeChain/from-random-fix
Browse files Browse the repository at this point in the history
KeyPairEd25519.fromRandom() fix
  • Loading branch information
gtsonevv authored Feb 23, 2024
2 parents bdaed65 + c465557 commit 3d8c2f5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/silly-queens-dream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@near-js/crypto": patch
---

Pass Uint8Array to getPublicKey method.
2 changes: 1 addition & 1 deletion packages/crypto/src/key_pair_ed25519.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class KeyPairEd25519 extends KeyPairBase {
*/
static fromRandom() {
const secretKey = randombytes(KeySize.SECRET_KEY);
const publicKey = ed25519.getPublicKey(secretKey);
const publicKey = ed25519.getPublicKey(new Uint8Array(secretKey));
const extendedSecretKey = new Uint8Array([...secretKey, ...publicKey]);
return new KeyPairEd25519(baseEncode(extendedSecretKey));
}
Expand Down

0 comments on commit 3d8c2f5

Please sign in to comment.