From 6f02c65b3b23190dc64908962cabcacaab659ef8 Mon Sep 17 00:00:00 2001 From: George-CL Date: Fri, 19 Feb 2021 15:29:31 +0000 Subject: [PATCH 1/3] Coerces Uint8Arrays into Buffers for concat method --- packages/sdk/src/lib/Keys.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sdk/src/lib/Keys.ts b/packages/sdk/src/lib/Keys.ts index 184fe098..b09ffb88 100644 --- a/packages/sdk/src/lib/Keys.ts +++ b/packages/sdk/src/lib/Keys.ts @@ -186,7 +186,7 @@ export class Ed25519 extends AsymmetricKey { // nacl expects that the private key will contain both. return new Ed25519({ publicKey: publ, - secretKey: Buffer.concat([priv, publ]) + secretKey: Buffer.concat([Buffer.from(priv), Buffer.from(publ)]) }); } From ab72c27a6a24f25df57364feff2f9d081bcd94ed Mon Sep 17 00:00:00 2001 From: George-CL Date: Fri, 19 Feb 2021 15:49:05 +0000 Subject: [PATCH 2/3] Constructs new Uint8Array instead --- packages/sdk/src/lib/Keys.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/sdk/src/lib/Keys.ts b/packages/sdk/src/lib/Keys.ts index b09ffb88..49a225cc 100644 --- a/packages/sdk/src/lib/Keys.ts +++ b/packages/sdk/src/lib/Keys.ts @@ -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([Buffer.from(priv), Buffer.from(publ)]) + secretKey: secr }); } From 8eb0ff52c61e9e69ceb3eba3d46c5f4e81c3d887 Mon Sep 17 00:00:00 2001 From: George-CL Date: Fri, 19 Feb 2021 15:58:11 +0000 Subject: [PATCH 3/3] Bumps version to 1.0.23 and updates Changelog --- packages/sdk/CHANGELOG.md | 4 ++++ packages/sdk/package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/sdk/CHANGELOG.md b/packages/sdk/CHANGELOG.md index af994246..10bbca1d 100644 --- a/packages/sdk/CHANGELOG.md +++ b/packages/sdk/CHANGELOG.md @@ -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 diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 5b4b1572..6e2881f5 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -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",