Skip to content

Commit

Permalink
fix: resolve Buffer and Uint8Array type compatibility issues
Browse files Browse the repository at this point in the history
  • Loading branch information
1 parent 25106fe commit b9c550b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/helpers/src/lib/mailauth/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const writeToStream = async (
chunkSize = chunkSize || 64 * 1024;

if (typeof input === 'string') {
input = Buffer.from(input) as Buffer & NodeJS.ReadableStream;
input = Buffer.from(input) as unknown as Buffer & NodeJS.ReadableStream;
}

return new Promise((resolve, reject) => {
Expand Down
8 changes: 3 additions & 5 deletions packages/helpers/src/sha-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@ export function findIndexInUint8Array(array: Uint8Array, selector: Uint8Array):
}

export function padUint8ArrayWithZeros(array: Uint8Array, length: number): Uint8Array {
while (array.length < length) {
// eslint-disable-next-line no-param-reassign
array = mergeUInt8Arrays(array, int8toBytes(0));
}
return array;
const result = new Uint8Array(Math.max(array.length, length));
result.set(array);
return result;
}

export function generatePartialSHA({
Expand Down

0 comments on commit b9c550b

Please sign in to comment.