Skip to content

Commit

Permalink
Merge pull request #121 from niooss-ledger/fix-buffer-from
Browse files Browse the repository at this point in the history
Fix Buffer.from usage with hexadecimal strings
  • Loading branch information
chaitanyapotti authored Sep 28, 2023
2 parents 126ca8f + df83b29 commit 2e08390
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Point.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Point {
encode(enc: string): Buffer {
switch (enc) {
case "arr":
return Buffer.concat([Buffer.from("0x04", "hex"), Buffer.from(this.x.toString("hex"), "hex"), Buffer.from(this.y.toString("hex"), "hex")]);
return Buffer.concat([Buffer.from("04", "hex"), Buffer.from(this.x.toString("hex"), "hex"), Buffer.from(this.y.toString("hex"), "hex")]);
case "elliptic-compressed": {
const key = this.ecCurve.keyFromPublic({ x: this.x.toString("hex", 64), y: this.y.toString("hex", 64) }, "hex");
return Buffer.from(key.getPublic(true, "hex"));
Expand Down

0 comments on commit 2e08390

Please sign in to comment.