From dc15edcd4d1aa7d4df26891e0b4d87edf5d7edc2 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Sat, 6 Jan 2018 14:22:55 -0500 Subject: [PATCH] moved all enums to jslib --- src/background/main.background.ts | 2 +- src/background/runtime.background.ts | 2 +- src/enums/cipherType.enum.ts | 6 ------ src/enums/deviceType.enum.ts | 8 -------- src/enums/encryptionType.enum.ts | 9 --------- src/enums/fieldType.enum.ts | 5 ----- src/enums/secureNoteType.enum.ts | 3 --- src/models/data/fieldData.ts | 2 +- src/models/data/secureNoteData.ts | 2 +- src/models/domain/cipher.ts | 2 +- src/models/domain/cipherString.ts | 2 +- src/models/domain/field.ts | 2 +- src/models/domain/secureNote.ts | 2 +- src/models/request/cipherRequest.ts | 2 +- src/models/request/deviceRequest.ts | 2 +- src/models/response/deviceResponse.ts | 2 +- src/popup/app/current/current.component.ts | 2 +- src/popup/app/settings/settings.component.ts | 4 +++- src/popup/app/tools/export.component.ts | 2 +- src/services/abstractions/platformUtils.service.ts | 2 +- src/services/autofill.service.ts | 4 ++-- src/services/browserPlatformUtils.service.spec.ts | 2 +- src/services/browserPlatformUtils.service.ts | 4 +++- src/services/cipher.service.ts | 2 +- src/services/crypto.service.ts | 2 +- 25 files changed, 25 insertions(+), 52 deletions(-) delete mode 100644 src/enums/cipherType.enum.ts delete mode 100644 src/enums/deviceType.enum.ts delete mode 100644 src/enums/encryptionType.enum.ts delete mode 100644 src/enums/fieldType.enum.ts delete mode 100644 src/enums/secureNoteType.enum.ts diff --git a/src/background/main.background.ts b/src/background/main.background.ts index 98a6875ec6..8afab53ecc 100644 --- a/src/background/main.background.ts +++ b/src/background/main.background.ts @@ -1,4 +1,4 @@ -import { CipherType } from '../enums/cipherType.enum'; +import { CipherType } from '@bitwarden/jslib'; import { Cipher } from '../models/domain/cipher'; diff --git a/src/background/runtime.background.ts b/src/background/runtime.background.ts index 8213cff93a..c9444fadba 100644 --- a/src/background/runtime.background.ts +++ b/src/background/runtime.background.ts @@ -1,4 +1,4 @@ -import { CipherType } from '../enums/cipherType.enum'; +import { CipherType } from '@bitwarden/jslib'; import BrowserApi from '../browser/browserApi'; diff --git a/src/enums/cipherType.enum.ts b/src/enums/cipherType.enum.ts deleted file mode 100644 index c081fb2d8c..0000000000 --- a/src/enums/cipherType.enum.ts +++ /dev/null @@ -1,6 +0,0 @@ -export enum CipherType { - Login = 1, - SecureNote = 2, - Card = 3, - Identity = 4, -} diff --git a/src/enums/deviceType.enum.ts b/src/enums/deviceType.enum.ts deleted file mode 100644 index 3c00cf9ae2..0000000000 --- a/src/enums/deviceType.enum.ts +++ /dev/null @@ -1,8 +0,0 @@ -export enum DeviceType { - Chrome = 2, - Firefox = 3, - Opera = 4, - Edge = 5, - Vivaldi = 19, - Safari = 20, -} diff --git a/src/enums/encryptionType.enum.ts b/src/enums/encryptionType.enum.ts deleted file mode 100644 index 7a0caa6606..0000000000 --- a/src/enums/encryptionType.enum.ts +++ /dev/null @@ -1,9 +0,0 @@ -export enum EncryptionType { - AesCbc256_B64 = 0, - AesCbc128_HmacSha256_B64 = 1, - AesCbc256_HmacSha256_B64 = 2, - Rsa2048_OaepSha256_B64 = 3, - Rsa2048_OaepSha1_B64 = 4, - Rsa2048_OaepSha256_HmacSha256_B64 = 5, - Rsa2048_OaepSha1_HmacSha256_B64 = 6, -} diff --git a/src/enums/fieldType.enum.ts b/src/enums/fieldType.enum.ts deleted file mode 100644 index c28b26c1da..0000000000 --- a/src/enums/fieldType.enum.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum FieldType { - Text = 0, - Hidden = 1, - Boolean = 2, -} diff --git a/src/enums/secureNoteType.enum.ts b/src/enums/secureNoteType.enum.ts deleted file mode 100644 index c7f3e44a78..0000000000 --- a/src/enums/secureNoteType.enum.ts +++ /dev/null @@ -1,3 +0,0 @@ -export enum SecureNoteType { - Generic = 0, -} diff --git a/src/models/data/fieldData.ts b/src/models/data/fieldData.ts index 4914bb6ef9..c7d28df368 100644 --- a/src/models/data/fieldData.ts +++ b/src/models/data/fieldData.ts @@ -1,4 +1,4 @@ -import { FieldType } from '../../enums/fieldType.enum'; +import { FieldType } from '@bitwarden/jslib'; class FieldData { type: FieldType; diff --git a/src/models/data/secureNoteData.ts b/src/models/data/secureNoteData.ts index ccfc9bd614..832bf1b6df 100644 --- a/src/models/data/secureNoteData.ts +++ b/src/models/data/secureNoteData.ts @@ -1,4 +1,4 @@ -import { SecureNoteType } from '../../enums/secureNoteType.enum'; +import { SecureNoteType } from '@bitwarden/jslib'; class SecureNoteData { type: SecureNoteType; diff --git a/src/models/domain/cipher.ts b/src/models/domain/cipher.ts index 5c2a4f5b04..d4aba918ae 100644 --- a/src/models/domain/cipher.ts +++ b/src/models/domain/cipher.ts @@ -1,4 +1,4 @@ -import { CipherType } from '../../enums/cipherType.enum'; +import { CipherType } from '@bitwarden/jslib'; import { CipherData } from '../data/cipherData'; diff --git a/src/models/domain/cipherString.ts b/src/models/domain/cipherString.ts index ce3a184aae..be88b6ebd6 100644 --- a/src/models/domain/cipherString.ts +++ b/src/models/domain/cipherString.ts @@ -1,4 +1,4 @@ -import { EncryptionType } from '../../enums/encryptionType.enum'; +import { EncryptionType } from '@bitwarden/jslib'; import ContainerService from '../../services/container.service'; diff --git a/src/models/domain/field.ts b/src/models/domain/field.ts index decc78664f..2fa4f6d143 100644 --- a/src/models/domain/field.ts +++ b/src/models/domain/field.ts @@ -1,4 +1,4 @@ -import { FieldType } from '../../enums/fieldType.enum'; +import { FieldType } from '@bitwarden/jslib'; import { FieldData } from '../data/fieldData'; diff --git a/src/models/domain/secureNote.ts b/src/models/domain/secureNote.ts index 2c742f8ea8..e2ff830eaa 100644 --- a/src/models/domain/secureNote.ts +++ b/src/models/domain/secureNote.ts @@ -1,4 +1,4 @@ -import { SecureNoteType } from '../../enums/secureNoteType.enum'; +import { SecureNoteType } from '@bitwarden/jslib'; import { SecureNoteData } from '../data/secureNoteData'; diff --git a/src/models/request/cipherRequest.ts b/src/models/request/cipherRequest.ts index 659ee5be2d..956f7d3d62 100644 --- a/src/models/request/cipherRequest.ts +++ b/src/models/request/cipherRequest.ts @@ -1,4 +1,4 @@ -import { CipherType } from '../../enums/cipherType.enum'; +import { CipherType } from '@bitwarden/jslib'; class CipherRequest { type: CipherType; diff --git a/src/models/request/deviceRequest.ts b/src/models/request/deviceRequest.ts index 857ba7129e..6a73f83a5b 100644 --- a/src/models/request/deviceRequest.ts +++ b/src/models/request/deviceRequest.ts @@ -1,4 +1,4 @@ -import { DeviceType } from '../../enums/deviceType.enum'; +import { DeviceType } from '@bitwarden/jslib'; import { PlatformUtilsService } from '../../services/abstractions/platformUtils.service'; class DeviceRequest { diff --git a/src/models/response/deviceResponse.ts b/src/models/response/deviceResponse.ts index 40b699452a..0ef59ba27d 100644 --- a/src/models/response/deviceResponse.ts +++ b/src/models/response/deviceResponse.ts @@ -1,4 +1,4 @@ -import { DeviceType } from '../../enums/deviceType.enum'; +import { DeviceType } from '@bitwarden/jslib'; class DeviceResponse { id: string; diff --git a/src/popup/app/current/current.component.ts b/src/popup/app/current/current.component.ts index ebac19526e..d32ea67482 100644 --- a/src/popup/app/current/current.component.ts +++ b/src/popup/app/current/current.component.ts @@ -1,4 +1,4 @@ -import { CipherType } from '../../../enums/cipherType.enum'; +import { CipherType } from '@bitwarden/jslib'; import { PlatformUtilsService } from '../../../services/abstractions/platformUtils.service'; import { UtilsService } from '../../../services/abstractions/utils.service'; diff --git a/src/popup/app/settings/settings.component.ts b/src/popup/app/settings/settings.component.ts index be030e8284..cc0996a379 100644 --- a/src/popup/app/settings/settings.component.ts +++ b/src/popup/app/settings/settings.component.ts @@ -1,5 +1,7 @@ import * as angular from 'angular'; -import { DeviceType } from '../../../enums/deviceType.enum'; + +import { DeviceType } from '@bitwarden/jslib'; + import { CryptoService } from '../../../services/abstractions/crypto.service'; import { MessagingService } from '../../../services/abstractions/messaging.service'; import { PlatformUtilsService } from '../../../services/abstractions/platformUtils.service'; diff --git a/src/popup/app/tools/export.component.ts b/src/popup/app/tools/export.component.ts index 0fa9f63145..0a3c8e6564 100644 --- a/src/popup/app/tools/export.component.ts +++ b/src/popup/app/tools/export.component.ts @@ -2,7 +2,7 @@ import * as angular from 'angular'; import * as papa from 'papaparse'; import * as template from './export.component.html'; -import { CipherType } from '../../../enums/cipherType.enum'; +import { CipherType } from '@bitwarden/jslib'; import { CryptoService } from '../../../services/abstractions/crypto.service'; import { UtilsService } from '../../../services/abstractions/utils.service'; diff --git a/src/services/abstractions/platformUtils.service.ts b/src/services/abstractions/platformUtils.service.ts index 063c18dcdd..f1d78f5a7b 100644 --- a/src/services/abstractions/platformUtils.service.ts +++ b/src/services/abstractions/platformUtils.service.ts @@ -1,4 +1,4 @@ -import { DeviceType } from '../../enums/deviceType.enum'; +import { DeviceType } from '@bitwarden/jslib'; export interface PlatformUtilsService { getDevice(): DeviceType; diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index bf03fea5bf..8463635d2a 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -1,5 +1,5 @@ -import { CipherType } from '../enums/cipherType.enum'; -import { FieldType } from '../enums/fieldType.enum'; +import { CipherType } from '@bitwarden/jslib'; +import { FieldType } from '@bitwarden/jslib'; import AutofillField from '../models/domain/autofillField'; import AutofillPageDetails from '../models/domain/autofillPageDetails'; diff --git a/src/services/browserPlatformUtils.service.spec.ts b/src/services/browserPlatformUtils.service.spec.ts index 84b42d421f..369b8d7d27 100644 --- a/src/services/browserPlatformUtils.service.spec.ts +++ b/src/services/browserPlatformUtils.service.spec.ts @@ -1,5 +1,5 @@ import BrowserPlatformUtilsService from './browserPlatformUtils.service'; -import { DeviceType } from '../enums/deviceType.enum'; +import { DeviceType } from '@bitwarden/jslib'; describe('Browser Utils Service', () => { describe('getDomain', () => { diff --git a/src/services/browserPlatformUtils.service.ts b/src/services/browserPlatformUtils.service.ts index 0db30957eb..f926884893 100644 --- a/src/services/browserPlatformUtils.service.ts +++ b/src/services/browserPlatformUtils.service.ts @@ -1,5 +1,7 @@ import * as tldjs from 'tldjs'; -import { DeviceType } from '../enums/deviceType.enum'; + +import { DeviceType } from '@bitwarden/jslib'; + import { PlatformUtilsService as PlatformUtilsServiceInterface } from './abstractions/platformUtils.service'; const AnalyticsIds = { diff --git a/src/services/cipher.service.ts b/src/services/cipher.service.ts index 9159b06120..2f7f79c896 100644 --- a/src/services/cipher.service.ts +++ b/src/services/cipher.service.ts @@ -1,4 +1,4 @@ -import { CipherType } from '../enums/cipherType.enum'; +import { CipherType } from '@bitwarden/jslib'; import { Cipher } from '../models/domain/cipher'; import { CipherString } from '../models/domain/cipherString'; diff --git a/src/services/crypto.service.ts b/src/services/crypto.service.ts index 0a53466b89..f62c776e21 100644 --- a/src/services/crypto.service.ts +++ b/src/services/crypto.service.ts @@ -1,6 +1,6 @@ import * as forge from 'node-forge'; -import { EncryptionType } from '../enums/encryptionType.enum'; +import { EncryptionType } from '@bitwarden/jslib'; import { CipherString } from '../models/domain/cipherString'; import EncryptedObject from '../models/domain/encryptedObject';