1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 07:43:35 +00:00

Switch to rustcrypto argon2 on desktop (#11753)

* Switch to rustcrypto argon2 on desktop

* Make argon2 use zeroize

* Remove argon2 native modules from electron-builder config

* Clean rust implementation of argon2

* Update cargo.lock

* Update apps/desktop/desktop_native/napi/src/lib.rs

Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>

* Add tests

* Clean up test

* Remove argon2 external from webpack main

* Fix build

* Fix argon2 module causing a startup crash

---------

Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
This commit is contained in:
Bernd Schoolmann
2024-12-04 12:54:55 +01:00
committed by GitHub
parent 1dce7f5ba0
commit 864e6759fd
15 changed files with 140 additions and 26 deletions

View File

@@ -1,6 +1,5 @@
import * as crypto from "crypto";
import * as argon2 from "argon2";
import * as forge from "node-forge";
import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service";
@@ -40,6 +39,7 @@ export class NodeCryptoFunctionService implements CryptoFunctionService {
const nodePassword = this.toNodeValue(password);
const nodeSalt = this.toNodeBuffer(this.toUint8Buffer(salt));
const argon2 = await import("argon2");
const hash = await argon2.hash(nodePassword, {
salt: nodeSalt,
raw: true,