From bcbc6884619fdc65365eaea3006667c5afa580b8 Mon Sep 17 00:00:00 2001 From: Joni Hayes <40481310+jonigirl@users.noreply.github.com> Date: Sat, 26 Jan 2019 20:33:49 +1000 Subject: [PATCH 1/2] fix invalid sequence disable Update with Netuoso 267 fix invalid sequence disable. see steem.js PR #267 --- src/auth/ecc/src/key_public.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/auth/ecc/src/key_public.js b/src/auth/ecc/src/key_public.js index 8e7701e1..b3501274 100644 --- a/src/auth/ecc/src/key_public.js +++ b/src/auth/ecc/src/key_public.js @@ -22,10 +22,20 @@ class PublicKey { } static fromBuffer(buffer) { + if ( + buffer.toString("hex") === + "000000000000000000000000000000000000000000000000000000000000000000" + ) + return new PublicKey(null); return new PublicKey(ecurve.Point.decodeFrom(secp256k1, buffer)); } - toBuffer(compressed = this.Q.compressed) { + toBuffer(compressed = this.Q ? this.Q.compressed : null) { + if (this.Q === null) + return Buffer.from( + "000000000000000000000000000000000000000000000000000000000000000000", + "hex" + ); return this.Q.getEncoded(compressed); } From 97a1908f3b42f9564f73d48af6057ea28f43bcb2 Mon Sep 17 00:00:00 2001 From: Joni Hayes <40481310+jonigirl@users.noreply.github.com> Date: Sat, 26 Jan 2019 21:01:08 +1000 Subject: [PATCH 2/2] Update KeyFormats.js Changes with respect to Update with Netuoso 267 fix invalid sequence disable. --- test/KeyFormats.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/test/KeyFormats.js b/test/KeyFormats.js index 6d5acc5a..48adb51d 100644 --- a/test/KeyFormats.js +++ b/test/KeyFormats.js @@ -69,6 +69,16 @@ const test = function (key) { const address = Address.fromPublic(public_key, true, 56); assert.equal(key.Compressed_PTS, address.toString()); }); + + it("null hex to pubkey", function() { + const public_key = PublicKey.fromHex(key.null_hex); + assert.equal(key.null_address, public_key.toPublicKeyString()); + }); + + it("null pubkey to hex", function() { + const public_key = PublicKey.fromString(key.null_address); + assert.equal(key.null_hex, public_key.toHex()); + }); }); }; @@ -86,5 +96,8 @@ test({ Uncompressed_BTC: 'SCRLAFmEtM8as1mbmjVcj5dphLdPguXquimn', Compressed_BTC: 'SCRANNTSEaUviJgWLzJBersPmyFZBY4jJETY', Uncompressed_PTS: 'SCREgj7RM6FBwSoccGaESJLC3Mi18785bM3T', - Compressed_PTS: 'SCRD5rYtofD6D4UHJH6mo953P5wpBfMhdMEi' + Compressed_PTS: "SCRD5rYtofD6D4UHJH6mo953P5wpBfMhdMEi", + // https://github.com/steemit/steem-js/issues/267 + null_hex: "000000000000000000000000000000000000000000000000000000000000000000", + null_address: "SCR1111111111111111111111111111111114T1Anm" });