SHA256
1
0
forked from pool/bitwarden
bitwarden/remove-argon2-browser.patch
Bruno Pitrus 93ce5f5361 - Fix exe path in mozilla manifest (bsc#1230388)
* add main-getPath-exe.patch
- Remove bogus libdesktop_napi.so provide

OBS-URL: https://build.opensuse.org/package/show/devel:languages:nodejs/bitwarden?expand=0&rev=71
2024-09-12 15:32:51 +00:00

66 lines
2.3 KiB
Diff

Remove dependency on argon-browser2 which should be dead code after https://github.com/bitwarden/clients/commit/996823169a5134da56c0e08f6e83a01e64164774
We used to path this to use node_modules/argon2 but cannot anymore due to sandbox now being enabled; fortunately, upstream at the same time moved the crypto to main process.
Therefore the WASM implementation in web-crypto-function should be dead code now and can be removed because we do not want to compile WASM.
--- bitwarden/apps/desktop/webpack.renderer.js.old 2023-02-15 19:02:44.000000000 +0100
+++ bitwarden/apps/desktop/webpack.renderer.js 2023-02-18 18:41:53.074156675 +0100
@@ -40,11 +40,6 @@
},
type: "asset/resource",
},
- {
- test: /\.wasm$/,
- loader: "base64-loader",
- type: "javascript/auto",
- },
],
},
plugins: [],
@@ -127,11 +122,6 @@
test: /[\/\\]@angular[\/\\].+\.js$/,
parser: { system: true },
},
- {
- test: /\.wasm$/,
- loader: "base64-loader",
- type: "javascript/auto",
- },
],
},
plugins: [
--- a/libs/common/src/platform/services/web-crypto-function.service.ts
+++ b/libs/common/src/platform/services/web-crypto-function.service.ts
@@ -1,4 +1,3 @@
-import * as argon2 from "argon2-browser";
import * as forge from "node-forge";
import { Utils } from "../../platform/misc/utils";
@@ -54,24 +53,9 @@ export class WebCryptoFunctionService implements CryptoFunctionService {
memory: number,
parallelism: number,
): Promise<Uint8Array> {
- if (!this.wasmSupported) {
- throw "Webassembly support is required for the Argon2 KDF feature.";
- }
-
- const passwordArr = new Uint8Array(this.toBuf(password));
- const saltArr = new Uint8Array(this.toBuf(salt));
-
- const result = await argon2.hash({
- pass: passwordArr,
- salt: saltArr,
- time: iterations,
- mem: memory,
- parallelism: parallelism,
- hashLen: 32,
- type: argon2.ArgonType.Argon2id,
- });
- argon2.unloadRuntime();
- return result.hash;
+ const err="This should be unreachable dead code. If you're seeing this message, please report a bug to openSUSE maintainers because we must have made a mistake when patching."
+ alert(err)
+ throw err
}
async hkdf(