Skip to content

Commit

Permalink
updated dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
antelle committed Sep 6, 2021
1 parent f071f8f commit 9b86a03
Show file tree
Hide file tree
Showing 7 changed files with 827 additions and 640 deletions.
8 changes: 6 additions & 2 deletions lib/crypto/crypto-engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,17 @@ class AesCbcSubtle extends AesCbc {
}

encrypt(data: ArrayBuffer, iv: ArrayBuffer): Promise<ArrayBuffer> {
return global.crypto.subtle.encrypt({ name: 'AES-CBC', iv }, this.key, data);
return global.crypto.subtle.encrypt(
{ name: 'AES-CBC', iv },
this.key,
data
) as Promise<ArrayBuffer>;
}

decrypt(data: ArrayBuffer, iv: ArrayBuffer): Promise<ArrayBuffer> {
return global.crypto.subtle.decrypt({ name: 'AES-CBC', iv }, this.key, data).catch(() => {
throw new KdbxError(ErrorCodes.InvalidKey, 'invalid key');
});
}) as Promise<ArrayBuffer>;
}
}

Expand Down
1,392 changes: 786 additions & 606 deletions package-lock.json

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kdbxweb",
"version": "2.1.0",
"version": "2.1.1",
"description": "Kdbx KeePass database reader for web",
"repository": {
"type": "git",
Expand Down Expand Up @@ -35,38 +35,38 @@
"license": "MIT",
"devDependencies": {
"@istanbuljs/nyc-config-typescript": "^1.0.1",
"@nodelib/fs.walk": "^1.2.7",
"@nodelib/fs.walk": "^1.2.8",
"@types/expect.js": "^0.3.29",
"@types/mocha": "^8.2.2",
"@types/mocha": "^9.0.0",
"@types/terser-webpack-plugin": "^5.0.3",
"@typescript-eslint/eslint-plugin": "^4.27.0",
"@typescript-eslint/parser": "^4.27.0",
"@typescript-eslint/eslint-plugin": "^4.31.0",
"@typescript-eslint/parser": "^4.31.0",
"base64-loader": "^1.0.0",
"eslint": "^7.28.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-config-standard": "^16.0.3",
"eslint-plugin-import": "^2.23.4",
"eslint-plugin-import": "^2.24.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-promise": "^5.1.0",
"eslint-plugin-standard": "^4.1.0",
"expect.js": "^0.3.1",
"exports-loader": "^3.0.0",
"mocha": "^9.0.0",
"mocha": "^9.1.1",
"nyc": "^15.1.0",
"prettier": "^2.3.1",
"prettier": "^2.3.2",
"rimraf": "^3.0.2",
"source-map-support": "^0.5.19",
"stats-webpack-plugin": "^0.7.0",
"terser-webpack-plugin": "^5.1.3",
"ts-loader": "^9.2.3",
"ts-node": "^10.0.0",
"typescript": "^4.3.4",
"webpack": "^5.39.1",
"webpack-cli": "^4.7.2"
"terser-webpack-plugin": "^5.2.3",
"ts-loader": "^9.2.5",
"ts-node": "^10.2.1",
"typescript": "^4.4.2",
"webpack": "^5.52.0",
"webpack-cli": "^4.8.0"
},
"dependencies": {
"@xmldom/xmldom": "^0.7.3",
"@xmldom/xmldom": "^0.7.4",
"fflate": "^0.7.1"
},
"funding": {
Expand Down
3 changes: 3 additions & 0 deletions release-notes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Release notes
-------------
##### v2.1.1 (2021-09-06)
`-` updated dependencies

##### v2.1.0 (2021-06-17)
`-` replaced `pako` with `fflate` to reduce bundle size

Expand Down
4 changes: 2 additions & 2 deletions test/crypto/crypto-engine.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ describe('CryptoEngine', () => {
try {
await aes.encrypt(new ArrayBuffer(0), new ArrayBuffer(0));
} catch (e) {
expect(e.message).to.contain('no key');
expect((e as Error).message).to.contain('no key');
return;
}
throw new Error('Not expected');
Expand Down Expand Up @@ -232,7 +232,7 @@ describe('CryptoEngine', () => {
try {
await aes.encrypt(new ArrayBuffer(0), new ArrayBuffer(0));
} catch (e) {
expect(e.message).to.contain('no key');
expect((e as Error).message).to.contain('no key');
return;
}
throw new Error('Not expected');
Expand Down
24 changes: 12 additions & 12 deletions test/format/kdbx-credentials.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ describe('KdbxCredentials', () => {
await cred.getHash();
} catch (e) {
expect(e).to.be.a(KdbxError);
expect(e.code).to.be(Consts.ErrorCodes.InvalidArg);
expect(e.message).to.contain('key file without meta');
expect((e as KdbxError).code).to.be(Consts.ErrorCodes.InvalidArg);
expect((e as KdbxError).message).to.contain('key file without meta');
return;
}
expect().fail();
Expand All @@ -119,8 +119,8 @@ describe('KdbxCredentials', () => {
await cred.getHash();
} catch (e) {
expect(e).to.be.a(KdbxError);
expect(e.code).to.be(Consts.ErrorCodes.InvalidArg);
expect(e.message).to.contain('key file without version');
expect((e as KdbxError).code).to.be(Consts.ErrorCodes.InvalidArg);
expect((e as KdbxError).message).to.contain('key file without version');
return;
}
expect().fail();
Expand All @@ -135,8 +135,8 @@ describe('KdbxCredentials', () => {
await cred.getHash();
} catch (e) {
expect(e).to.be.a(KdbxError);
expect(e.code).to.be(Consts.ErrorCodes.FileCorrupt);
expect(e.message).to.contain('bad keyfile version');
expect((e as KdbxError).code).to.be(Consts.ErrorCodes.FileCorrupt);
expect((e as KdbxError).message).to.contain('bad keyfile version');
return;
}
expect().fail();
Expand All @@ -151,8 +151,8 @@ describe('KdbxCredentials', () => {
await cred.getHash();
} catch (e) {
expect(e).to.be.a(KdbxError);
expect(e.code).to.be(Consts.ErrorCodes.InvalidArg);
expect(e.message).to.contain('key file without key');
expect((e as KdbxError).code).to.be(Consts.ErrorCodes.InvalidArg);
expect((e as KdbxError).message).to.contain('key file without key');
return;
}
expect().fail();
Expand All @@ -167,8 +167,8 @@ describe('KdbxCredentials', () => {
await cred.getHash();
} catch (e) {
expect(e).to.be.a(KdbxError);
expect(e.code).to.be(Consts.ErrorCodes.InvalidArg);
expect(e.message).to.contain('key file without key data');
expect((e as KdbxError).code).to.be(Consts.ErrorCodes.InvalidArg);
expect((e as KdbxError).message).to.contain('key file without key data');
return;
}
expect().fail();
Expand Down Expand Up @@ -205,8 +205,8 @@ describe('KdbxCredentials', () => {
await cred.getHash();
} catch (e) {
expect(e).to.be.a(KdbxError);
expect(e.code).to.be(Consts.ErrorCodes.FileCorrupt);
expect(e.message).to.contain('key file data hash mismatch');
expect((e as KdbxError).code).to.be(Consts.ErrorCodes.FileCorrupt);
expect((e as KdbxError).message).to.contain('key file data hash mismatch');
return;
}
expect().fail();
Expand Down
2 changes: 1 addition & 1 deletion test/format/kdbx-uuid.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('KdbxUuid', () => {
const uuid = new KdbxUuid(new Uint16Array([123]).buffer);
throw new Error(`Expected an error to be thrown, got UUID instead: ${uuid}`);
} catch (e) {
expect(e.message).to.contain('FileCorrupt: bad UUID length: 2');
expect((e as Error).message).to.contain('FileCorrupt: bad UUID length: 2');
}
});

Expand Down

0 comments on commit 9b86a03

Please sign in to comment.