Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Ansonhkg committed Apr 30, 2024
1 parent 65e5f21 commit ffa6555
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
*/
export const normalizeArray = (toSign: ArrayLike<number>) => {
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;
};

0 comments on commit ffa6555

Please sign in to comment.