1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-07 20:24:01 +00:00

type safety improvements

This commit is contained in:
Maciej Zieniuk
2025-03-27 18:21:30 +00:00
parent d1f5f70d1b
commit eadd8c656d

View File

@@ -92,6 +92,12 @@ export class KeyConnectorService implements KeyConnectorServiceAbstraction {
async migrateUser(userId: UserId) {
const organization = await this.getManagingOrganization(userId);
if (organization == null) {
throw new Error(
"[Key Connector service] No key connector enabled organization found, aborting user migration to key connector.",
);
}
const masterKey = await firstValueFrom(this.masterPasswordService.masterKey$(userId));
const keyConnectorRequest = new KeyConnectorUserKeyRequest(masterKey.encKeyB64);
@@ -188,7 +194,7 @@ export class KeyConnectorService implements KeyConnectorServiceAbstraction {
throw new Error("Key Connector error");
}
private findManagingOrganization(organizations: Organization[]) {
private findManagingOrganization(organizations: Organization[]): Organization | undefined {
return organizations.find(
(o) =>
o.keyConnectorEnabled &&