mirror of
https://github.com/bitwarden/jslib
synced 2025-12-19 01:33:22 +00:00
Minor fixes when integrating with web client
This commit is contained in:
@@ -113,11 +113,10 @@ import { ValidationService } from "./validation.service";
|
|||||||
PlatformUtilsServiceAbstraction,
|
PlatformUtilsServiceAbstraction,
|
||||||
MessagingServiceAbstraction,
|
MessagingServiceAbstraction,
|
||||||
LogService,
|
LogService,
|
||||||
CryptoFunctionServiceAbstraction,
|
|
||||||
KeyConnectorServiceAbstraction,
|
KeyConnectorServiceAbstraction,
|
||||||
EnvironmentServiceAbstraction,
|
EnvironmentServiceAbstraction,
|
||||||
TwoFactorServiceAbstraction,
|
|
||||||
StateServiceAbstraction,
|
StateServiceAbstraction,
|
||||||
|
TwoFactorServiceAbstraction,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -430,6 +429,7 @@ import { ValidationService } from "./validation.service";
|
|||||||
TokenServiceAbstraction,
|
TokenServiceAbstraction,
|
||||||
LogService,
|
LogService,
|
||||||
OrganizationServiceAbstraction,
|
OrganizationServiceAbstraction,
|
||||||
|
CryptoFunctionServiceAbstraction,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ import { SymmetricCryptoKey } from "../models/domain/symmetricCryptoKey";
|
|||||||
import { TokenRequestTwoFactor } from "../models/request/identityToken/tokenRequest";
|
import { TokenRequestTwoFactor } from "../models/request/identityToken/tokenRequest";
|
||||||
|
|
||||||
export abstract class AuthService {
|
export abstract class AuthService {
|
||||||
|
masterPasswordHash: string;
|
||||||
|
email: string;
|
||||||
logIn: (
|
logIn: (
|
||||||
email: string,
|
email: string,
|
||||||
masterPassword: string,
|
masterPassword: string,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { TwoFactorProviderType } from "../enums/twoFactorProviderType";
|
import { TwoFactorProviderType } from "../enums/twoFactorProviderType";
|
||||||
|
|
||||||
export abstract class TwoFactorService {
|
export abstract class TwoFactorService {
|
||||||
|
init: () => void;
|
||||||
getSupportedProviders: (win: Window) => any[];
|
getSupportedProviders: (win: Window) => any[];
|
||||||
getDefaultProvider: (webAuthnSupported: boolean) => TwoFactorProviderType;
|
getDefaultProvider: (webAuthnSupported: boolean) => TwoFactorProviderType;
|
||||||
clearSelectedProvider: () => void;
|
clearSelectedProvider: () => void;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { Utils } from "../../../misc/utils";
|
|||||||
export class PasswordTokenRequest extends TokenRequest implements CaptchaProtectedRequest {
|
export class PasswordTokenRequest extends TokenRequest implements CaptchaProtectedRequest {
|
||||||
constructor(
|
constructor(
|
||||||
public email: string,
|
public email: string,
|
||||||
private masterPasswordHash: string,
|
public masterPasswordHash: string,
|
||||||
public captchaResponse: string,
|
public captchaResponse: string,
|
||||||
protected twoFactor: TokenRequestTwoFactor,
|
protected twoFactor: TokenRequestTwoFactor,
|
||||||
device?: DeviceRequest
|
device?: DeviceRequest
|
||||||
|
|||||||
@@ -219,6 +219,14 @@ export class AuthService implements AuthServiceAbstraction {
|
|||||||
return this.savedTokenRequest instanceof PasswordTokenRequest;
|
return this.savedTokenRequest instanceof PasswordTokenRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get email(): string {
|
||||||
|
return (this.savedTokenRequest as PasswordTokenRequest).email;
|
||||||
|
}
|
||||||
|
|
||||||
|
get masterPasswordHash(): string {
|
||||||
|
return (this.savedTokenRequest as PasswordTokenRequest).masterPasswordHash;
|
||||||
|
}
|
||||||
|
|
||||||
async makePreloginKey(masterPassword: string, email: string): Promise<SymmetricCryptoKey> {
|
async makePreloginKey(masterPassword: string, email: string): Promise<SymmetricCryptoKey> {
|
||||||
email = email.trim().toLowerCase();
|
email = email.trim().toLowerCase();
|
||||||
let kdf: KdfType = null;
|
let kdf: KdfType = null;
|
||||||
@@ -259,7 +267,7 @@ export class AuthService implements AuthServiceAbstraction {
|
|||||||
result.resetMasterPassword = tokenResponse.resetMasterPassword;
|
result.resetMasterPassword = tokenResponse.resetMasterPassword;
|
||||||
result.forcePasswordReset = tokenResponse.forcePasswordReset;
|
result.forcePasswordReset = tokenResponse.forcePasswordReset;
|
||||||
|
|
||||||
this.saveAccountInformation(tokenResponse);
|
await this.saveAccountInformation(tokenResponse);
|
||||||
|
|
||||||
if (tokenResponse.twoFactorToken != null) {
|
if (tokenResponse.twoFactorToken != null) {
|
||||||
await this.tokenService.setTwoFactorToken(tokenResponse.twoFactorToken);
|
await this.tokenService.setTwoFactorToken(tokenResponse.twoFactorToken);
|
||||||
|
|||||||
Reference in New Issue
Block a user