mirror of
https://github.com/bitwarden/browser.git
synced 2025-01-30 22:41:33 +01:00
[PM-17629] Split up KM lib to km and km-ui (#13093)
This commit is contained in:
parent
4b45029d23
commit
f8bdd66fbb
@ -15,7 +15,7 @@ import {
|
||||
BiometricsStatus,
|
||||
BiometricStateService,
|
||||
} from "@bitwarden/key-management";
|
||||
import { UnlockOptions } from "@bitwarden/key-management/angular";
|
||||
import { UnlockOptions } from "@bitwarden/key-management-ui";
|
||||
|
||||
import { BrowserRouterService } from "../../../platform/popup/services/browser-router.service";
|
||||
|
||||
|
@ -13,7 +13,7 @@ import {
|
||||
BiometricsStatus,
|
||||
BiometricStateService,
|
||||
} from "@bitwarden/key-management";
|
||||
import { LockComponentService, UnlockOptions } from "@bitwarden/key-management/angular";
|
||||
import { LockComponentService, UnlockOptions } from "@bitwarden/key-management-ui";
|
||||
|
||||
import { BiometricErrors, BiometricErrorTypes } from "../../../models/biometricErrors";
|
||||
import { BrowserRouterService } from "../../../platform/popup/services/browser-router.service";
|
||||
|
@ -45,7 +45,7 @@ import {
|
||||
DeviceVerificationIcon,
|
||||
} from "@bitwarden/auth/angular";
|
||||
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
|
||||
import { LockComponent } from "@bitwarden/key-management/angular";
|
||||
import { LockComponent } from "@bitwarden/key-management-ui";
|
||||
import {
|
||||
NewDeviceVerificationNoticePageOneComponent,
|
||||
NewDeviceVerificationNoticePageTwoComponent,
|
||||
|
@ -116,7 +116,7 @@ import {
|
||||
BiometricsService,
|
||||
DefaultKeyService,
|
||||
} from "@bitwarden/key-management";
|
||||
import { LockComponentService } from "@bitwarden/key-management/angular";
|
||||
import { LockComponentService } from "@bitwarden/key-management-ui";
|
||||
import { PasswordRepromptService } from "@bitwarden/vault";
|
||||
|
||||
import { ForegroundLockService } from "../../auth/popup/accounts/foreground-lock.service";
|
||||
|
@ -5,7 +5,7 @@ config.content = [
|
||||
"./src/**/*.{html,ts}",
|
||||
"../../libs/components/src/**/*.{html,ts}",
|
||||
"../../libs/auth/src/**/*.{html,ts}",
|
||||
"../../libs/key-management/src/**/*.{html,ts}",
|
||||
"../../libs/key-management-ui/src/**/*.{html,ts}",
|
||||
"../../libs/vault/src/**/*.{html,ts}",
|
||||
"../../libs/angular/src/**/*.{html,ts}",
|
||||
"../../libs/vault/src/**/*.{html,ts}",
|
||||
|
@ -27,7 +27,7 @@
|
||||
"@bitwarden/importer/core": ["../../libs/importer/src"],
|
||||
"@bitwarden/importer/ui": ["../../libs/importer/src/components"],
|
||||
"@bitwarden/key-management": ["../../libs/key-management/src"],
|
||||
"@bitwarden/key-management/angular": ["../../libs/key-management/src/angular"],
|
||||
"@bitwarden/key-management-ui": ["../../libs/key-management-ui/src"],
|
||||
"@bitwarden/platform": ["../../libs/platform/src"],
|
||||
"@bitwarden/send-ui": ["../../libs/tools/send/send-ui/src"],
|
||||
"@bitwarden/tools-card": ["../../libs/tools/card/src"],
|
||||
|
@ -26,7 +26,6 @@
|
||||
"../../libs/tools/export/vault-export/vault-export-core/src"
|
||||
],
|
||||
"@bitwarden/key-management": ["../../libs/key-management/src"],
|
||||
"@bitwarden/key-management/angular": ["../../libs/key-management/src/angular"],
|
||||
"@bitwarden/node/*": ["../../libs/node/src/*"]
|
||||
},
|
||||
"plugins": [
|
||||
|
@ -43,7 +43,7 @@ import {
|
||||
DeviceVerificationIcon,
|
||||
} from "@bitwarden/auth/angular";
|
||||
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
|
||||
import { LockComponent } from "@bitwarden/key-management/angular";
|
||||
import { LockComponent } from "@bitwarden/key-management-ui";
|
||||
import {
|
||||
NewDeviceVerificationNoticePageOneComponent,
|
||||
NewDeviceVerificationNoticePageTwoComponent,
|
||||
|
@ -98,7 +98,7 @@ import {
|
||||
BiometricStateService,
|
||||
BiometricsService,
|
||||
} from "@bitwarden/key-management";
|
||||
import { LockComponentService } from "@bitwarden/key-management/angular";
|
||||
import { LockComponentService } from "@bitwarden/key-management-ui";
|
||||
|
||||
import { DesktopLoginApprovalComponentService } from "../../auth/login/desktop-login-approval-component.service";
|
||||
import { DesktopLoginComponentService } from "../../auth/login/desktop-login-component.service";
|
||||
|
@ -11,7 +11,7 @@ import { DeviceType } from "@bitwarden/common/enums";
|
||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||
import { UserId } from "@bitwarden/common/types/guid";
|
||||
import { KeyService, BiometricsService, BiometricsStatus } from "@bitwarden/key-management";
|
||||
import { UnlockOptions } from "@bitwarden/key-management/angular";
|
||||
import { UnlockOptions } from "@bitwarden/key-management-ui";
|
||||
|
||||
import { DesktopLockComponentService } from "./desktop-lock-component.service";
|
||||
|
||||
|
@ -9,7 +9,7 @@ import { DeviceType } from "@bitwarden/common/enums";
|
||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||
import { UserId } from "@bitwarden/common/types/guid";
|
||||
import { BiometricsService, BiometricsStatus } from "@bitwarden/key-management";
|
||||
import { LockComponentService, UnlockOptions } from "@bitwarden/key-management/angular";
|
||||
import { LockComponentService, UnlockOptions } from "@bitwarden/key-management-ui";
|
||||
|
||||
export class DesktopLockComponentService implements LockComponentService {
|
||||
private readonly userDecryptionOptionsService = inject(UserDecryptionOptionsServiceAbstraction);
|
||||
|
@ -5,7 +5,7 @@ config.content = [
|
||||
"./src/**/*.{html,ts}",
|
||||
"../../libs/components/src/**/*.{html,ts}",
|
||||
"../../libs/auth/src/**/*.{html,ts}",
|
||||
"../../libs/key-management/src/**/*.{html,ts}",
|
||||
"../../libs/key-management-ui/src/**/*.{html,ts}",
|
||||
"../../libs/angular/src/**/*.{html,ts}",
|
||||
"../../libs/vault/src/**/*.{html,ts,mdx}",
|
||||
];
|
||||
|
@ -25,7 +25,7 @@
|
||||
"@bitwarden/importer/core": ["../../libs/importer/src"],
|
||||
"@bitwarden/importer/ui": ["../../libs/importer/src/components"],
|
||||
"@bitwarden/key-management": ["../../libs/key-management/src"],
|
||||
"@bitwarden/key-management/angular": ["../../libs/key-management/src/angular"],
|
||||
"@bitwarden/key-management-ui": ["../../libs/key-management-ui/src"],
|
||||
"@bitwarden/node/*": ["../../libs/node/src/*"],
|
||||
"@bitwarden/platform": ["../../libs/platform/src"],
|
||||
"@bitwarden/send-ui": ["../../libs/tools/send/send-ui/src"],
|
||||
|
@ -99,7 +99,7 @@ import {
|
||||
KeyService as KeyServiceAbstraction,
|
||||
BiometricsService,
|
||||
} from "@bitwarden/key-management";
|
||||
import { LockComponentService } from "@bitwarden/key-management/angular";
|
||||
import { LockComponentService } from "@bitwarden/key-management-ui";
|
||||
|
||||
import { flagEnabled } from "../../utils/flags";
|
||||
import { PolicyListService } from "../admin-console/core/policy-list.service";
|
||||
|
@ -7,7 +7,7 @@ import {
|
||||
} from "@bitwarden/auth/common";
|
||||
import { UserId } from "@bitwarden/common/types/guid";
|
||||
import { BiometricsStatus } from "@bitwarden/key-management";
|
||||
import { LockComponentService, UnlockOptions } from "@bitwarden/key-management/angular";
|
||||
import { LockComponentService, UnlockOptions } from "@bitwarden/key-management-ui";
|
||||
|
||||
export class WebLockComponentService implements LockComponentService {
|
||||
private readonly userDecryptionOptionsService = inject(UserDecryptionOptionsServiceAbstraction);
|
||||
|
@ -43,7 +43,7 @@ import {
|
||||
DeviceVerificationIcon,
|
||||
} from "@bitwarden/auth/angular";
|
||||
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
|
||||
import { LockComponent } from "@bitwarden/key-management/angular";
|
||||
import { LockComponent } from "@bitwarden/key-management-ui";
|
||||
import {
|
||||
NewDeviceVerificationNoticePageOneComponent,
|
||||
NewDeviceVerificationNoticePageTwoComponent,
|
||||
|
@ -5,7 +5,7 @@ config.content = [
|
||||
"./src/**/*.{html,ts}",
|
||||
"../../libs/components/src/**/*.{html,ts}",
|
||||
"../../libs/auth/src/**/*.{html,ts}",
|
||||
"../../libs/key-management/src/**/*.{html,ts}",
|
||||
"../../libs/key-management-ui/src/**/*.{html,ts}",
|
||||
"../../libs/vault/src/**/*.{html,ts}",
|
||||
"../../libs/angular/src/**/*.{html,ts}",
|
||||
"../../bitwarden_license/bit-web/src/**/*.{html,ts}",
|
||||
|
@ -21,7 +21,7 @@
|
||||
"@bitwarden/importer/core": ["../../libs/importer/src"],
|
||||
"@bitwarden/importer/ui": ["../../libs/importer/src/components"],
|
||||
"@bitwarden/key-management": ["../../libs/key-management/src"],
|
||||
"@bitwarden/key-management/angular": ["../../libs/key-management/src/angular"],
|
||||
"@bitwarden/key-management-ui": ["../../libs/key-management-ui/src"],
|
||||
"@bitwarden/platform": ["../../libs/platform/src"],
|
||||
"@bitwarden/send-ui": ["../../libs/tools/send/send-ui/src"],
|
||||
"@bitwarden/tools-card": ["../../libs/tools/card/src"],
|
||||
|
@ -24,7 +24,6 @@
|
||||
"@bitwarden/generator-history": ["../../libs/tools/generator/extensions/history/src"],
|
||||
"@bitwarden/generator-navigation": ["../../libs/tools/generator/extensions/navigation/src"],
|
||||
"@bitwarden/key-management": ["../../libs/key-management/src"],
|
||||
"@bitwarden/key-management/angular": ["../../libs/key-management/src/angular"],
|
||||
"@bitwarden/vault-export-core": [
|
||||
"../../libs/tools/export/vault-export/vault-export-core/src"
|
||||
],
|
||||
|
@ -18,7 +18,6 @@
|
||||
"@bitwarden/generator-legacy": ["../../libs/tools/generator/extensions/legacy/src"],
|
||||
"@bitwarden/generator-navigation": ["../../libs/tools/generator/extensions/navigation/src"],
|
||||
"@bitwarden/key-management": ["../../libs/key-management/src"],
|
||||
"@bitwarden/key-management/angular": ["../../libs/key-management/src/angular"],
|
||||
"@bitwarden/platform": ["../../libs/platform/src"],
|
||||
"@bitwarden/send-ui": ["../../libs/tools/send/send-ui/src"],
|
||||
"@bitwarden/tools-card": ["../../libs/tools/card/src"],
|
||||
|
@ -24,7 +24,7 @@
|
||||
"@bitwarden/importer/core": ["../../libs/importer/src"],
|
||||
"@bitwarden/importer/ui": ["../../libs/importer/src/components"],
|
||||
"@bitwarden/key-management": ["../../libs/key-management/src"],
|
||||
"@bitwarden/key-management/angular": ["../../libs/key-management/src/angular"],
|
||||
"@bitwarden/key-management-ui": ["../../libs/key-management-ui/src"],
|
||||
"@bitwarden/platform": ["../../libs/platform/src"],
|
||||
"@bitwarden/ui-common": ["../../libs/ui/common/src"],
|
||||
"@bitwarden/send-ui": ["../../libs/tools/send/send-ui/src"],
|
||||
|
@ -42,6 +42,7 @@ module.exports = {
|
||||
"<rootDir>/libs/node/jest.config.js",
|
||||
"<rootDir>/libs/vault/jest.config.js",
|
||||
"<rootDir>/libs/key-management/jest.config.js",
|
||||
"<rootDir>/libs/key-management-ui/jest.config.js",
|
||||
],
|
||||
|
||||
// Workaround for a memory leak that crashes tests in CI:
|
||||
|
@ -11,7 +11,7 @@ module.exports = {
|
||||
content: [
|
||||
"./src/**/*.{html,ts}",
|
||||
"../../libs/components/src/**/*.{html,ts}",
|
||||
"../../libs/key-management/src/**/*.{html,ts}",
|
||||
"../../libs/key-management-ui/src/**/*.{html,ts}",
|
||||
"../../libs/auth/src/**/*.{html,ts}",
|
||||
],
|
||||
safelist: [],
|
||||
|
3
libs/key-management-ui/README.md
Normal file
3
libs/key-management-ui/README.md
Normal file
@ -0,0 +1,3 @@
|
||||
# Key management UI
|
||||
|
||||
This lib represents the public API of the Key management team at Bitwarden. Modules are imported using `@bitwarden/key-management-ui`.
|
20
libs/key-management-ui/jest.config.js
Normal file
20
libs/key-management-ui/jest.config.js
Normal file
@ -0,0 +1,20 @@
|
||||
const { pathsToModuleNameMapper } = require("ts-jest");
|
||||
|
||||
const { compilerOptions } = require("../shared/tsconfig.spec");
|
||||
|
||||
const sharedConfig = require("../../libs/shared/jest.config.angular");
|
||||
|
||||
/** @type {import('jest').Config} */
|
||||
module.exports = {
|
||||
...sharedConfig,
|
||||
displayName: "libs/key management ui tests",
|
||||
preset: "jest-preset-angular",
|
||||
setupFilesAfterEnv: ["<rootDir>/test.setup.ts"],
|
||||
moduleNameMapper: pathsToModuleNameMapper(
|
||||
// lets us use @bitwarden/common/spec in tests
|
||||
{ "@bitwarden/common/spec": ["../common/spec"], ...(compilerOptions?.paths ?? {}) },
|
||||
{
|
||||
prefix: "<rootDir>/",
|
||||
},
|
||||
),
|
||||
};
|
21
libs/key-management-ui/package.json
Normal file
21
libs/key-management-ui/package.json
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "@bitwarden/key-management-ui",
|
||||
"version": "0.0.0",
|
||||
"description": "Common code used across Bitwarden JavaScript projects.",
|
||||
"keywords": [
|
||||
"bitwarden"
|
||||
],
|
||||
"author": "Bitwarden Inc.",
|
||||
"homepage": "https://bitwarden.com",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/bitwarden/clients"
|
||||
},
|
||||
"license": "GPL-3.0",
|
||||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
"build": "npm run clean && tsc",
|
||||
"build:watch": "npm run clean && tsc -watch",
|
||||
"test": "jest"
|
||||
}
|
||||
}
|
28
libs/key-management-ui/test.setup.ts
Normal file
28
libs/key-management-ui/test.setup.ts
Normal file
@ -0,0 +1,28 @@
|
||||
import { webcrypto } from "crypto";
|
||||
import "jest-preset-angular/setup-jest";
|
||||
|
||||
Object.defineProperty(window, "CSS", { value: null });
|
||||
Object.defineProperty(window, "getComputedStyle", {
|
||||
value: () => {
|
||||
return {
|
||||
display: "none",
|
||||
appearance: ["-webkit-appearance"],
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
Object.defineProperty(document, "doctype", {
|
||||
value: "<!DOCTYPE html>",
|
||||
});
|
||||
Object.defineProperty(document.body.style, "transform", {
|
||||
value: () => {
|
||||
return {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
Object.defineProperty(window, "crypto", {
|
||||
value: webcrypto,
|
||||
});
|
22
libs/key-management-ui/tsconfig.json
Normal file
22
libs/key-management-ui/tsconfig.json
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"extends": "../shared/tsconfig",
|
||||
"compilerOptions": {
|
||||
"paths": {
|
||||
"@bitwarden/admin-console/common": ["../admin-console/src/common"],
|
||||
"@bitwarden/angular/*": ["../angular/src/*"],
|
||||
"@bitwarden/auth/angular": ["../auth/src/angular"],
|
||||
"@bitwarden/auth/common": ["../auth/src/common"],
|
||||
"@bitwarden/common/*": ["../common/src/*"],
|
||||
"@bitwarden/components": ["../components/src/index.ts"],
|
||||
"@bitwarden/generator-core": ["../tools/generator/core/src"],
|
||||
"@bitwarden/generator-history": ["../tools/generator/extensions/history/src"],
|
||||
"@bitwarden/generator-legacy": ["../tools/generator/extensions/legacy/src"],
|
||||
"@bitwarden/generator-navigation": ["../tools/generator/extensions/navigation/src"],
|
||||
"@bitwarden/key-management": ["../key-management/src/index.ts"],
|
||||
"@bitwarden/platform": ["../platform/src"],
|
||||
"@bitwarden/ui-common": ["../ui/common/src"]
|
||||
}
|
||||
},
|
||||
"include": ["src", "spec"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
4
libs/key-management-ui/tsconfig.spec.json
Normal file
4
libs/key-management-ui/tsconfig.spec.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"files": ["./test.setup.ts"]
|
||||
}
|
@ -17,10 +17,5 @@
|
||||
"build": "npm run clean && tsc",
|
||||
"build:watch": "npm run clean && tsc -watch",
|
||||
"test": "jest"
|
||||
},
|
||||
"dependencies": {
|
||||
"@bitwarden/angular": "file:../angular",
|
||||
"@bitwarden/common": "file:../common",
|
||||
"@bitwarden/components": "file:../components"
|
||||
}
|
||||
}
|
||||
|
@ -3,18 +3,9 @@
|
||||
"compilerOptions": {
|
||||
"paths": {
|
||||
"@bitwarden/admin-console/common": ["../admin-console/src/common"],
|
||||
"@bitwarden/angular/*": ["../angular/src/*"],
|
||||
"@bitwarden/auth/angular": ["../auth/src/angular"],
|
||||
"@bitwarden/auth/common": ["../auth/src/common"],
|
||||
"@bitwarden/common/*": ["../common/src/*"],
|
||||
"@bitwarden/components": ["../components/src"],
|
||||
"@bitwarden/key-management": ["../key-management/src"],
|
||||
"@bitwarden/generator-core": ["../tools/generator/core/src"],
|
||||
"@bitwarden/generator-history": ["../tools/generator/extensions/history/src"],
|
||||
"@bitwarden/generator-legacy": ["../tools/generator/extensions/legacy/src"],
|
||||
"@bitwarden/generator-navigation": ["../tools/generator/extensions/navigation/src"],
|
||||
"@bitwarden/platform": ["../platform/src"],
|
||||
"@bitwarden/ui-common": ["../ui/common/src"]
|
||||
"@bitwarden/key-management": ["../key-management/src"]
|
||||
}
|
||||
},
|
||||
"include": ["src", "spec"],
|
||||
|
@ -18,7 +18,7 @@
|
||||
"@bitwarden/importer/core": ["../importer/src"],
|
||||
"@bitwarden/importer/ui": ["../importer/src/components"],
|
||||
"@bitwarden/key-management": ["../key-management/src"],
|
||||
"@bitwarden/key-management/angular": ["../key-management/src/angular"],
|
||||
"@bitwarden/key-management-ui": ["../key-management-ui/src/index.ts"],
|
||||
"@bitwarden/node/*": ["../node/src/*"],
|
||||
"@bitwarden/platform": ["../platform/src"],
|
||||
"@bitwarden/send-ui": ["../tools/send/send-ui/src"],
|
||||
|
16
package-lock.json
generated
16
package-lock.json
generated
@ -292,12 +292,12 @@
|
||||
"libs/key-management": {
|
||||
"name": "@bitwarden/key-management",
|
||||
"version": "0.0.0",
|
||||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"@bitwarden/angular": "file:../angular",
|
||||
"@bitwarden/common": "file:../common",
|
||||
"@bitwarden/components": "file:../components"
|
||||
}
|
||||
"license": "GPL-3.0"
|
||||
},
|
||||
"libs/key-management-ui": {
|
||||
"name": "@bitwarden/key-management-ui",
|
||||
"version": "0.0.0",
|
||||
"license": "GPL-3.0"
|
||||
},
|
||||
"libs/node": {
|
||||
"name": "@bitwarden/node",
|
||||
@ -4432,6 +4432,10 @@
|
||||
"resolved": "libs/key-management",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@bitwarden/key-management-ui": {
|
||||
"resolved": "libs/key-management-ui",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@bitwarden/node": {
|
||||
"resolved": "libs/node",
|
||||
"link": true
|
||||
|
@ -31,7 +31,7 @@
|
||||
"@bitwarden/importer/core": ["./libs/importer/src"],
|
||||
"@bitwarden/importer/ui": ["./libs/importer/src/components"],
|
||||
"@bitwarden/key-management": ["./libs/key-management/src"],
|
||||
"@bitwarden/key-management/angular": ["./libs/key-management/src/angular"],
|
||||
"@bitwarden/key-management-ui": ["./libs/key-management-ui/src/index,ts"],
|
||||
"@bitwarden/node/*": ["./libs/node/src/*"],
|
||||
"@bitwarden/platform": ["./libs/platform/src"],
|
||||
"@bitwarden/send-ui": [".libs/tools/send/send-ui/src"],
|
||||
|
@ -32,7 +32,7 @@
|
||||
"@bitwarden/importer/core": ["./libs/importer/src"],
|
||||
"@bitwarden/importer/ui": ["./libs/importer/src/components"],
|
||||
"@bitwarden/key-management": ["./libs/key-management/src"],
|
||||
"@bitwarden/key-management/angular": ["./libs/key-management/src/angular"],
|
||||
"@bitwarden/key-management-ui": ["./libs/key-management-ui/src"],
|
||||
"@bitwarden/node/*": ["./libs/node/src/*"],
|
||||
"@bitwarden/platform": ["./libs/platform/src"],
|
||||
"@bitwarden/send-ui": ["./libs/tools/send/send-ui/src"],
|
||||
|
Loading…
Reference in New Issue
Block a user