mirror of
https://github.com/bitwarden/browser
synced 2025-12-21 18:53:29 +00:00
moved service abstractions to jslib
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
export interface MessagingService {
|
||||
send(subscriber: string, arg?: any): void;
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
import { DeviceType } from '@bitwarden/jslib';
|
||||
|
||||
export interface PlatformUtilsService {
|
||||
getDevice(): DeviceType;
|
||||
getDeviceString(): string;
|
||||
isFirefox(): boolean;
|
||||
isChrome(): boolean;
|
||||
isEdge(): boolean;
|
||||
isOpera(): boolean;
|
||||
analyticsId(): string;
|
||||
initListSectionItemListeners(doc: Document, angular: any): void;
|
||||
getDomain(uriString: string): string;
|
||||
inSidebar(theWindow: Window): boolean;
|
||||
inTab(theWindow: Window): boolean;
|
||||
inPopout(theWindow: Window): boolean;
|
||||
inPopup(theWindow: Window): boolean;
|
||||
isViewOpen(): boolean;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
export interface StorageService {
|
||||
get<T>(key: string): Promise<T>;
|
||||
save(key: string, obj: any): Promise<any>;
|
||||
remove(key: string): Promise<any>;
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
export interface UtilsService {
|
||||
copyToClipboard(text: string, doc?: Document): void;
|
||||
getHostname(uriString: string): string;
|
||||
}
|
||||
@@ -2,7 +2,7 @@ import AppIdService from './appId.service';
|
||||
import ConstantsService from './constants.service';
|
||||
import TokenService from './token.service';
|
||||
|
||||
import { PlatformUtilsService } from './abstractions/platformUtils.service';
|
||||
import { PlatformUtilsService } from '@bitwarden/jslib';
|
||||
|
||||
import EnvironmentUrls from '../models/domain/environmentUrls';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import UtilsService from './utils.service';
|
||||
|
||||
import { StorageService } from './abstractions/storage.service';
|
||||
import { StorageService } from '@bitwarden/jslib';
|
||||
|
||||
export default class AppIdService {
|
||||
constructor(private storageService: StorageService) {
|
||||
|
||||
@@ -10,7 +10,7 @@ import TokenService from './token.service';
|
||||
import TotpService from './totp.service';
|
||||
import UtilsService from './utils.service';
|
||||
|
||||
import { PlatformUtilsService } from '../services/abstractions/platformUtils.service';
|
||||
import { PlatformUtilsService } from '@bitwarden/jslib';
|
||||
|
||||
const CardAttributes: string[] = ['autoCompleteType', 'data-stripe', 'htmlName', 'htmlID', 'label-tag',
|
||||
'placeholder', 'label-left', 'label-top'];
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { MessagingService as MessagingServiceInterface } from './abstractions/messaging.service';
|
||||
import { PlatformUtilsService } from './abstractions/platformUtils.service';
|
||||
import { MessagingService as MessagingServiceInterface, PlatformUtilsService } from '@bitwarden/jslib';
|
||||
|
||||
export default class BrowserMessagingService implements MessagingServiceInterface {
|
||||
constructor(private platformUtilsService: PlatformUtilsService) {
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import * as tldjs from 'tldjs';
|
||||
|
||||
import { DeviceType } from '@bitwarden/jslib';
|
||||
|
||||
import { PlatformUtilsService as PlatformUtilsServiceInterface } from './abstractions/platformUtils.service';
|
||||
import { DeviceType, PlatformUtilsService as PlatformUtilsServiceInterface } from '@bitwarden/jslib';
|
||||
|
||||
const AnalyticsIds = {
|
||||
[DeviceType.Chrome]: 'UA-81915606-6',
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { PlatformUtilsService } from './abstractions/platformUtils.service';
|
||||
import { StorageService as StorageServiceInterface } from './abstractions/storage.service';
|
||||
import { PlatformUtilsService, StorageService as StorageServiceInterface } from '@bitwarden/jslib';
|
||||
|
||||
export default class BrowserStorageService implements StorageServiceInterface {
|
||||
constructor(private platformUtilsService: PlatformUtilsService) {
|
||||
|
||||
@@ -17,7 +17,7 @@ import CryptoService from './crypto.service';
|
||||
import SettingsService from './settings.service';
|
||||
import UserService from './user.service';
|
||||
|
||||
import { StorageService } from './abstractions/storage.service';
|
||||
import { StorageService } from '@bitwarden/jslib';
|
||||
|
||||
const Keys = {
|
||||
ciphersPrefix: 'ciphers_',
|
||||
|
||||
@@ -6,7 +6,7 @@ import { CollectionData } from '../models/data/collectionData';
|
||||
import CryptoService from './crypto.service';
|
||||
import UserService from './user.service';
|
||||
|
||||
import { StorageService } from './abstractions/storage.service';
|
||||
import { StorageService } from '@bitwarden/jslib';
|
||||
|
||||
const Keys = {
|
||||
collectionsPrefix: 'collections_',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { PlatformUtilsService } from './abstractions/platformUtils.service';
|
||||
import { PlatformUtilsService } from '@bitwarden/jslib';
|
||||
|
||||
export default class ConstantsService {
|
||||
static readonly environmentUrlsKey: string = 'environmentUrls';
|
||||
|
||||
@@ -11,7 +11,8 @@ import ConstantsService from './constants.service';
|
||||
import UtilsService from './utils.service';
|
||||
|
||||
import { CryptoService as CryptoServiceInterface } from './abstractions/crypto.service';
|
||||
import { StorageService } from './abstractions/storage.service';
|
||||
|
||||
import { StorageService } from '@bitwarden/jslib';
|
||||
|
||||
const Keys = {
|
||||
key: 'key',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import ApiService from './api.service';
|
||||
import ConstantsService from './constants.service';
|
||||
|
||||
import { StorageService } from './abstractions/storage.service';
|
||||
import { StorageService } from '@bitwarden/jslib';
|
||||
|
||||
import EnvironmentUrls from '../models/domain/environmentUrls';
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import ApiService from './api.service';
|
||||
import CryptoService from './crypto.service';
|
||||
import UserService from './user.service';
|
||||
|
||||
import { StorageService } from './abstractions/storage.service';
|
||||
import { StorageService } from '@bitwarden/jslib';
|
||||
|
||||
const Keys = {
|
||||
foldersPrefix: 'folders_',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { PlatformUtilsService } from './abstractions/platformUtils.service';
|
||||
import { PlatformUtilsService } from '@bitwarden/jslib';
|
||||
|
||||
export default function i18nService(platformUtilsService: PlatformUtilsService) {
|
||||
const edgeMessages: any = {};
|
||||
|
||||
@@ -4,8 +4,7 @@ import ConstantsService from './constants.service';
|
||||
import CryptoService from './crypto.service';
|
||||
import FolderService from './folder.service';
|
||||
|
||||
import { PlatformUtilsService } from './abstractions/platformUtils.service';
|
||||
import { StorageService } from './abstractions/storage.service';
|
||||
import { PlatformUtilsService, StorageService } from '@bitwarden/jslib';
|
||||
|
||||
export default class LockService {
|
||||
constructor(private cipherService: CipherService, private folderService: FolderService,
|
||||
|
||||
@@ -4,7 +4,7 @@ import PasswordHistory from '../models/domain/passwordHistory';
|
||||
import CryptoService from './crypto.service';
|
||||
import UtilsService from './utils.service';
|
||||
|
||||
import { StorageService } from './abstractions/storage.service';
|
||||
import { StorageService } from '@bitwarden/jslib';
|
||||
|
||||
const DefaultOptions = {
|
||||
length: 14,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import UserService from './user.service';
|
||||
|
||||
import { StorageService } from './abstractions/storage.service';
|
||||
import { StorageService } from '@bitwarden/jslib';
|
||||
|
||||
const Keys = {
|
||||
settingsPrefix: 'settings_',
|
||||
|
||||
@@ -17,8 +17,7 @@ import FolderService from './folder.service';
|
||||
import SettingsService from './settings.service';
|
||||
import UserService from './user.service';
|
||||
|
||||
import { MessagingService } from './abstractions/messaging.service';
|
||||
import { StorageService } from './abstractions/storage.service';
|
||||
import { MessagingService, StorageService } from '@bitwarden/jslib';
|
||||
|
||||
const Keys = {
|
||||
lastSyncPrefix: 'lastSync_',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import ConstantsService from './constants.service';
|
||||
import UtilsService from './utils.service';
|
||||
|
||||
import { StorageService } from './abstractions/storage.service';
|
||||
import { StorageService } from '@bitwarden/jslib';
|
||||
|
||||
const Keys = {
|
||||
accessToken: 'accessToken',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import ConstantsService from './constants.service';
|
||||
|
||||
import { StorageService } from './abstractions/storage.service';
|
||||
import { StorageService } from '@bitwarden/jslib';
|
||||
|
||||
const b32Chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import TokenService from './token.service';
|
||||
|
||||
import { StorageService } from './abstractions/storage.service';
|
||||
import { StorageService } from '@bitwarden/jslib';
|
||||
|
||||
const Keys = {
|
||||
userId: 'userId',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { UtilsService as UtilsServiceInterface } from './abstractions/utils.service';
|
||||
import { UtilsService as UtilsServiceInterface } from '@bitwarden/jslib';
|
||||
|
||||
export default class UtilsService implements UtilsServiceInterface {
|
||||
static copyToClipboard(text: string, doc?: Document): void {
|
||||
|
||||
Reference in New Issue
Block a user