From ffa6555849e42d84ef8269f7789fb93993d14763 Mon Sep 17 00:00:00 2001 From: Anson Date: Tue, 30 Apr 2024 15:07:51 +0100 Subject: [PATCH] fix: https://github.com/LIT-Protocol/js-sdk/pull/444#discussion_r1584821049 --- .../src/lib/helpers/normalize-array.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/lit-node-client-nodejs/src/lib/helpers/normalize-array.ts b/packages/lit-node-client-nodejs/src/lib/helpers/normalize-array.ts index 2da12ecbe7..ba07bbd725 100644 --- a/packages/lit-node-client-nodejs/src/lib/helpers/normalize-array.ts +++ b/packages/lit-node-client-nodejs/src/lib/helpers/normalize-array.ts @@ -8,8 +8,10 @@ */ export const normalizeArray = (toSign: ArrayLike) => { const arr = []; - for (let i = 0; i < toSign.length; i++) { - arr.push((toSign as Buffer)[i]); + // Casting ArrayLike to Uint8Array for better compatibility and avoiding Node-specific types + const uint8Array = new Uint8Array(toSign); + for (let i = 0; i < uint8Array.length; i++) { + arr.push(uint8Array[i]); } return arr; };