Skip to content

Commit

Permalink
fix encryptFileAndZipWithMetadata node (#246)
Browse files Browse the repository at this point in the history
  • Loading branch information
vmc-crossmint authored Nov 16, 2023
1 parent 6b9ace2 commit af53b65
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion packages/encryption/src/lib/encryption.ts
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,12 @@ export const encryptFileAndZipWithMetadata = async (

folder.file(file.name, uint8arrayFromString(ciphertext, 'base64'));

const zipBlob = await zip.generateAsync({ type: 'blob' });
let zipBlob;
if (isBrowser()) {
zipBlob = await zip.generateAsync({ type: 'blob' });
} else {
zipBlob = await zip.generateAsync({ type: 'nodebuffer' });
}

return zipBlob;
};
Expand Down
2 changes: 1 addition & 1 deletion packages/encryption/src/lib/params-validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ class FileValidator implements ParamsValidator {
if (
!checkType({
value: this.file,
allowedTypes: ['Blob', 'File'],
allowedTypes: ['Blob', 'File', 'Uint8Array'],
paramName: 'file',
functionName: this.fnName,
})
Expand Down

0 comments on commit af53b65

Please sign in to comment.