forked from pool/bitwarden
Accepting request 1156446 from home:dziobian:gulgul-ultron:19
- New upstream release 2024.2.1 * Fix issues with clipboard under Wayland - Drop half of use-node-argon2.patch which was applied upstream and rename the rest as remove-argon2-browser.patch OBS-URL: https://build.opensuse.org/request/show/1156446 OBS-URL: https://build.opensuse.org/package/show/devel:languages:nodejs/bitwarden?expand=0&rev=48
This commit is contained in:
parent
7d335e2608
commit
a9539965c2
4
_service
4
_service
@ -2,8 +2,8 @@
|
||||
<service name="obs_scm" mode="manual">
|
||||
<param name="scm">git</param>
|
||||
<param name="url">https://github.com/bitwarden/clients.git</param>
|
||||
<param name="revision">desktop-v2024.2.0</param>
|
||||
<param name="version">2024.2.0</param>
|
||||
<param name="revision">desktop-v2024.2.1</param>
|
||||
<param name="version">2024.2.1</param>
|
||||
<param name="filename">bitwarden</param>
|
||||
<param name="exclude">bitwarden_license/*</param>
|
||||
<!-- The code in bitwarden_license MUST NOT be included in published tarballs as it is non-redistributable! -->
|
||||
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d005b75495d36831cb63857085b2d85326b083facdfbd00d0d5b5d28b04ac6eb
|
||||
size 388199950
|
3
bitwarden-2024.2.1.obscpio
Normal file
3
bitwarden-2024.2.1.obscpio
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b6729f1a209f8f6ea1fa473e9b0ba2921879e71dbae54d769e4a7fa41a2b1d7b
|
||||
size 35164685
|
@ -1,3 +1,10 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Mar 8 19:00:48 UTC 2024 - Bruno Pitrus <brunopitrus@hotmail.com>
|
||||
|
||||
- New upstream release 2024.2.1
|
||||
* Fix issues with clipboard under Wayland
|
||||
- Drop half of use-node-argon2.patch which was applied upstream and rename the rest as remove-argon2-browser.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Feb 7 20:35:34 UTC 2024 - Bruno Pitrus <brunopitrus@hotmail.com>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
name: bitwarden
|
||||
version: 2024.2.0
|
||||
mtime: 1707163990
|
||||
commit: f9f85dcb39f768bd516521ffba8b2ff74e4a70ed
|
||||
version: 2024.2.1
|
||||
mtime: 1709757071
|
||||
commit: 82998d8e515b1dab0b3891170e56bf15ffc69446
|
||||
|
@ -18,7 +18,7 @@
|
||||
#
|
||||
|
||||
Name: bitwarden
|
||||
Version: 2024.2.0
|
||||
Version: 2024.2.1
|
||||
Release: 0
|
||||
Summary: A secure and free password manager for all of your devices
|
||||
Group: Productivity/Security
|
||||
@ -55,7 +55,7 @@ Patch0: remove-unnecessary-deps.patch
|
||||
Patch1: fix-desktop-file.patch
|
||||
Patch3: do-not-install-font-privately.patch
|
||||
Patch4: desktop_native-rust-arch.patch
|
||||
Patch5: use-node-argon2.patch
|
||||
Patch5: remove-argon2-browser.patch
|
||||
Patch6: argon2-binary-path.patch
|
||||
Patch7: bug-reporting-url.patch
|
||||
Patch8: no-sourcemaps.patch
|
||||
@ -91,6 +91,7 @@ BuildRequires: cargo-auditable
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: fontpackages-devel
|
||||
BuildRequires: hicolor-icon-theme
|
||||
BuildRequires: jq
|
||||
%if 0%{?suse_version}
|
||||
BuildRequires: nodejs-packaging
|
||||
%endif
|
||||
@ -102,6 +103,7 @@ BuildRequires: zstd
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: pkgconfig(glib-2.0)
|
||||
BuildRequires: pkgconfig(libsecret-1)
|
||||
BuildRequires: pkgconfig(wayland-protocols)
|
||||
|
||||
Requires: (google-opensans-fonts or open-sans-fonts)
|
||||
Requires: nodejs-electron%{_isa}
|
||||
@ -140,6 +142,14 @@ mkdir %{_builddir}/cargo
|
||||
#Rust config
|
||||
cd apps/desktop/desktop_native
|
||||
tar --zstd -xf %SOURCE4
|
||||
rm -rf vendor/wayland-protocols/protocols
|
||||
ln -svT /usr/share/wayland-protocols vendor/wayland-protocols/protocols
|
||||
# https://blogs.gnome.org/mcatanzaro/2020/05/18/patching-vendored-rust-dependencies/
|
||||
for i in wayland-protocols; do
|
||||
pushd vendor/$i
|
||||
jq -cj '.files={}' .cargo-checksum.json >tmp && mv tmp .cargo-checksum.json && popd
|
||||
done
|
||||
|
||||
|
||||
# Make `node` and `npm` binaries refer to Electron
|
||||
%if 0%{?suse_version}
|
||||
|
@ -17,9 +17,9 @@
|
||||
mode: NODE_ENV,
|
||||
- devtool: "source-map",
|
||||
+ devtool: false,
|
||||
// TODO: Replace this with web.
|
||||
// target: "web",
|
||||
target: "electron-renderer",
|
||||
target: "web",
|
||||
node: {
|
||||
__dirname: false,
|
||||
@@ -138,7 +138,7 @@
|
||||
new AngularWebpackPlugin({
|
||||
tsConfigPath: "tsconfig.renderer.json",
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:39950e174fedf893cb2e8c71ef473d327ba8c656d35614d2327ce33a28ef2314
|
||||
size 37793725
|
||||
oid sha256:04d4668b2e7d9503b3464c1e27916ddb3175f09eddb50d64d378064784197a24
|
||||
size 35254045
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/sh -eu
|
||||
#!/bin/sh -eux
|
||||
|
||||
# dnf install curl gzip jq npm patch tar wget
|
||||
|
||||
|
65
remove-argon2-browser.patch
Normal file
65
remove-argon2-browser.patch
Normal file
@ -0,0 +1,65 @@
|
||||
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(
|
@ -4,8 +4,8 @@
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
- if (stdout !== "0.17.8") {
|
||||
- if (stdout !== versionFromPackageJSON) {
|
||||
+ if (0) {
|
||||
throw new Error(`Expected ${JSON.stringify("0.17.8")} but got ${JSON.stringify(stdout)}`);
|
||||
throw new Error(`Expected ${JSON.stringify(versionFromPackageJSON)} but got ${JSON.stringify(stdout)}`);
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
@types/semver is normally included transitively by storybook which we delete, adding it here explicitely because it is needed for build
|
||||
@types/semver and path-browserify is normally included transitively by storybook which we delete, adding it here explicitely because it is needed for build
|
||||
|
||||
--- clients/package.json.orig 2024-01-10 19:25:17.240793950 +0100
|
||||
+++ clients/package.json 2024-01-10 19:27:21.476208838 +0100
|
||||
--- clients/package.json.orig 2024-03-07 21:37:44.692428174 +0100
|
||||
+++ clients/package.json 2024-03-07 21:40:28.774422025 +0100
|
||||
@@ -13,7 +13,6 @@
|
||||
},
|
||||
"homepage": "https://bitwarden.com",
|
||||
"scripts": {
|
||||
- "prepare": "husky install",
|
||||
- "prepare": "husky",
|
||||
"lint": "eslint . --cache --cache-strategy content && prettier --check .",
|
||||
"lint:fix": "eslint . --cache --cache-strategy content --fix",
|
||||
"lint:clear": "rimraf .eslintcache",
|
||||
@ -19,27 +19,27 @@
|
||||
},
|
||||
"workspaces": [
|
||||
"apps/*",
|
||||
@@ -35,119 +34,44 @@
|
||||
@@ -35,118 +34,45 @@
|
||||
],
|
||||
"devDependencies": {
|
||||
"@angular-devkit/build-angular": "15.2.10",
|
||||
- "@angular-eslint/eslint-plugin": "15.2.1",
|
||||
- "@angular-eslint/eslint-plugin-template": "15.2.1",
|
||||
- "@angular-eslint/template-parser": "15.2.1",
|
||||
- "@angular/cli": "15.2.10",
|
||||
"@angular/compiler-cli": "15.2.10",
|
||||
- "@angular/elements": "15.2.10",
|
||||
"@angular-devkit/build-angular": "16.2.11",
|
||||
- "@angular-eslint/eslint-plugin": "16.3.1",
|
||||
- "@angular-eslint/eslint-plugin-template": "16.3.1",
|
||||
- "@angular-eslint/template-parser": "16.3.1",
|
||||
- "@angular/cli": "16.2.11",
|
||||
"@angular/compiler-cli": "16.2.12",
|
||||
- "@angular/elements": "16.2.12",
|
||||
- "@compodoc/compodoc": "1.1.23",
|
||||
- "@electron/notarize": "2.2.0",
|
||||
- "@electron/rebuild": "3.5.0",
|
||||
"@ngtools/webpack": "15.2.10",
|
||||
- "@storybook/addon-a11y": "7.6.4",
|
||||
- "@storybook/addon-actions": "7.6.4",
|
||||
- "@storybook/addon-designs": "7.0.7",
|
||||
- "@storybook/addon-essentials": "7.6.4",
|
||||
- "@storybook/addon-links": "7.6.4",
|
||||
- "@storybook/angular": "7.6.4",
|
||||
- "@storybook/addon-interactions": "7.6.4",
|
||||
- "@electron/notarize": "2.3.0",
|
||||
- "@electron/rebuild": "3.6.0",
|
||||
"@ngtools/webpack": "16.2.11",
|
||||
- "@storybook/addon-a11y": "7.6.17",
|
||||
- "@storybook/addon-actions": "7.6.17",
|
||||
- "@storybook/addon-designs": "7.0.9",
|
||||
- "@storybook/addon-essentials": "7.6.17",
|
||||
- "@storybook/addon-interactions": "7.6.17",
|
||||
- "@storybook/addon-links": "7.6.17",
|
||||
- "@storybook/angular": "7.6.17",
|
||||
- "@storybook/jest": "0.2.3",
|
||||
- "@storybook/testing-library": "0.2.2",
|
||||
- "@types/argon2-browser": "1.18.1",
|
||||
@ -47,7 +47,7 @@
|
||||
"@types/duo_web_sdk": "2.7.1",
|
||||
- "@types/firefox-webext-browser": "111.0.1",
|
||||
- "@types/inquirer": "8.2.6",
|
||||
"@types/jest": "29.5.11",
|
||||
"@types/jest": "29.5.12",
|
||||
- "@types/jquery": "3.5.29",
|
||||
- "@types/jsdom": "21.1.6",
|
||||
- "@types/koa": "2.14.0",
|
||||
@ -57,34 +57,33 @@
|
||||
- "@types/koa-json": "2.0.23",
|
||||
- "@types/lowdb": "1.0.11",
|
||||
"@types/lunr": "2.3.7",
|
||||
"@types/node": "18.19.2",
|
||||
"@types/node": "18.19.14",
|
||||
- "@types/node-fetch": "2.6.4",
|
||||
"@types/node-forge": "1.3.10",
|
||||
"@types/node-forge": "1.3.11",
|
||||
"@types/node-ipc": "9.2.0",
|
||||
"@types/papaparse": "5.3.14",
|
||||
- "@types/proper-lockfile": "4.1.2",
|
||||
- "@types/react": "16.14.54",
|
||||
- "@types/retry": "0.12.2",
|
||||
- "@types/retry": "0.12.5",
|
||||
+ "@types/semver": "^7.3.4",
|
||||
"@types/zxcvbn": "4.4.4",
|
||||
- "@typescript-eslint/eslint-plugin": "6.19.1",
|
||||
- "@typescript-eslint/parser": "6.19.1",
|
||||
- "@typescript-eslint/eslint-plugin": "6.21.0",
|
||||
- "@typescript-eslint/parser": "6.21.0",
|
||||
- "@webcomponents/custom-elements": "1.6.0",
|
||||
"autoprefixer": "10.4.16",
|
||||
- "base64-loader": "1.0.0",
|
||||
"buffer": "6.0.3",
|
||||
- "chromatic": "10.0.0",
|
||||
"clean-webpack-plugin": "4.0.0",
|
||||
"concurrently": "8.2.2",
|
||||
"copy-webpack-plugin": "11.0.0",
|
||||
"cross-env": "7.0.3",
|
||||
"css-loader": "6.8.1",
|
||||
"electron": "28.1.3",
|
||||
- "electron-builder": "23.6.0",
|
||||
"electron": "28.2.4",
|
||||
- "electron-builder": "24.9.1",
|
||||
"electron-log": "5.0.1",
|
||||
- "electron-reload": "2.0.0-alpha.1",
|
||||
"electron-store": "8.1.0",
|
||||
"electron-updater": "6.1.7",
|
||||
"electron-updater": "6.1.8",
|
||||
- "eslint": "8.56.0",
|
||||
- "eslint-config-prettier": "9.1.0",
|
||||
- "eslint-import-resolver-typescript": "3.6.1",
|
||||
@ -102,13 +101,14 @@
|
||||
"html-loader": "4.2.0",
|
||||
- "html-webpack-injector": "1.1.4",
|
||||
"html-webpack-plugin": "5.5.4",
|
||||
- "husky": "8.0.3",
|
||||
- "husky": "9.0.10",
|
||||
- "jest-junit": "16.0.0",
|
||||
"jest-mock-extended": "3.0.5",
|
||||
- "jest-preset-angular": "14.0.0",
|
||||
- "lint-staged": "15.2.0",
|
||||
- "jest-preset-angular": "14.0.2",
|
||||
- "lint-staged": "15.2.2",
|
||||
"mini-css-extract-plugin": "2.7.6",
|
||||
"node-ipc": "9.2.1",
|
||||
+ "path-browserify": "^1.0.1",
|
||||
- "pkg": "5.8.1",
|
||||
"postcss": "8.4.32",
|
||||
"postcss-loader": "7.3.3",
|
||||
@ -122,15 +122,15 @@
|
||||
"rimraf": "5.0.5",
|
||||
"sass": "1.69.5",
|
||||
"sass-loader": "13.3.2",
|
||||
- "storybook": "7.6.4",
|
||||
- "storybook": "7.6.17",
|
||||
- "style-loader": "3.3.3",
|
||||
- "tailwindcss": "3.3.5",
|
||||
- "ts-jest": "29.1.2",
|
||||
"ts-loader": "9.5.1",
|
||||
"tsconfig-paths-webpack-plugin": "4.1.0",
|
||||
- "type-fest": "2.19.0",
|
||||
"typescript": "4.9.5",
|
||||
- "url": "0.11.3",
|
||||
"typescript": "5.1.6",
|
||||
"url": "0.11.3",
|
||||
- "util": "0.12.5",
|
||||
- "wait-on": "7.2.0",
|
||||
"webpack": "5.89.0",
|
||||
@ -140,24 +140,25 @@
|
||||
+ "webpack-cli": "5.1.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@angular/animations": "15.2.10",
|
||||
@@ -159,55 +82,28 @@
|
||||
"@angular/platform-browser": "15.2.10",
|
||||
"@angular/platform-browser-dynamic": "15.2.10",
|
||||
"@angular/router": "15.2.10",
|
||||
"@angular/animations": "16.2.12",
|
||||
@@ -158,56 +84,29 @@
|
||||
"@angular/platform-browser": "16.2.12",
|
||||
"@angular/platform-browser-dynamic": "16.2.12",
|
||||
"@angular/router": "16.2.12",
|
||||
- "@koa/multer": "3.0.2",
|
||||
- "@koa/router": "12.0.1",
|
||||
"@microsoft/signalr": "6.0.25",
|
||||
"@microsoft/signalr-protocol-msgpack": "6.0.25",
|
||||
"@ng-select/ng-select": "10.0.4",
|
||||
"@microsoft/signalr": "8.0.0",
|
||||
"@microsoft/signalr-protocol-msgpack": "8.0.0",
|
||||
"@ng-select/ng-select": "11.2.0",
|
||||
"argon2": "0.31.0",
|
||||
- "argon2-browser": "1.18.0",
|
||||
"big-integer": "1.6.51",
|
||||
- "bootstrap": "4.6.0",
|
||||
- "braintree-web-drop-in": "1.42.0",
|
||||
"buffer": "6.0.3",
|
||||
- "bufferutil": "4.0.8",
|
||||
- "chalk": "4.1.2",
|
||||
"commander": "7.2.0",
|
||||
"commander": "11.1.0",
|
||||
- "core-js": "3.34.0",
|
||||
"duo_web_sdk": "github:duosecurity/duo_web_sdk",
|
||||
- "form-data": "4.0.0",
|
||||
@ -172,8 +173,8 @@
|
||||
- "lowdb": "1.0.0",
|
||||
"lunr": "2.3.9",
|
||||
- "multer": "1.4.5-lts.1",
|
||||
- "ngx-infinite-scroll": "15.0.0",
|
||||
"ngx-toastr": "16.2.0",
|
||||
- "ngx-infinite-scroll": "16.0.0",
|
||||
"ngx-toastr": "17.0.2",
|
||||
"node-fetch": "2.6.12",
|
||||
"node-forge": "1.3.1",
|
||||
"nord": "0.2.1",
|
||||
@ -187,15 +188,15 @@
|
||||
- "qrious": "4.0.2",
|
||||
"rxjs": "7.8.1",
|
||||
- "tabbable": "6.2.0",
|
||||
"tldts": "6.1.2",
|
||||
"tldts": "6.1.8",
|
||||
"utf-8-validate": "6.0.3",
|
||||
"zone.js": "0.12.0",
|
||||
"zone.js": "0.13.3",
|
||||
"zxcvbn": "4.4.2"
|
||||
},
|
||||
"overrides": {
|
||||
- "tailwindcss": "$tailwindcss",
|
||||
"@storybook/angular": {
|
||||
"zone.js": "0.12.0"
|
||||
"zone.js": "$zone.js"
|
||||
},
|
||||
--- a/apps/desktop/desktop_native/package.json
|
||||
+++ b/apps/desktop/desktop_native/package.json
|
||||
|
@ -1,169 +0,0 @@
|
||||
Use node-argon2 instead of browser-argon2 as the second needs webassembly/emscripten to compile and does not have source included in the tarball, while the first allows use to use the already installed system libargon2
|
||||
|
||||
--- bitwarden/apps/desktop/webpack.main.js.old 2023-02-15 19:02:44.000000000 +0100
|
||||
+++ bitwarden/apps/desktop/webpack.main.js 2023-02-18 18:42:54.917063925 +0100
|
||||
@@ -73,8 +73,6 @@
|
||||
"./src/package.json",
|
||||
{ from: "./src/images", to: "images" },
|
||||
{ from: "./src/locales", to: "locales" },
|
||||
- "../../node_modules/argon2-browser/dist/argon2.wasm",
|
||||
- "../../node_modules/argon2-browser/dist/argon2-simd.wasm",
|
||||
],
|
||||
}),
|
||||
new EnvironmentPlugin({
|
||||
@@ -84,6 +83,8 @@
|
||||
externals: {
|
||||
"electron-reload": "commonjs2 electron-reload",
|
||||
"@bitwarden/desktop-native": "commonjs2 @bitwarden/desktop-native",
|
||||
+ "argon2": "commonjs2 argon2",
|
||||
+ "@phc/format": "commonjs2 @phc/format",
|
||||
},
|
||||
};
|
||||
|
||||
--- 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: [
|
||||
@@ -162,6 +152,10 @@
|
||||
DEV_FLAGS: NODE_ENV === "development" ? envConfig.devFlags : {},
|
||||
}),
|
||||
],
|
||||
+ externals: {
|
||||
+ "argon2": "commonjs2 argon2",
|
||||
+ "@phc/format": "commonjs2 @phc/format",
|
||||
+ },
|
||||
};
|
||||
|
||||
module.exports = merge(common, renderer);
|
||||
--- bitwarden/apps/desktop/src/package.json.old 2023-02-15 19:02:44.000000000 +0100
|
||||
+++ bitwarden/apps/desktop/src/package.json 2023-02-18 18:54:55.213046618 +0100
|
||||
@@ -12,6 +12,7 @@
|
||||
"url": "git+https://github.com/bitwarden/clients.git"
|
||||
},
|
||||
"dependencies": {
|
||||
+ "argon2": "^0.30.3",
|
||||
"@bitwarden/desktop-native": "file:../desktop_native"
|
||||
}
|
||||
}
|
||||
--- bitwarden/libs/common/src/platform/services/web-crypto-function.service.ts.old 2023-02-15 19:02:44.000000000 +0100
|
||||
+++ bitwarden/libs/common/src/platform/services/web-crypto-function.service.ts 2023-02-18 18:52:00.173567051 +0100
|
||||
@@ -1,4 +1,4 @@
|
||||
-import * as argon2 from "argon2-browser";
|
||||
+import * as argon2 from "argon2";
|
||||
import * as forge from "node-forge";
|
||||
|
||||
import { Utils } from "../../platform/misc/utils";
|
||||
@@ -10,13 +10,11 @@ import { SymmetricCryptoKey } from "../m
|
||||
export class WebCryptoFunctionService implements CryptoFunctionService {
|
||||
private crypto: Crypto;
|
||||
private subtle: SubtleCrypto;
|
||||
- private wasmSupported: boolean;
|
||||
|
||||
constructor(win: Window | typeof global) {
|
||||
this.crypto = typeof win.crypto !== "undefined" ? win.crypto : null;
|
||||
this.subtle =
|
||||
!!this.crypto && typeof win.crypto.subtle !== "undefined" ? win.crypto.subtle : null;
|
||||
- this.wasmSupported = this.checkIfWasmSupported();
|
||||
}
|
||||
|
||||
async pbkdf2(
|
||||
@@ -54,24 +52,19 @@ export class WebCryptoFunctionService im
|
||||
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 nodePassword = this.toNodeValue(password);
|
||||
+ const nodeSalt = this.toNodeBuffer(this.toUint8Buffer(salt));
|
||||
|
||||
- const result = await argon2.hash({
|
||||
- pass: passwordArr,
|
||||
- salt: saltArr,
|
||||
- time: iterations,
|
||||
- mem: memory,
|
||||
+ const hash = await argon2.hash(nodePassword, {
|
||||
+ salt: nodeSalt,
|
||||
+ raw: true,
|
||||
+ hashLength: 32,
|
||||
+ timeCost: iterations,
|
||||
+ memoryCost: memory,
|
||||
parallelism: parallelism,
|
||||
- hashLen: 32,
|
||||
- type: argon2.ArgonType.Argon2id,
|
||||
+ type: argon2.argon2id,
|
||||
});
|
||||
- argon2.unloadRuntime();
|
||||
- return result.hash;
|
||||
+ return this.toUint8Buffer(hash);
|
||||
}
|
||||
|
||||
async hkdf(
|
||||
@@ -435,20 +428,28 @@ export class WebCryptoFunctionService im
|
||||
return mode === "cbc" ? "AES-CBC" : "AES-ECB";
|
||||
}
|
||||
|
||||
- // ref: https://stackoverflow.com/a/47880734/1090359
|
||||
- private checkIfWasmSupported(): boolean {
|
||||
- try {
|
||||
- if (typeof WebAssembly === "object" && typeof WebAssembly.instantiate === "function") {
|
||||
- const module = new WebAssembly.Module(
|
||||
- Uint8Array.of(0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00),
|
||||
- );
|
||||
- if (module instanceof WebAssembly.Module) {
|
||||
- return new WebAssembly.Instance(module) instanceof WebAssembly.Instance;
|
||||
- }
|
||||
- }
|
||||
- } catch {
|
||||
- return false;
|
||||
+// from libs/node/src/services/node-crypto-function.service.ts
|
||||
+ private toNodeValue(value: string | Uint8Array): string | Buffer {
|
||||
+ let nodeValue: string | Buffer;
|
||||
+ if (typeof value === "string") {
|
||||
+ nodeValue = value;
|
||||
+ } else {
|
||||
+ nodeValue = this.toNodeBuffer(value);
|
||||
}
|
||||
- return false;
|
||||
+ return nodeValue;
|
||||
+ }
|
||||
+
|
||||
+ private toNodeBuffer(value: Uint8Array): Buffer {
|
||||
+ return Buffer.from(value);
|
||||
+ }
|
||||
+
|
||||
+ private toUint8Buffer(value: Buffer | string | Uint8Array): Uint8Array {
|
||||
+ let buf: Uint8Array;
|
||||
+ if (typeof value === "string") {
|
||||
+ buf = Utils.fromUtf8ToArray(value);
|
||||
+ } else {
|
||||
+ buf = value;
|
||||
+ }
|
||||
+ return buf;
|
||||
}
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2a964f77f1449694a36ab766de7d0ae1dff7d4d169bcfc9509ab4d653f6dc4ab
|
||||
size 25811826
|
||||
oid sha256:821d2b54e1051ddae3369829134c88ebb87dcb9845df51fc4316c637f42b963a
|
||||
size 29023854
|
||||
|
Loading…
Reference in New Issue
Block a user