mirror of
https://github.com/bitwarden/browser
synced 2026-02-10 05:30:01 +00:00
Rename CipherConfig to OpaqueCipherConfig per discussion (#13908)
* Rename CipherConfig to OpaqueCipherConfig per discussion * Fix import
This commit is contained in:
@@ -14,7 +14,7 @@ import { IdentityCaptchaResponse } from "@bitwarden/common/auth/models/response/
|
||||
import { IdentityDeviceVerificationResponse } from "@bitwarden/common/auth/models/response/identity-device-verification.response";
|
||||
import { IdentityTokenResponse } from "@bitwarden/common/auth/models/response/identity-token.response";
|
||||
import { IdentityTwoFactorResponse } from "@bitwarden/common/auth/models/response/identity-two-factor.response";
|
||||
import { CipherConfiguration } from "@bitwarden/common/auth/opaque/models/cipher-configuration";
|
||||
import { OpaqueCipherConfiguration } from "@bitwarden/common/auth/opaque/models/opaque-cipher-configuration";
|
||||
import { HashPurpose } from "@bitwarden/common/platform/enums";
|
||||
import { SymmetricCryptoKey } from "@bitwarden/common/platform/models/domain/symmetric-crypto-key";
|
||||
import { PasswordStrengthServiceAbstraction } from "@bitwarden/common/tools/password-strength";
|
||||
@@ -40,7 +40,7 @@ export class OpaqueLoginStrategyData implements LoginStrategyData {
|
||||
|
||||
/* The user's OPAQUE cipher configuration which controls
|
||||
the encryption schemes used during key derivation and key exchange */
|
||||
cipherConfiguration: CipherConfiguration;
|
||||
cipherConfiguration: OpaqueCipherConfiguration;
|
||||
|
||||
/**
|
||||
* Tracks if the user needs to be forced to update their password
|
||||
|
||||
@@ -13,7 +13,7 @@ import { IdentityCaptchaResponse } from "@bitwarden/common/auth/models/response/
|
||||
import { IdentityDeviceVerificationResponse } from "@bitwarden/common/auth/models/response/identity-device-verification.response";
|
||||
import { IdentityTokenResponse } from "@bitwarden/common/auth/models/response/identity-token.response";
|
||||
import { IdentityTwoFactorResponse } from "@bitwarden/common/auth/models/response/identity-two-factor.response";
|
||||
import { CipherConfiguration } from "@bitwarden/common/auth/opaque/models/cipher-configuration";
|
||||
import { OpaqueCipherConfiguration } from "@bitwarden/common/auth/opaque/models/opaque-cipher-configuration";
|
||||
import { OpaqueKeyExchangeService } from "@bitwarden/common/auth/opaque/opaque-key-exchange.service";
|
||||
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
|
||||
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
||||
@@ -296,7 +296,7 @@ export class PasswordLoginStrategy extends BaseLoginStrategy {
|
||||
return;
|
||||
}
|
||||
|
||||
const cipherConfig = CipherConfiguration.fromKdfConfig(
|
||||
const cipherConfig = OpaqueCipherConfiguration.fromKdfConfig(
|
||||
userConfiguredKdf.kdfType === KdfType.Argon2id
|
||||
? userConfiguredKdf
|
||||
: DEFAULT_OPAQUE_KDF_CONFIG,
|
||||
|
||||
@@ -5,7 +5,7 @@ import { Jsonify } from "type-fest";
|
||||
import { AuthenticationType } from "@bitwarden/common/auth/enums/authentication-type";
|
||||
import { TokenTwoFactorRequest } from "@bitwarden/common/auth/models/request/identity-token/token-two-factor.request";
|
||||
import { PrePasswordLoginResponse } from "@bitwarden/common/auth/models/response/pre-password-login.response";
|
||||
import { CipherConfiguration } from "@bitwarden/common/auth/opaque/models/cipher-configuration";
|
||||
import { OpaqueCipherConfiguration } from "@bitwarden/common/auth/opaque/models/opaque-cipher-configuration";
|
||||
import { WebAuthnLoginAssertionResponseRequest } from "@bitwarden/common/auth/services/webauthn-login/request/webauthn-login-assertion-response.request";
|
||||
import { SymmetricCryptoKey } from "@bitwarden/common/platform/models/domain/symmetric-crypto-key";
|
||||
import { UserKey, MasterKey } from "@bitwarden/common/types/key";
|
||||
@@ -160,7 +160,7 @@ export class OpaqueLoginCredentials {
|
||||
public email: string,
|
||||
public masterPassword: string,
|
||||
public kdfConfig: KdfConfig,
|
||||
public cipherConfiguration: CipherConfiguration,
|
||||
public cipherConfiguration: OpaqueCipherConfiguration,
|
||||
public twoFactor?: TokenTwoFactorRequest,
|
||||
) {}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { KdfType, createKdfConfig } from "@bitwarden/key-management";
|
||||
|
||||
import { BaseResponse } from "../../../models/response/base.response";
|
||||
import { CipherConfiguration } from "../../opaque/models/cipher-configuration";
|
||||
import { OpaqueCipherConfiguration } from "../../opaque/models/opaque-cipher-configuration";
|
||||
|
||||
export class PrePasswordLoginResponse extends BaseResponse {
|
||||
kdf: KdfType;
|
||||
@@ -9,7 +9,7 @@ export class PrePasswordLoginResponse extends BaseResponse {
|
||||
kdfMemory?: number;
|
||||
kdfParallelism?: number;
|
||||
|
||||
opaqueConfiguration?: CipherConfiguration;
|
||||
opaqueConfiguration?: OpaqueCipherConfiguration;
|
||||
|
||||
constructor(response: any) {
|
||||
super(response);
|
||||
|
||||
@@ -8,9 +8,9 @@ import { OpaqueSessionId } from "@bitwarden/common/types/guid";
|
||||
|
||||
import { UserKey } from "../../types/key";
|
||||
|
||||
import { CipherConfiguration } from "./models/cipher-configuration";
|
||||
import { LoginFinishRequest } from "./models/login-finish.request";
|
||||
import { LoginStartRequest } from "./models/login-start.request";
|
||||
import { OpaqueCipherConfiguration } from "./models/opaque-cipher-configuration";
|
||||
import { RegistrationFinishRequest } from "./models/registration-finish.request";
|
||||
import { RegistrationStartRequest } from "./models/registration-start.request";
|
||||
import { OpaqueKeyExchangeApiService } from "./opaque-key-exchange-api.service";
|
||||
@@ -25,7 +25,7 @@ export class DefaultOpaqueKeyExchangeService implements OpaqueKeyExchangeService
|
||||
async register(
|
||||
masterPassword: string,
|
||||
userKey: UserKey,
|
||||
cipherConfig: CipherConfiguration,
|
||||
cipherConfig: OpaqueCipherConfiguration,
|
||||
): Promise<OpaqueSessionId> {
|
||||
if (!masterPassword || !userKey || !cipherConfig) {
|
||||
throw new Error(
|
||||
@@ -80,7 +80,7 @@ export class DefaultOpaqueKeyExchangeService implements OpaqueKeyExchangeService
|
||||
async login(
|
||||
email: string,
|
||||
masterPassword: string,
|
||||
cipherConfig: CipherConfiguration,
|
||||
cipherConfig: OpaqueCipherConfiguration,
|
||||
): Promise<Uint8Array> {
|
||||
if (!email || !masterPassword || !cipherConfig) {
|
||||
throw new Error(
|
||||
|
||||
@@ -7,7 +7,7 @@ export type CipherSuite = OPAQUEKE3_RISTRETTO255_3DH_ARGON2ID13_SUITE;
|
||||
export type OPAQUEKE3_RISTRETTO255_3DH_ARGON2ID13_SUITE =
|
||||
"OPAQUE_3_RISTRETTO255_OPRF_RISTRETTO255_KEGROUP_3DH_KEX_ARGON2ID13_KSF";
|
||||
|
||||
export class CipherConfiguration {
|
||||
export class OpaqueCipherConfiguration {
|
||||
cipherSuite: CipherSuite;
|
||||
argon2Parameters: Argon2IdParameters;
|
||||
|
||||
@@ -23,8 +23,8 @@ export class CipherConfiguration {
|
||||
* @param kdfConfig - Bitwarden KDF config
|
||||
* @returns OPAQUE KSF config
|
||||
*/
|
||||
static fromKdfConfig(kdfConfig: Argon2KdfConfig): CipherConfiguration {
|
||||
return new CipherConfiguration({
|
||||
static fromKdfConfig(kdfConfig: Argon2KdfConfig): OpaqueCipherConfiguration {
|
||||
return new OpaqueCipherConfiguration({
|
||||
// convert MiB to KiB
|
||||
memory: kdfConfig.memory * 1024,
|
||||
iterations: kdfConfig.iterations,
|
||||
@@ -1,8 +1,8 @@
|
||||
import { CipherConfiguration } from "./cipher-configuration";
|
||||
import { OpaqueCipherConfiguration } from "./opaque-cipher-configuration";
|
||||
|
||||
export class RegistrationStartRequest {
|
||||
constructor(
|
||||
readonly registrationRequest: string,
|
||||
readonly cipherConfiguration: CipherConfiguration,
|
||||
readonly cipherConfiguration: OpaqueCipherConfiguration,
|
||||
) {}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import { OpaqueSessionId } from "@bitwarden/common/types/guid";
|
||||
|
||||
import { UserKey } from "../../types/key";
|
||||
|
||||
import { CipherConfiguration } from "./models/cipher-configuration";
|
||||
import { OpaqueCipherConfiguration } from "./models/opaque-cipher-configuration";
|
||||
|
||||
export abstract class OpaqueKeyExchangeService {
|
||||
/**
|
||||
@@ -11,7 +11,7 @@ export abstract class OpaqueKeyExchangeService {
|
||||
abstract register(
|
||||
masterPassword: string,
|
||||
userKey: UserKey,
|
||||
cipherConfiguration: CipherConfiguration,
|
||||
cipherConfiguration: OpaqueCipherConfiguration,
|
||||
): Promise<OpaqueSessionId>;
|
||||
|
||||
/**
|
||||
@@ -22,6 +22,6 @@ export abstract class OpaqueKeyExchangeService {
|
||||
abstract login(
|
||||
email: string,
|
||||
masterPassword: string,
|
||||
cipherConfiguration: CipherConfiguration,
|
||||
cipherConfiguration: OpaqueCipherConfiguration,
|
||||
): Promise<Uint8Array>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user