Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Build the encryption info buffer
const encryptionInfoBuffer = this._buildEncryptionInfo(encryptionInfo);
// Create a new CFB
let output = cfb.utils.cfb_new();
// Add the encryption info and encrypted package
cfb.utils.cfb_add(output, "EncryptionInfo", encryptionInfoBuffer);
cfb.utils.cfb_add(output, "EncryptedPackage", encryptedPackage);
// Delete the SheetJS entry that is added at initialization
cfb.utils.cfb_del(output, "\u0001Sh33tJ5");
// Write to a buffer and return
output = cfb.write(output);
// The cfb library writes to a Uint8array in the browser. Convert to a Buffer.
if (!Buffer.isBuffer(output)) output = Buffer.from(output);
return output;
}