Socket
Socket
Sign inDemoInstall

officecrypto-tool

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

officecrypto-tool - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

6

index.js

@@ -22,3 +22,3 @@ /* eslint-disable valid-jsdoc */

// This is an ArrayBuffer in the browser. Convert to a Buffer.
if (ArrayBuffer.isView(input)) {
if (ArrayBuffer.isView(input) || input instanceof ArrayBuffer) {
input = Buffer.from(input);

@@ -100,3 +100,3 @@ } else {

// This is an ArrayBuffer in the browser. Convert to a Buffer.
if (ArrayBuffer.isView(input)) {
if (ArrayBuffer.isView(input) || input instanceof ArrayBuffer) {
input = Buffer.from(input);

@@ -132,3 +132,3 @@ } else {

// This is an ArrayBuffer in the browser. Convert to a Buffer.
if (ArrayBuffer.isView(input)) {
if (ArrayBuffer.isView(input) || input instanceof ArrayBuffer) {
input = Buffer.from(input);

@@ -135,0 +135,0 @@ } else {

@@ -200,2 +200,1 @@ /* eslint-disable linebreak-style */

};
{
"name": "officecrypto-tool",
"version": "0.0.8",
"version": "0.0.9",
"description": "officeCrypto is a library for node.js that can be used to decrypt and encrypt excel files.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -20,2 +20,26 @@

});
it('agile decrypt, input is ArrayBuffer', async () => {
try {
const input = await fs.readFile(`${filePath}/agile_pass_test.xlsx`);
const arrayBuffer = input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength);
const output = await officeCrypto.decrypt(arrayBuffer, {password: '123456'});
await fs.writeFile(`${filePath}/agile_out_success.xlsx`, output);
expect(200).toEqual(200);
} catch (error) {
throw error;
}
});
it('agile decrypt, input is TypeBuffer', async () => {
try {
const input = await fs.readFile(`${filePath}/agile_pass_test.xlsx`);
const typeBuffer = new Uint8Array(input);
const output = await officeCrypto.decrypt(typeBuffer, {password: '123456'});
await fs.writeFile(`${filePath}/agile_out_success.xlsx`, output);
expect(200).toEqual(200);
} catch (error) {
throw error;
}
});
});

@@ -17,2 +17,18 @@

it('encrypt success, input is ArrayBuffer', async () => {
const input = await fs.readFile(`${filePath}/agile_input_test.xlsx`);
const arrayBuffer = input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength);
const output = officeCrypto.encrypt(arrayBuffer, {password: '123456'});
await fs.writeFile(`${filePath}/agile_pass_out_success_arraybuffer.xlsx`, output);
// expect(200).toEqual(200);
});
it('encrypt success, input is TypeBuffer', async () => {
const input = await fs.readFile(`${filePath}/agile_input_test.xlsx`);
const typeBuffer = new Uint8Array(input);
const output = officeCrypto.encrypt(typeBuffer, {password: '123456'});
await fs.writeFile(`${filePath}/agile_pass_out_success_typeBuffer.xlsx`, output);
// expect(200).toEqual(200);
});
it('encrypt failure. The password length is 256, The maximum password length is 255', async () => {

@@ -19,0 +35,0 @@ const test = function test() {

@@ -17,2 +17,16 @@

it('ecma376_agile: The file is encrypted. Input is ArrayBuffer', async () => {
const input = await fs.readFile(`${decryptFilePath}/agile_pass_test.xlsx`);
const arrayBuffer = input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength);
const isEncrypted = officeCrypto.isEncrypted(arrayBuffer);
expect(isEncrypted).toEqual(true);
});
it('ecma376_agile: The file is encrypted. Input is TypeBuffer', async () => {
const input = await fs.readFile(`${decryptFilePath}/agile_pass_test.xlsx`);
const typeBuffer = new Uint8Array(input);
const isEncrypted = officeCrypto.isEncrypted(typeBuffer);
expect(isEncrypted).toEqual(true);
});
it('ecma376_agile: The file is not encrypted.', async () => {

@@ -19,0 +33,0 @@ const input = await fs.readFile(`${encryptFilePath}/agile_input_test.xlsx`);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc