Skip to content

Commit

Permalink
fix: improve type definitions for Buffer and Uint8Array
Browse files Browse the repository at this point in the history
  • Loading branch information
1 parent 68638b4 commit 25106fe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 2 additions & 5 deletions packages/helpers/src/lib/mailauth/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,13 @@ const keyOrderingDKIM = ['v', 'a', 'c', 'd', 'h', 'i', 'l', 'q', 's', 't', 'x',

export const writeToStream = async (
stream: DkimVerifier,
input: Buffer & { pipe: (...args: any) => void; on: (...args: any) => void },
input: Buffer & NodeJS.ReadableStream,
chunkSize: number = 0,
) => {
chunkSize = chunkSize || 64 * 1024;

if (typeof input === 'string') {
input = Buffer.from(input) as Buffer & {
pipe: (...args: any) => void;
on: (...args: any) => void;
};
input = Buffer.from(input) as Buffer & NodeJS.ReadableStream;
}

return new Promise((resolve, reject) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/helpers/src/sha-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function findIndexInUint8Array(array: Uint8Array, selector: Uint8Array):
return -1;
}

export function padUint8ArrayWithZeros(array: Uint8Array, length: number) {
export function padUint8ArrayWithZeros(array: Uint8Array, length: number): Uint8Array {
while (array.length < length) {
// eslint-disable-next-line no-param-reassign
array = mergeUInt8Arrays(array, int8toBytes(0));
Expand Down

0 comments on commit 25106fe

Please sign in to comment.