Skip to content
This repository has been archived by the owner on Apr 9, 2021. It is now read-only.

Commit

Permalink
Merge #116
Browse files Browse the repository at this point in the history
116: Stops using Buffer in parseKeyPair() r=George-cl a=George-cl

#

Co-authored-by: George-CL <george@casperlabs.io>
  • Loading branch information
bors[bot] and George-cl authored Feb 22, 2021
2 parents 8e32e2d + 8eb0ff5 commit 4491e80
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions packages/sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to casper-client-sdk.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 1.0.23

### Changed
- Removes use of `Buffer` in `parseKeyPair()` and instead creates new `Uint8Array` concatenating public and private keys for use as secret key in Ed25519 key pair.
## 1.0.22

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "casper-client-sdk",
"version": "1.0.22",
"version": "1.0.23",
"license": "Apache 2.0",
"description": "SDK to interact with the Casper blockchain",
"main": "dist/index.js",
Expand Down
5 changes: 4 additions & 1 deletion packages/sdk/src/lib/Keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,12 @@ export class Ed25519 extends AsymmetricKey {
const publ = Ed25519.parsePublicKey(publicKey);
const priv = Ed25519.parsePrivateKey(privateKey);
// nacl expects that the private key will contain both.
const secr = new Uint8Array(publ.length + priv.length);
secr.set(priv);
secr.set(publ, priv.length);
return new Ed25519({
publicKey: publ,
secretKey: Buffer.concat([priv, publ])
secretKey: secr
});
}

Expand Down

0 comments on commit 4491e80

Please sign in to comment.