mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-23 11:56:00 +01:00
convert constants service to ts
This commit is contained in:
parent
34ae8adf4d
commit
acbfac6df3
@ -5,11 +5,7 @@
|
|||||||
<script type="text/javascript" src="lib/tldjs/tld.js"></script>
|
<script type="text/javascript" src="lib/tldjs/tld.js"></script>
|
||||||
<script type="text/javascript" src="lib/forge/forge.js"></script>
|
<script type="text/javascript" src="lib/forge/forge.js"></script>
|
||||||
<script type="text/javascript" src="models/api/requestModels.js"></script>
|
<script type="text/javascript" src="models/api/requestModels.js"></script>
|
||||||
<script type="text/javascript" src="models/api/responseModels.js"></script>
|
|
||||||
<script type="text/javascript" src="models/dataModels.js"></script>
|
|
||||||
<script type="text/javascript" src="models/domainModels.js"></script>
|
<script type="text/javascript" src="models/domainModels.js"></script>
|
||||||
<script type="text/javascript" src="services/i18nService.js"></script>
|
|
||||||
<script type="text/javascript" src="services/constantsService.js"></script>
|
|
||||||
<script type="text/javascript" src="services/cryptoService.js"></script>
|
<script type="text/javascript" src="services/cryptoService.js"></script>
|
||||||
<script type="text/javascript" src="services/tokenService.js"></script>
|
<script type="text/javascript" src="services/tokenService.js"></script>
|
||||||
<script type="text/javascript" src="services/apiService.js"></script>
|
<script type="text/javascript" src="services/apiService.js"></script>
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
// Service imports
|
// Service imports
|
||||||
|
import ConstantsService from './services/constants.service';
|
||||||
|
import i18nService from './services/i18nService.js';
|
||||||
import LockService from './services/lockService.js';
|
import LockService from './services/lockService.js';
|
||||||
import UtilsService from './services/utils.service';
|
import UtilsService from './services/utils.service';
|
||||||
|
|
||||||
|
94
src/services/constants.service.ts
Normal file
94
src/services/constants.service.ts
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
export default class ConstantsService {
|
||||||
|
// TODO: these should probably all be made static
|
||||||
|
readonly environmentUrlsKey: string = 'environmentUrls';
|
||||||
|
readonly disableGaKey: string = 'disableGa';
|
||||||
|
readonly disableAddLoginNotificationKey: string = 'disableAddLoginNotification';
|
||||||
|
readonly disableContextMenuItemKey: string = 'disableContextMenuItem';
|
||||||
|
readonly disableFaviconKey: string = 'disableFavicon';
|
||||||
|
readonly disableAutoTotpCopyKey: string = 'disableAutoTotpCopy';
|
||||||
|
readonly enableAutoFillOnPageLoadKey: string = 'enableAutoFillOnPageLoad';
|
||||||
|
readonly lockOptionKey: string = 'lockOption';
|
||||||
|
readonly lastActiveKey: string = 'lastActive';
|
||||||
|
readonly generatedPasswordHistoryKey: string = 'generatedPasswordHistory';
|
||||||
|
|
||||||
|
// TODO: Convert these objects to enums
|
||||||
|
readonly encType: any = {
|
||||||
|
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,
|
||||||
|
};
|
||||||
|
|
||||||
|
readonly cipherType: any = {
|
||||||
|
login: 1,
|
||||||
|
secureNote: 2,
|
||||||
|
card: 3,
|
||||||
|
identity: 4,
|
||||||
|
};
|
||||||
|
|
||||||
|
readonly fieldType: any = {
|
||||||
|
text: 0,
|
||||||
|
hidden: 1,
|
||||||
|
boolean: 2,
|
||||||
|
};
|
||||||
|
|
||||||
|
readonly twoFactorProvider: any = {
|
||||||
|
u2f: 4,
|
||||||
|
yubikey: 3,
|
||||||
|
duo: 2,
|
||||||
|
authenticator: 0,
|
||||||
|
email: 1,
|
||||||
|
remember: 5,
|
||||||
|
};
|
||||||
|
|
||||||
|
readonly twoFactorProviderInfo: any[];
|
||||||
|
|
||||||
|
constructor(i18nService: any) {
|
||||||
|
this.twoFactorProviderInfo = [
|
||||||
|
{
|
||||||
|
type: 0,
|
||||||
|
name: i18nService.authenticatorAppTitle,
|
||||||
|
description: i18nService.authenticatorAppDesc,
|
||||||
|
active: true,
|
||||||
|
free: true,
|
||||||
|
displayOrder: 0,
|
||||||
|
priority: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 3,
|
||||||
|
name: i18nService.yubiKeyTitle,
|
||||||
|
description: i18nService.yubiKeyDesc,
|
||||||
|
active: true,
|
||||||
|
displayOrder: 1,
|
||||||
|
priority: 3,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 2,
|
||||||
|
name: 'Duo',
|
||||||
|
description: i18nService.duoDesc,
|
||||||
|
active: true,
|
||||||
|
displayOrder: 2,
|
||||||
|
priority: 2,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 4,
|
||||||
|
name: i18nService.u2fTitle,
|
||||||
|
description: i18nService.u2fDesc,
|
||||||
|
active: true,
|
||||||
|
displayOrder: 3,
|
||||||
|
priority: 4,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 1,
|
||||||
|
name: i18nService.emailTitle,
|
||||||
|
description: i18nService.emailDesc,
|
||||||
|
active: true,
|
||||||
|
displayOrder: 4,
|
||||||
|
priority: 0,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
@ -1,85 +0,0 @@
|
|||||||
function ConstantsService(i18nService) {
|
|
||||||
return {
|
|
||||||
environmentUrlsKey: 'environmentUrls',
|
|
||||||
disableGaKey: 'disableGa',
|
|
||||||
disableAddLoginNotificationKey: 'disableAddLoginNotification',
|
|
||||||
disableContextMenuItemKey: 'disableContextMenuItem',
|
|
||||||
disableFaviconKey: 'disableFavicon',
|
|
||||||
disableAutoTotpCopyKey: 'disableAutoTotpCopy',
|
|
||||||
enableAutoFillOnPageLoadKey: 'enableAutoFillOnPageLoad',
|
|
||||||
lockOptionKey: 'lockOption',
|
|
||||||
lastActiveKey: 'lastActive',
|
|
||||||
generatedPasswordHistory: 'generatedPasswordHistory',
|
|
||||||
encType: {
|
|
||||||
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
|
|
||||||
},
|
|
||||||
cipherType: {
|
|
||||||
login: 1,
|
|
||||||
secureNote: 2,
|
|
||||||
card: 3,
|
|
||||||
identity: 4
|
|
||||||
},
|
|
||||||
fieldType: {
|
|
||||||
text: 0,
|
|
||||||
hidden: 1,
|
|
||||||
boolean: 2
|
|
||||||
},
|
|
||||||
twoFactorProvider: {
|
|
||||||
u2f: 4,
|
|
||||||
yubikey: 3,
|
|
||||||
duo: 2,
|
|
||||||
authenticator: 0,
|
|
||||||
email: 1,
|
|
||||||
remember: 5
|
|
||||||
},
|
|
||||||
twoFactorProviderInfo: [
|
|
||||||
{
|
|
||||||
type: 0,
|
|
||||||
name: i18nService.authenticatorAppTitle,
|
|
||||||
description: i18nService.authenticatorAppDesc,
|
|
||||||
active: true,
|
|
||||||
free: true,
|
|
||||||
displayOrder: 0,
|
|
||||||
priority: 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 3,
|
|
||||||
name: i18nService.yubiKeyTitle,
|
|
||||||
description: i18nService.yubiKeyDesc,
|
|
||||||
active: true,
|
|
||||||
displayOrder: 1,
|
|
||||||
priority: 3
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 2,
|
|
||||||
name: 'Duo',
|
|
||||||
description: i18nService.duoDesc,
|
|
||||||
active: true,
|
|
||||||
displayOrder: 2,
|
|
||||||
priority: 2
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 4,
|
|
||||||
name: i18nService.u2fTitle,
|
|
||||||
description: i18nService.u2fDesc,
|
|
||||||
active: true,
|
|
||||||
displayOrder: 3,
|
|
||||||
priority: 4
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 1,
|
|
||||||
name: i18nService.emailTitle,
|
|
||||||
description: i18nService.emailDesc,
|
|
||||||
active: true,
|
|
||||||
displayOrder: 4,
|
|
||||||
priority: 0
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
|
||||||
}
|
|
@ -1,4 +1,4 @@
|
|||||||
function i18nService(utilsService) {
|
export default function i18nService(utilsService) {
|
||||||
this.utilsService = utilsService;
|
this.utilsService = utilsService;
|
||||||
this.messages = {};
|
this.messages = {};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user