-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* create mp and kdf service * update mp service interface to not rely on active user * rename observable methods * update crypto service with new MP service * add master password service to login strategies - make fake service for easier testing - fix crypto service tests * update auth service and finish strategies * auth request refactors * more service refactors and constructor updates * setMasterKey refactors * remove master key methods from crypto service * remove master key and hash from state service * missed fixes * create migrations and fix references * fix master key imports * default force set password reason to none * add password reset reason observable factory to service * remove kdf changes and migrate only disk data * update migration number * fix sync service deps * use disk for force set password state * fix desktop migration * fix sso test * fix tests * fix more tests * fix even more tests * fix even more tests * fix cli * remove kdf service abstraction * add missing deps for browser * fix merge conflicts * clear reset password reason on lock or logout * fix tests * fix other tests * add jsdocs to abstraction * use state provider in crypto service * inverse master password service factory * add clearOn to master password service * add parameter validation to master password service * add component level userId * add missed userId * migrate key hash * fix login strategy service * delete crypto master key from account * migrate master key encrypted user key * rename key hash to master key hash * use mp service for getMasterKeyEncryptedUserKey * fix tests * fix user key decryption logic * add clear methods to mp service * fix circular dep and encryption issue * fix test * remove extra account service call * use EncString in state provider * fix tests * return to using encrypted string for serialization
- Loading branch information
Showing
79 changed files
with
1,373 additions
and
501 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
apps/browser/src/auth/background/service-factories/master-password-service.factory.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { | ||
InternalMasterPasswordServiceAbstraction, | ||
MasterPasswordServiceAbstraction, | ||
} from "@bitwarden/common/auth/abstractions/master-password.service.abstraction"; | ||
import { MasterPasswordService } from "@bitwarden/common/auth/services/master-password/master-password.service"; | ||
|
||
import { | ||
CachedServices, | ||
factory, | ||
FactoryOptions, | ||
} from "../../../platform/background/service-factories/factory-options"; | ||
import { | ||
stateProviderFactory, | ||
StateProviderInitOptions, | ||
} from "../../../platform/background/service-factories/state-provider.factory"; | ||
|
||
type MasterPasswordServiceFactoryOptions = FactoryOptions; | ||
|
||
export type MasterPasswordServiceInitOptions = MasterPasswordServiceFactoryOptions & | ||
StateProviderInitOptions; | ||
|
||
export function internalMasterPasswordServiceFactory( | ||
cache: { masterPasswordService?: InternalMasterPasswordServiceAbstraction } & CachedServices, | ||
opts: MasterPasswordServiceInitOptions, | ||
): Promise<InternalMasterPasswordServiceAbstraction> { | ||
return factory( | ||
cache, | ||
"masterPasswordService", | ||
opts, | ||
async () => new MasterPasswordService(await stateProviderFactory(cache, opts)), | ||
); | ||
} | ||
|
||
export async function masterPasswordServiceFactory( | ||
cache: { masterPasswordService?: InternalMasterPasswordServiceAbstraction } & CachedServices, | ||
opts: MasterPasswordServiceInitOptions, | ||
): Promise<MasterPasswordServiceAbstraction> { | ||
return (await internalMasterPasswordServiceFactory( | ||
cache, | ||
opts, | ||
)) as MasterPasswordServiceAbstraction; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,9 @@ | ||
import { Component } from "@angular/core"; | ||
import { ActivatedRoute, Router } from "@angular/router"; | ||
|
||
import { SetPasswordComponent as BaseSetPasswordComponent } from "@bitwarden/angular/auth/components/set-password.component"; | ||
import { InternalUserDecryptionOptionsServiceAbstraction } from "@bitwarden/auth/common"; | ||
import { ApiService } from "@bitwarden/common/abstractions/api.service"; | ||
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/organization/organization-api.service.abstraction"; | ||
import { OrganizationUserService } from "@bitwarden/common/admin-console/abstractions/organization-user/organization-user.service"; | ||
import { PolicyApiServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/policy/policy-api.service.abstraction"; | ||
import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction"; | ||
import { SsoLoginServiceAbstraction } from "@bitwarden/common/auth/abstractions/sso-login.service.abstraction"; | ||
import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.service"; | ||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; | ||
import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service"; | ||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; | ||
import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; | ||
import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password"; | ||
import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction"; | ||
import { DialogService } from "@bitwarden/components"; | ||
|
||
@Component({ | ||
selector: "app-set-password", | ||
templateUrl: "set-password.component.html", | ||
}) | ||
export class SetPasswordComponent extends BaseSetPasswordComponent { | ||
constructor( | ||
apiService: ApiService, | ||
i18nService: I18nService, | ||
cryptoService: CryptoService, | ||
messagingService: MessagingService, | ||
stateService: StateService, | ||
passwordGenerationService: PasswordGenerationServiceAbstraction, | ||
platformUtilsService: PlatformUtilsService, | ||
policyApiService: PolicyApiServiceAbstraction, | ||
policyService: PolicyService, | ||
router: Router, | ||
syncService: SyncService, | ||
route: ActivatedRoute, | ||
organizationApiService: OrganizationApiServiceAbstraction, | ||
organizationUserService: OrganizationUserService, | ||
userDecryptionOptionsService: InternalUserDecryptionOptionsServiceAbstraction, | ||
ssoLoginService: SsoLoginServiceAbstraction, | ||
dialogService: DialogService, | ||
) { | ||
super( | ||
i18nService, | ||
cryptoService, | ||
messagingService, | ||
passwordGenerationService, | ||
platformUtilsService, | ||
policyApiService, | ||
policyService, | ||
router, | ||
apiService, | ||
syncService, | ||
route, | ||
stateService, | ||
organizationApiService, | ||
organizationUserService, | ||
userDecryptionOptionsService, | ||
ssoLoginService, | ||
dialogService, | ||
); | ||
} | ||
} | ||
export class SetPasswordComponent extends BaseSetPasswordComponent {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.