From f4ec9348598ee07e974208d6b18b8dfecad511eb Mon Sep 17 00:00:00 2001 From: benthecarman <15256660+benthecarman@users.noreply.github.com> Date: Sat, 27 Apr 2024 21:33:55 -0500 Subject: [PATCH] Fix error with odd length hex check (#79) --- .changeset/hot-lies-happen.md | 5 +++++ packages/caravan-bitcoin/src/utils.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/hot-lies-happen.md diff --git a/.changeset/hot-lies-happen.md b/.changeset/hot-lies-happen.md new file mode 100644 index 00000000..449a3d25 --- /dev/null +++ b/.changeset/hot-lies-happen.md @@ -0,0 +1,5 @@ +--- +"@caravan/bitcoin": minor +--- + +Fixed bug with detecting odd length string diff --git a/packages/caravan-bitcoin/src/utils.ts b/packages/caravan-bitcoin/src/utils.ts index c80fb016..e7164839 100644 --- a/packages/caravan-bitcoin/src/utils.ts +++ b/packages/caravan-bitcoin/src/utils.ts @@ -46,7 +46,7 @@ export function validBase64(inputString: string) { * considered invalid (because of the` `x`). */ export function validateHex(inputString: string) { - if (inputString.length % 2) { + if (inputString.length % 2 !== 0) { return "Invalid hex: odd-length string."; } if (!VALID_HEX_REGEX.test(inputString)) {