@bitwarden/cli 2022.6.2 → 2022.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bw.js +1230 -540
- package/build/bw.js.map +1 -1
- package/package.json +9 -9
package/build/bw.js
CHANGED
|
@@ -20,7 +20,7 @@ module.exports = require("url");
|
|
|
20
20
|
/***/ 147:
|
|
21
21
|
/***/ ((module) => {
|
|
22
22
|
|
|
23
|
-
module.exports = JSON.parse('{"name":"@bitwarden/cli","description":"A secure and free password manager for all of your devices.","version":"2022.
|
|
23
|
+
module.exports = JSON.parse('{"name":"@bitwarden/cli","description":"A secure and free password manager for all of your devices.","version":"2022.8.0","keywords":["bitwarden","password","vault","password manager","cli"],"author":"Bitwarden Inc. <hello@bitwarden.com> (https://bitwarden.com)","homepage":"https://bitwarden.com","repository":{"type":"git","url":"https://github.com/bitwarden/cli"},"license":"GPL-3.0-only","scripts":{"clean":"rimraf dist/**/*","build":"webpack","build:debug":"npm run build && node --inspect ./build/bw.js","build:watch":"webpack --watch","build:prod":"cross-env NODE_ENV=production webpack","build:prod:watch":"cross-env NODE_ENV=production webpack --watch","package":"npm run package:win && npm run package:mac && npm run package:lin","package:win":"pkg . --targets win-x64 --output ./dist/windows/bw.exe --build","package:mac":"pkg . --targets macos-x64 --output ./dist/macos/bw","package:lin":"pkg . --targets linux-x64 --output ./dist/linux/bw","debug":"node --inspect ./build/bw.js","dist":"npm run build:prod && npm run clean && npm run package","dist:win":"npm run build:prod && npm run clean && npm run package:win","dist:mac":"npm run build:prod && npm run clean && npm run package:mac","dist:lin":"npm run build:prod && npm run clean && npm run package:lin","publish:npm":"npm run build:prod && npm publish --access public","test":"jest","test:watch":"jest --watch","test:watch:all":"jest --watchAll"},"bin":{"bw":"build/bw.js"},"pkg":{"assets":"./build/**/*"},"dependencies":{"@koa/multer":"^3.0.0","@koa/router":"^10.1.1","big-integer":"^1.6.51","browser-hrtime":"^1.1.8","chalk":"^4.1.1","commander":"7.2.0","form-data":"4.0.0","https-proxy-agent":"5.0.0","inquirer":"8.0.0","jsdom":"^16.7.0","jszip":"^3.10.0","koa":"^2.13.4","koa-bodyparser":"^4.3.0","koa-json":"^2.0.2","lowdb":"1.0.0","lunr":"^2.3.9","multer":"^1.4.5-lts.1","node-fetch":"^2.6.7","node-forge":"1.3.1","open":"^8.4.0","papaparse":"^5.3.2","proper-lockfile":"^4.1.2","rxjs":"^7.5.5","tldjs":"^2.3.1","zxcvbn":"^4.4.2"}}');
|
|
24
24
|
|
|
25
25
|
/***/ })
|
|
26
26
|
|
|
@@ -178,10 +178,15 @@ class EncryptionPair {
|
|
|
178
178
|
}
|
|
179
179
|
class DataEncryptionPair {
|
|
180
180
|
}
|
|
181
|
+
// This is a temporary structure to handle migrated `DataEncryptionPair` to
|
|
182
|
+
// avoid needing a data migration at this stage. It should be replaced with
|
|
183
|
+
// proper data migrations when `DataEncryptionPair` is deprecated.
|
|
184
|
+
class TemporaryDataEncryption {
|
|
185
|
+
}
|
|
181
186
|
class AccountData {
|
|
182
187
|
constructor() {
|
|
183
188
|
this.ciphers = new DataEncryptionPair();
|
|
184
|
-
this.folders = new
|
|
189
|
+
this.folders = new TemporaryDataEncryption();
|
|
185
190
|
this.sends = new DataEncryptionPair();
|
|
186
191
|
this.collections = new DataEncryptionPair();
|
|
187
192
|
this.policies = new DataEncryptionPair();
|
|
@@ -231,7 +236,8 @@ var StateVersion;
|
|
|
231
236
|
StateVersion[StateVersion["Two"] = 2] = "Two";
|
|
232
237
|
StateVersion[StateVersion["Three"] = 3] = "Three";
|
|
233
238
|
StateVersion[StateVersion["Four"] = 4] = "Four";
|
|
234
|
-
StateVersion[StateVersion["
|
|
239
|
+
StateVersion[StateVersion["Five"] = 5] = "Five";
|
|
240
|
+
StateVersion[StateVersion["Latest"] = 5] = "Latest";
|
|
235
241
|
})(StateVersion || (StateVersion = {}));
|
|
236
242
|
|
|
237
243
|
;// CONCATENATED MODULE: ../../libs/common/src/enums/themeType.ts
|
|
@@ -1567,6 +1573,32 @@ class AuthService {
|
|
|
1567
1573
|
}
|
|
1568
1574
|
}
|
|
1569
1575
|
|
|
1576
|
+
;// CONCATENATED MODULE: ../../libs/common/src/services/broadcaster.service.ts
|
|
1577
|
+
class BroadcasterService {
|
|
1578
|
+
constructor() {
|
|
1579
|
+
this.subscribers = new Map();
|
|
1580
|
+
}
|
|
1581
|
+
send(message, id) {
|
|
1582
|
+
if (id != null) {
|
|
1583
|
+
if (this.subscribers.has(id)) {
|
|
1584
|
+
this.subscribers.get(id)(message);
|
|
1585
|
+
}
|
|
1586
|
+
return;
|
|
1587
|
+
}
|
|
1588
|
+
this.subscribers.forEach((value) => {
|
|
1589
|
+
value(message);
|
|
1590
|
+
});
|
|
1591
|
+
}
|
|
1592
|
+
subscribe(id, messageCallback) {
|
|
1593
|
+
this.subscribers.set(id, messageCallback);
|
|
1594
|
+
}
|
|
1595
|
+
unsubscribe(id) {
|
|
1596
|
+
if (this.subscribers.has(id)) {
|
|
1597
|
+
this.subscribers.delete(id);
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1570
1602
|
;// CONCATENATED MODULE: ../../libs/common/src/enums/cipherType.ts
|
|
1571
1603
|
var CipherType;
|
|
1572
1604
|
(function (CipherType) {
|
|
@@ -2098,6 +2130,21 @@ class SymmetricCryptoKey {
|
|
|
2098
2130
|
this.macKeyB64 = Utils.fromBufferToB64(this.macKey);
|
|
2099
2131
|
}
|
|
2100
2132
|
}
|
|
2133
|
+
static initFromJson(jsonResult) {
|
|
2134
|
+
if (jsonResult == null) {
|
|
2135
|
+
return jsonResult;
|
|
2136
|
+
}
|
|
2137
|
+
if (jsonResult.keyB64 != null) {
|
|
2138
|
+
jsonResult.key = Utils.fromB64ToArray(jsonResult.keyB64).buffer;
|
|
2139
|
+
}
|
|
2140
|
+
if (jsonResult.encKeyB64 != null) {
|
|
2141
|
+
jsonResult.encKey = Utils.fromB64ToArray(jsonResult.encKeyB64).buffer;
|
|
2142
|
+
}
|
|
2143
|
+
if (jsonResult.macKeyB64 != null) {
|
|
2144
|
+
jsonResult.macKey = Utils.fromB64ToArray(jsonResult.macKeyB64).buffer;
|
|
2145
|
+
}
|
|
2146
|
+
return jsonResult;
|
|
2147
|
+
}
|
|
2101
2148
|
}
|
|
2102
2149
|
|
|
2103
2150
|
;// CONCATENATED MODULE: ../../libs/common/src/models/domain/attachment.ts
|
|
@@ -13006,6 +13053,68 @@ class EncArrayBuffer {
|
|
|
13006
13053
|
class EncryptedObject {
|
|
13007
13054
|
}
|
|
13008
13055
|
|
|
13056
|
+
;// CONCATENATED MODULE: ../../libs/common/src/models/domain/encryptedOrganizationKey.ts
|
|
13057
|
+
var encryptedOrganizationKey_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13058
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
13059
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
13060
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
13061
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
13062
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
13063
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
13064
|
+
});
|
|
13065
|
+
};
|
|
13066
|
+
|
|
13067
|
+
|
|
13068
|
+
class BaseEncryptedOrganizationKey {
|
|
13069
|
+
static fromData(data) {
|
|
13070
|
+
switch (data.type) {
|
|
13071
|
+
case "organization":
|
|
13072
|
+
return new EncryptedOrganizationKey(data.key);
|
|
13073
|
+
case "provider":
|
|
13074
|
+
return new ProviderEncryptedOrganizationKey(data.key, data.providerId);
|
|
13075
|
+
default:
|
|
13076
|
+
return null;
|
|
13077
|
+
}
|
|
13078
|
+
}
|
|
13079
|
+
}
|
|
13080
|
+
class EncryptedOrganizationKey {
|
|
13081
|
+
constructor(key) {
|
|
13082
|
+
this.key = key;
|
|
13083
|
+
}
|
|
13084
|
+
decrypt(cryptoService) {
|
|
13085
|
+
return encryptedOrganizationKey_awaiter(this, void 0, void 0, function* () {
|
|
13086
|
+
const decValue = yield cryptoService.rsaDecrypt(this.key);
|
|
13087
|
+
return new SymmetricCryptoKey(decValue);
|
|
13088
|
+
});
|
|
13089
|
+
}
|
|
13090
|
+
toData() {
|
|
13091
|
+
return {
|
|
13092
|
+
type: "organization",
|
|
13093
|
+
key: this.key,
|
|
13094
|
+
};
|
|
13095
|
+
}
|
|
13096
|
+
}
|
|
13097
|
+
class ProviderEncryptedOrganizationKey {
|
|
13098
|
+
constructor(key, providerId) {
|
|
13099
|
+
this.key = key;
|
|
13100
|
+
this.providerId = providerId;
|
|
13101
|
+
}
|
|
13102
|
+
decrypt(cryptoService) {
|
|
13103
|
+
return encryptedOrganizationKey_awaiter(this, void 0, void 0, function* () {
|
|
13104
|
+
const providerKey = yield cryptoService.getProviderKey(this.providerId);
|
|
13105
|
+
const decValue = yield cryptoService.decryptToBytes(new EncString(this.key), providerKey);
|
|
13106
|
+
return new SymmetricCryptoKey(decValue);
|
|
13107
|
+
});
|
|
13108
|
+
}
|
|
13109
|
+
toData() {
|
|
13110
|
+
return {
|
|
13111
|
+
type: "provider",
|
|
13112
|
+
key: this.key,
|
|
13113
|
+
providerId: this.providerId,
|
|
13114
|
+
};
|
|
13115
|
+
}
|
|
13116
|
+
}
|
|
13117
|
+
|
|
13009
13118
|
;// CONCATENATED MODULE: ../../libs/common/src/services/crypto.service.ts
|
|
13010
13119
|
var crypto_service_decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
13011
13120
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -13037,9 +13146,11 @@ var crypto_service_awaiter = (undefined && undefined.__awaiter) || function (thi
|
|
|
13037
13146
|
|
|
13038
13147
|
|
|
13039
13148
|
|
|
13149
|
+
|
|
13040
13150
|
class CryptoService {
|
|
13041
|
-
constructor(cryptoFunctionService, platformUtilService, logService, stateService) {
|
|
13151
|
+
constructor(cryptoFunctionService, encryptService, platformUtilService, logService, stateService) {
|
|
13042
13152
|
this.cryptoFunctionService = cryptoFunctionService;
|
|
13153
|
+
this.encryptService = encryptService;
|
|
13043
13154
|
this.platformUtilService = platformUtilService;
|
|
13044
13155
|
this.logService = logService;
|
|
13045
13156
|
this.stateService = stateService;
|
|
@@ -13073,20 +13184,24 @@ class CryptoService {
|
|
|
13073
13184
|
yield this.stateService.setEncryptedPrivateKey(encPrivateKey);
|
|
13074
13185
|
});
|
|
13075
13186
|
}
|
|
13076
|
-
setOrgKeys(orgs, providerOrgs) {
|
|
13187
|
+
setOrgKeys(orgs = [], providerOrgs = []) {
|
|
13077
13188
|
return crypto_service_awaiter(this, void 0, void 0, function* () {
|
|
13078
|
-
const
|
|
13189
|
+
const encOrgKeyData = {};
|
|
13079
13190
|
orgs.forEach((org) => {
|
|
13080
|
-
|
|
13191
|
+
encOrgKeyData[org.id] = {
|
|
13192
|
+
type: "organization",
|
|
13193
|
+
key: org.key,
|
|
13194
|
+
};
|
|
13195
|
+
});
|
|
13196
|
+
providerOrgs.forEach((org) => {
|
|
13197
|
+
encOrgKeyData[org.id] = {
|
|
13198
|
+
type: "provider",
|
|
13199
|
+
providerId: org.providerId,
|
|
13200
|
+
key: org.key,
|
|
13201
|
+
};
|
|
13081
13202
|
});
|
|
13082
|
-
for (const providerOrg of providerOrgs) {
|
|
13083
|
-
// Convert provider encrypted keys to user encrypted.
|
|
13084
|
-
const providerKey = yield this.getProviderKey(providerOrg.providerId);
|
|
13085
|
-
const decValue = yield this.decryptToBytes(new EncString(providerOrg.key), providerKey);
|
|
13086
|
-
orgKeys[providerOrg.id] = (yield this.rsaEncrypt(decValue)).encryptedString;
|
|
13087
|
-
}
|
|
13088
13203
|
yield this.stateService.setDecryptedOrganizationKeys(null);
|
|
13089
|
-
return yield this.stateService.setEncryptedOrganizationKeys(
|
|
13204
|
+
return yield this.stateService.setEncryptedOrganizationKeys(encOrgKeyData);
|
|
13090
13205
|
});
|
|
13091
13206
|
}
|
|
13092
13207
|
setProviderKeys(providers) {
|
|
@@ -13200,29 +13315,29 @@ class CryptoService {
|
|
|
13200
13315
|
}
|
|
13201
13316
|
getOrgKeys() {
|
|
13202
13317
|
return crypto_service_awaiter(this, void 0, void 0, function* () {
|
|
13203
|
-
const
|
|
13318
|
+
const result = new Map();
|
|
13204
13319
|
const decryptedOrganizationKeys = yield this.stateService.getDecryptedOrganizationKeys();
|
|
13205
13320
|
if (decryptedOrganizationKeys != null && decryptedOrganizationKeys.size > 0) {
|
|
13206
13321
|
return decryptedOrganizationKeys;
|
|
13207
13322
|
}
|
|
13208
|
-
const
|
|
13209
|
-
if (
|
|
13323
|
+
const encOrgKeyData = yield this.stateService.getEncryptedOrganizationKeys();
|
|
13324
|
+
if (encOrgKeyData == null) {
|
|
13210
13325
|
return null;
|
|
13211
13326
|
}
|
|
13212
13327
|
let setKey = false;
|
|
13213
|
-
for (const orgId
|
|
13214
|
-
|
|
13215
|
-
if (!encOrgKeys.hasOwnProperty(orgId)) {
|
|
13328
|
+
for (const orgId of Object.keys(encOrgKeyData)) {
|
|
13329
|
+
if (result.has(orgId)) {
|
|
13216
13330
|
continue;
|
|
13217
13331
|
}
|
|
13218
|
-
const
|
|
13219
|
-
|
|
13332
|
+
const encOrgKey = BaseEncryptedOrganizationKey.fromData(encOrgKeyData[orgId]);
|
|
13333
|
+
const decOrgKey = yield encOrgKey.decrypt(this);
|
|
13334
|
+
result.set(orgId, decOrgKey);
|
|
13220
13335
|
setKey = true;
|
|
13221
13336
|
}
|
|
13222
13337
|
if (setKey) {
|
|
13223
|
-
yield this.stateService.setDecryptedOrganizationKeys(
|
|
13338
|
+
yield this.stateService.setDecryptedOrganizationKeys(result);
|
|
13224
13339
|
}
|
|
13225
|
-
return
|
|
13340
|
+
return result;
|
|
13226
13341
|
});
|
|
13227
13342
|
}
|
|
13228
13343
|
getOrgKey(orgId) {
|
|
@@ -13472,23 +13587,15 @@ class CryptoService {
|
|
|
13472
13587
|
return this.buildEncKey(key, encKey.key);
|
|
13473
13588
|
});
|
|
13474
13589
|
}
|
|
13590
|
+
/**
|
|
13591
|
+
* @deprecated June 22 2022: This method has been moved to encryptService.
|
|
13592
|
+
* All callers should use this service to grab the relevant key and use encryptService for encryption instead.
|
|
13593
|
+
* This method will be removed once all existing code has been refactored to use encryptService.
|
|
13594
|
+
*/
|
|
13475
13595
|
encrypt(plainValue, key) {
|
|
13476
13596
|
return crypto_service_awaiter(this, void 0, void 0, function* () {
|
|
13477
|
-
|
|
13478
|
-
|
|
13479
|
-
}
|
|
13480
|
-
let plainBuf;
|
|
13481
|
-
if (typeof plainValue === "string") {
|
|
13482
|
-
plainBuf = Utils.fromUtf8ToArray(plainValue).buffer;
|
|
13483
|
-
}
|
|
13484
|
-
else {
|
|
13485
|
-
plainBuf = plainValue;
|
|
13486
|
-
}
|
|
13487
|
-
const encObj = yield this.aesEncrypt(plainBuf, key);
|
|
13488
|
-
const iv = Utils.fromBufferToB64(encObj.iv);
|
|
13489
|
-
const data = Utils.fromBufferToB64(encObj.data);
|
|
13490
|
-
const mac = encObj.mac != null ? Utils.fromBufferToB64(encObj.mac) : null;
|
|
13491
|
-
return new EncString(encObj.key.encType, data, iv, mac);
|
|
13597
|
+
key = yield this.getKeyForEncryption(key);
|
|
13598
|
+
return yield this.encryptService.encrypt(plainValue, key);
|
|
13492
13599
|
});
|
|
13493
13600
|
}
|
|
13494
13601
|
encryptToBytes(plainValue, key) {
|
|
@@ -13584,7 +13691,9 @@ class CryptoService {
|
|
|
13584
13691
|
}
|
|
13585
13692
|
decryptToUtf8(encString, key) {
|
|
13586
13693
|
return crypto_service_awaiter(this, void 0, void 0, function* () {
|
|
13587
|
-
|
|
13694
|
+
key = yield this.getKeyForEncryption(key);
|
|
13695
|
+
key = yield this.resolveLegacyKey(encString.encryptionType, key);
|
|
13696
|
+
return yield this.encryptService.decryptToUtf8(encString, key);
|
|
13588
13697
|
});
|
|
13589
13698
|
}
|
|
13590
13699
|
decryptFromBytes(encBuf, key) {
|
|
@@ -13705,6 +13814,10 @@ class CryptoService {
|
|
|
13705
13814
|
: yield this.stateService.getCryptoMasterKeyBiometric({ userId: userId });
|
|
13706
13815
|
});
|
|
13707
13816
|
}
|
|
13817
|
+
/**
|
|
13818
|
+
* @deprecated June 22 2022: This method has been moved to encryptService.
|
|
13819
|
+
* All callers should use encryptService instead. This method will be removed once all existing code has been refactored to use encryptService.
|
|
13820
|
+
*/
|
|
13708
13821
|
aesEncrypt(data, key) {
|
|
13709
13822
|
return crypto_service_awaiter(this, void 0, void 0, function* () {
|
|
13710
13823
|
const obj = new EncryptedObject();
|
|
@@ -13720,30 +13833,6 @@ class CryptoService {
|
|
|
13720
13833
|
return obj;
|
|
13721
13834
|
});
|
|
13722
13835
|
}
|
|
13723
|
-
aesDecryptToUtf8(encType, data, iv, mac, key) {
|
|
13724
|
-
return crypto_service_awaiter(this, void 0, void 0, function* () {
|
|
13725
|
-
const keyForEnc = yield this.getKeyForEncryption(key);
|
|
13726
|
-
const theKey = yield this.resolveLegacyKey(encType, keyForEnc);
|
|
13727
|
-
if (theKey.macKey != null && mac == null) {
|
|
13728
|
-
this.logService.error("mac required.");
|
|
13729
|
-
return null;
|
|
13730
|
-
}
|
|
13731
|
-
if (theKey.encType !== encType) {
|
|
13732
|
-
this.logService.error("encType unavailable.");
|
|
13733
|
-
return null;
|
|
13734
|
-
}
|
|
13735
|
-
const fastParams = this.cryptoFunctionService.aesDecryptFastParameters(data, iv, mac, theKey);
|
|
13736
|
-
if (fastParams.macKey != null && fastParams.mac != null) {
|
|
13737
|
-
const computedMac = yield this.cryptoFunctionService.hmacFast(fastParams.macData, fastParams.macKey, "sha256");
|
|
13738
|
-
const macsEqual = yield this.cryptoFunctionService.compareFast(fastParams.mac, computedMac);
|
|
13739
|
-
if (!macsEqual) {
|
|
13740
|
-
this.logService.error("mac failed.");
|
|
13741
|
-
return null;
|
|
13742
|
-
}
|
|
13743
|
-
}
|
|
13744
|
-
return this.cryptoFunctionService.aesDecryptFast(fastParams);
|
|
13745
|
-
});
|
|
13746
|
-
}
|
|
13747
13836
|
aesDecryptToBytes(encType, data, iv, mac, key) {
|
|
13748
13837
|
return crypto_service_awaiter(this, void 0, void 0, function* () {
|
|
13749
13838
|
const keyForEnc = yield this.getKeyForEncryption(key);
|
|
@@ -13905,6 +13994,91 @@ crypto_service_decorate([
|
|
|
13905
13994
|
crypto_service_metadata("design:returntype", Promise)
|
|
13906
13995
|
], CryptoService.prototype, "getProviderKeys", null);
|
|
13907
13996
|
|
|
13997
|
+
;// CONCATENATED MODULE: ../../libs/common/src/services/encrypt.service.ts
|
|
13998
|
+
var encrypt_service_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13999
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14000
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
14001
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
14002
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
14003
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
14004
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14005
|
+
});
|
|
14006
|
+
};
|
|
14007
|
+
|
|
14008
|
+
|
|
14009
|
+
|
|
14010
|
+
class EncryptService {
|
|
14011
|
+
constructor(cryptoFunctionService, logService, logMacFailures) {
|
|
14012
|
+
this.cryptoFunctionService = cryptoFunctionService;
|
|
14013
|
+
this.logService = logService;
|
|
14014
|
+
this.logMacFailures = logMacFailures;
|
|
14015
|
+
}
|
|
14016
|
+
encrypt(plainValue, key) {
|
|
14017
|
+
return encrypt_service_awaiter(this, void 0, void 0, function* () {
|
|
14018
|
+
if (key == null) {
|
|
14019
|
+
throw new Error("no encryption key provided.");
|
|
14020
|
+
}
|
|
14021
|
+
if (plainValue == null) {
|
|
14022
|
+
return Promise.resolve(null);
|
|
14023
|
+
}
|
|
14024
|
+
let plainBuf;
|
|
14025
|
+
if (typeof plainValue === "string") {
|
|
14026
|
+
plainBuf = Utils.fromUtf8ToArray(plainValue).buffer;
|
|
14027
|
+
}
|
|
14028
|
+
else {
|
|
14029
|
+
plainBuf = plainValue;
|
|
14030
|
+
}
|
|
14031
|
+
const encObj = yield this.aesEncrypt(plainBuf, key);
|
|
14032
|
+
const iv = Utils.fromBufferToB64(encObj.iv);
|
|
14033
|
+
const data = Utils.fromBufferToB64(encObj.data);
|
|
14034
|
+
const mac = encObj.mac != null ? Utils.fromBufferToB64(encObj.mac) : null;
|
|
14035
|
+
return new EncString(encObj.key.encType, data, iv, mac);
|
|
14036
|
+
});
|
|
14037
|
+
}
|
|
14038
|
+
decryptToUtf8(encString, key) {
|
|
14039
|
+
return encrypt_service_awaiter(this, void 0, void 0, function* () {
|
|
14040
|
+
if ((key === null || key === void 0 ? void 0 : key.macKey) != null && (encString === null || encString === void 0 ? void 0 : encString.mac) == null) {
|
|
14041
|
+
this.logService.error("mac required.");
|
|
14042
|
+
return null;
|
|
14043
|
+
}
|
|
14044
|
+
if (key.encType !== encString.encryptionType) {
|
|
14045
|
+
this.logService.error("encType unavailable.");
|
|
14046
|
+
return null;
|
|
14047
|
+
}
|
|
14048
|
+
const fastParams = this.cryptoFunctionService.aesDecryptFastParameters(encString.data, encString.iv, encString.mac, key);
|
|
14049
|
+
if (fastParams.macKey != null && fastParams.mac != null) {
|
|
14050
|
+
const computedMac = yield this.cryptoFunctionService.hmacFast(fastParams.macData, fastParams.macKey, "sha256");
|
|
14051
|
+
const macsEqual = yield this.cryptoFunctionService.compareFast(fastParams.mac, computedMac);
|
|
14052
|
+
if (!macsEqual) {
|
|
14053
|
+
this.logMacFailed("mac failed.");
|
|
14054
|
+
return null;
|
|
14055
|
+
}
|
|
14056
|
+
}
|
|
14057
|
+
return this.cryptoFunctionService.aesDecryptFast(fastParams);
|
|
14058
|
+
});
|
|
14059
|
+
}
|
|
14060
|
+
aesEncrypt(data, key) {
|
|
14061
|
+
return encrypt_service_awaiter(this, void 0, void 0, function* () {
|
|
14062
|
+
const obj = new EncryptedObject();
|
|
14063
|
+
obj.key = key;
|
|
14064
|
+
obj.iv = yield this.cryptoFunctionService.randomBytes(16);
|
|
14065
|
+
obj.data = yield this.cryptoFunctionService.aesEncrypt(data, obj.iv, obj.key.encKey);
|
|
14066
|
+
if (obj.key.macKey != null) {
|
|
14067
|
+
const macData = new Uint8Array(obj.iv.byteLength + obj.data.byteLength);
|
|
14068
|
+
macData.set(new Uint8Array(obj.iv), 0);
|
|
14069
|
+
macData.set(new Uint8Array(obj.data), obj.iv.byteLength);
|
|
14070
|
+
obj.mac = yield this.cryptoFunctionService.hmac(macData.buffer, obj.key.macKey, "sha256");
|
|
14071
|
+
}
|
|
14072
|
+
return obj;
|
|
14073
|
+
});
|
|
14074
|
+
}
|
|
14075
|
+
logMacFailed(msg) {
|
|
14076
|
+
if (this.logMacFailures) {
|
|
14077
|
+
this.logService.error(msg);
|
|
14078
|
+
}
|
|
14079
|
+
}
|
|
14080
|
+
}
|
|
14081
|
+
|
|
13908
14082
|
;// CONCATENATED MODULE: external "rxjs"
|
|
13909
14083
|
const external_rxjs_namespaceObject = require("rxjs");
|
|
13910
14084
|
;// CONCATENATED MODULE: ../../libs/common/src/services/environment.service.ts
|
|
@@ -13924,6 +14098,7 @@ class EnvironmentService {
|
|
|
13924
14098
|
this.stateService = stateService;
|
|
13925
14099
|
this.urlsSubject = new external_rxjs_namespaceObject.Subject();
|
|
13926
14100
|
this.urls = this.urlsSubject;
|
|
14101
|
+
this.scimUrl = null;
|
|
13927
14102
|
this.stateService.activeAccount.subscribe(() => environment_service_awaiter(this, void 0, void 0, function* () {
|
|
13928
14103
|
yield this.setUrlsFromStorage();
|
|
13929
14104
|
}));
|
|
@@ -13993,6 +14168,14 @@ class EnvironmentService {
|
|
|
13993
14168
|
getKeyConnectorUrl() {
|
|
13994
14169
|
return this.keyConnectorUrl;
|
|
13995
14170
|
}
|
|
14171
|
+
getScimUrl() {
|
|
14172
|
+
if (this.scimUrl != null) {
|
|
14173
|
+
return this.scimUrl + "/v2";
|
|
14174
|
+
}
|
|
14175
|
+
return this.getWebVaultUrl() === "https://vault.bitwarden.com"
|
|
14176
|
+
? "https://scim.bitwarden.com/v2"
|
|
14177
|
+
: this.getWebVaultUrl() + "/scim/v2";
|
|
14178
|
+
}
|
|
13996
14179
|
setUrlsFromStorage() {
|
|
13997
14180
|
return environment_service_awaiter(this, void 0, void 0, function* () {
|
|
13998
14181
|
const urls = yield this.stateService.getEnvironmentUrls();
|
|
@@ -14005,9 +14188,11 @@ class EnvironmentService {
|
|
|
14005
14188
|
this.notificationsUrl = urls.notifications;
|
|
14006
14189
|
this.eventsUrl = envUrls.events = urls.events;
|
|
14007
14190
|
this.keyConnectorUrl = urls.keyConnector;
|
|
14191
|
+
// scimUrl is not saved to storage
|
|
14008
14192
|
});
|
|
14009
14193
|
}
|
|
14010
14194
|
setUrls(urls) {
|
|
14195
|
+
var _a;
|
|
14011
14196
|
return environment_service_awaiter(this, void 0, void 0, function* () {
|
|
14012
14197
|
urls.base = this.formatUrl(urls.base);
|
|
14013
14198
|
urls.webVault = this.formatUrl(urls.webVault);
|
|
@@ -14017,6 +14202,8 @@ class EnvironmentService {
|
|
|
14017
14202
|
urls.notifications = this.formatUrl(urls.notifications);
|
|
14018
14203
|
urls.events = this.formatUrl(urls.events);
|
|
14019
14204
|
urls.keyConnector = this.formatUrl(urls.keyConnector);
|
|
14205
|
+
// scimUrl cannot be cleared
|
|
14206
|
+
urls.scim = (_a = this.formatUrl(urls.scim)) !== null && _a !== void 0 ? _a : this.scimUrl;
|
|
14020
14207
|
yield this.stateService.setEnvironmentUrls({
|
|
14021
14208
|
base: urls.base,
|
|
14022
14209
|
api: urls.api,
|
|
@@ -14026,6 +14213,7 @@ class EnvironmentService {
|
|
|
14026
14213
|
notifications: urls.notifications,
|
|
14027
14214
|
events: urls.events,
|
|
14028
14215
|
keyConnector: urls.keyConnector,
|
|
14216
|
+
// scimUrl is not saved to storage
|
|
14029
14217
|
});
|
|
14030
14218
|
this.baseUrl = urls.base;
|
|
14031
14219
|
this.webVaultUrl = urls.webVault;
|
|
@@ -14035,6 +14223,7 @@ class EnvironmentService {
|
|
|
14035
14223
|
this.notificationsUrl = urls.notifications;
|
|
14036
14224
|
this.eventsUrl = urls.events;
|
|
14037
14225
|
this.keyConnectorUrl = urls.keyConnector;
|
|
14226
|
+
this.scimUrl = urls.scim;
|
|
14038
14227
|
this.urlsSubject.next(urls);
|
|
14039
14228
|
return urls;
|
|
14040
14229
|
});
|
|
@@ -14049,6 +14238,7 @@ class EnvironmentService {
|
|
|
14049
14238
|
notifications: this.notificationsUrl,
|
|
14050
14239
|
events: this.eventsUrl,
|
|
14051
14240
|
keyConnector: this.keyConnectorUrl,
|
|
14241
|
+
scim: this.scimUrl,
|
|
14052
14242
|
};
|
|
14053
14243
|
}
|
|
14054
14244
|
formatUrl(url) {
|
|
@@ -14656,6 +14846,8 @@ var EventType;
|
|
|
14656
14846
|
EventType[EventType["OrganizationUser_AdminResetPassword"] = 1508] = "OrganizationUser_AdminResetPassword";
|
|
14657
14847
|
EventType[EventType["OrganizationUser_ResetSsoLink"] = 1509] = "OrganizationUser_ResetSsoLink";
|
|
14658
14848
|
EventType[EventType["OrganizationUser_FirstSsoLogin"] = 1510] = "OrganizationUser_FirstSsoLogin";
|
|
14849
|
+
EventType[EventType["OrganizationUser_Deactivated"] = 1511] = "OrganizationUser_Deactivated";
|
|
14850
|
+
EventType[EventType["OrganizationUser_Activated"] = 1512] = "OrganizationUser_Activated";
|
|
14659
14851
|
EventType[EventType["Organization_Updated"] = 1600] = "Organization_Updated";
|
|
14660
14852
|
EventType[EventType["Organization_PurgedVault"] = 1601] = "Organization_PurgedVault";
|
|
14661
14853
|
// Organization_ClientExportedVault = 1602,
|
|
@@ -14791,6 +14983,7 @@ var export_service_awaiter = (undefined && undefined.__awaiter) || function (thi
|
|
|
14791
14983
|
|
|
14792
14984
|
|
|
14793
14985
|
|
|
14986
|
+
|
|
14794
14987
|
class ExportService {
|
|
14795
14988
|
constructor(folderService, cipherService, apiService, cryptoService, cryptoFunctionService) {
|
|
14796
14989
|
this.folderService = folderService;
|
|
@@ -14867,7 +15060,7 @@ class ExportService {
|
|
|
14867
15060
|
let decFolders = [];
|
|
14868
15061
|
let decCiphers = [];
|
|
14869
15062
|
const promises = [];
|
|
14870
|
-
promises.push(this.folderService.
|
|
15063
|
+
promises.push((0,external_rxjs_namespaceObject.firstValueFrom)(this.folderService.folderViews$).then((folders) => {
|
|
14871
15064
|
decFolders = folders;
|
|
14872
15065
|
}));
|
|
14873
15066
|
promises.push(this.cipherService.getAllDecrypted().then((ciphers) => {
|
|
@@ -14931,7 +15124,7 @@ class ExportService {
|
|
|
14931
15124
|
let folders = [];
|
|
14932
15125
|
let ciphers = [];
|
|
14933
15126
|
const promises = [];
|
|
14934
|
-
promises.push(this.folderService.
|
|
15127
|
+
promises.push((0,external_rxjs_namespaceObject.firstValueFrom)(this.folderService.folders$).then((f) => {
|
|
14935
15128
|
folders = f;
|
|
14936
15129
|
}));
|
|
14937
15130
|
promises.push(this.cipherService.getAll().then((c) => {
|
|
@@ -15481,8 +15674,19 @@ class FolderRequest {
|
|
|
15481
15674
|
}
|
|
15482
15675
|
}
|
|
15483
15676
|
|
|
15484
|
-
;// CONCATENATED MODULE: ../../libs/common/src/
|
|
15485
|
-
|
|
15677
|
+
;// CONCATENATED MODULE: ../../libs/common/src/models/response/folderResponse.ts
|
|
15678
|
+
|
|
15679
|
+
class FolderResponse extends BaseResponse {
|
|
15680
|
+
constructor(response) {
|
|
15681
|
+
super(response);
|
|
15682
|
+
this.id = this.getResponseProperty("Id");
|
|
15683
|
+
this.name = this.getResponseProperty("Name");
|
|
15684
|
+
this.revisionDate = this.getResponseProperty("RevisionDate");
|
|
15685
|
+
}
|
|
15686
|
+
}
|
|
15687
|
+
|
|
15688
|
+
;// CONCATENATED MODULE: ../../libs/common/src/services/folder/folder-api.service.ts
|
|
15689
|
+
var folder_api_service_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15486
15690
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15487
15691
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15488
15692
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
@@ -15494,23 +15698,99 @@ var folder_service_awaiter = (undefined && undefined.__awaiter) || function (thi
|
|
|
15494
15698
|
|
|
15495
15699
|
|
|
15496
15700
|
|
|
15701
|
+
class FolderApiService {
|
|
15702
|
+
constructor(folderService, apiService) {
|
|
15703
|
+
this.folderService = folderService;
|
|
15704
|
+
this.apiService = apiService;
|
|
15705
|
+
}
|
|
15706
|
+
save(folder) {
|
|
15707
|
+
return folder_api_service_awaiter(this, void 0, void 0, function* () {
|
|
15708
|
+
const request = new FolderRequest(folder);
|
|
15709
|
+
let response;
|
|
15710
|
+
if (folder.id == null) {
|
|
15711
|
+
response = yield this.postFolder(request);
|
|
15712
|
+
folder.id = response.id;
|
|
15713
|
+
}
|
|
15714
|
+
else {
|
|
15715
|
+
response = yield this.putFolder(folder.id, request);
|
|
15716
|
+
}
|
|
15717
|
+
const data = new FolderData(response);
|
|
15718
|
+
yield this.folderService.upsert(data);
|
|
15719
|
+
});
|
|
15720
|
+
}
|
|
15721
|
+
delete(id) {
|
|
15722
|
+
return folder_api_service_awaiter(this, void 0, void 0, function* () {
|
|
15723
|
+
yield this.deleteFolder(id);
|
|
15724
|
+
yield this.folderService.delete(id);
|
|
15725
|
+
});
|
|
15726
|
+
}
|
|
15727
|
+
get(id) {
|
|
15728
|
+
return folder_api_service_awaiter(this, void 0, void 0, function* () {
|
|
15729
|
+
const r = yield this.apiService.send("GET", "/folders/" + id, null, true, true);
|
|
15730
|
+
return new FolderResponse(r);
|
|
15731
|
+
});
|
|
15732
|
+
}
|
|
15733
|
+
postFolder(request) {
|
|
15734
|
+
return folder_api_service_awaiter(this, void 0, void 0, function* () {
|
|
15735
|
+
const r = yield this.apiService.send("POST", "/folders", request, true, true);
|
|
15736
|
+
return new FolderResponse(r);
|
|
15737
|
+
});
|
|
15738
|
+
}
|
|
15739
|
+
putFolder(id, request) {
|
|
15740
|
+
return folder_api_service_awaiter(this, void 0, void 0, function* () {
|
|
15741
|
+
const r = yield this.apiService.send("PUT", "/folders/" + id, request, true, true);
|
|
15742
|
+
return new FolderResponse(r);
|
|
15743
|
+
});
|
|
15744
|
+
}
|
|
15745
|
+
deleteFolder(id) {
|
|
15746
|
+
return this.apiService.send("DELETE", "/folders/" + id, null, true, false);
|
|
15747
|
+
}
|
|
15748
|
+
}
|
|
15749
|
+
|
|
15750
|
+
;// CONCATENATED MODULE: ../../libs/common/src/services/folder/folder.service.ts
|
|
15751
|
+
var folder_service_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15752
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15753
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15754
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
15755
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
15756
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
15757
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
15758
|
+
});
|
|
15759
|
+
};
|
|
15760
|
+
|
|
15761
|
+
|
|
15497
15762
|
|
|
15498
15763
|
|
|
15499
15764
|
|
|
15500
|
-
const folder_service_NestingDelimiter = "/";
|
|
15501
15765
|
class FolderService {
|
|
15502
|
-
constructor(cryptoService,
|
|
15766
|
+
constructor(cryptoService, i18nService, cipherService, stateService) {
|
|
15503
15767
|
this.cryptoService = cryptoService;
|
|
15504
|
-
this.apiService = apiService;
|
|
15505
15768
|
this.i18nService = i18nService;
|
|
15506
15769
|
this.cipherService = cipherService;
|
|
15507
15770
|
this.stateService = stateService;
|
|
15771
|
+
this._folders = new external_rxjs_namespaceObject.BehaviorSubject([]);
|
|
15772
|
+
this._folderViews = new external_rxjs_namespaceObject.BehaviorSubject([]);
|
|
15773
|
+
this.folders$ = this._folders.asObservable();
|
|
15774
|
+
this.folderViews$ = this._folderViews.asObservable();
|
|
15775
|
+
this.stateService.activeAccountUnlocked.subscribe((unlocked) => folder_service_awaiter(this, void 0, void 0, function* () {
|
|
15776
|
+
if (Utils.global.bitwardenContainerService == null) {
|
|
15777
|
+
return;
|
|
15778
|
+
}
|
|
15779
|
+
if (!unlocked) {
|
|
15780
|
+
this._folders.next([]);
|
|
15781
|
+
this._folderViews.next([]);
|
|
15782
|
+
return;
|
|
15783
|
+
}
|
|
15784
|
+
const data = yield this.stateService.getEncryptedFolders();
|
|
15785
|
+
yield this.updateObservables(data);
|
|
15786
|
+
}));
|
|
15508
15787
|
}
|
|
15509
|
-
clearCache(
|
|
15788
|
+
clearCache() {
|
|
15510
15789
|
return folder_service_awaiter(this, void 0, void 0, function* () {
|
|
15511
|
-
|
|
15790
|
+
this._folderViews.next([]);
|
|
15512
15791
|
});
|
|
15513
15792
|
}
|
|
15793
|
+
// TODO: This should be moved to EncryptService or something
|
|
15514
15794
|
encrypt(model, key) {
|
|
15515
15795
|
return folder_service_awaiter(this, void 0, void 0, function* () {
|
|
15516
15796
|
const folder = new Folder();
|
|
@@ -15521,85 +15801,18 @@ class FolderService {
|
|
|
15521
15801
|
}
|
|
15522
15802
|
get(id) {
|
|
15523
15803
|
return folder_service_awaiter(this, void 0, void 0, function* () {
|
|
15524
|
-
const folders =
|
|
15525
|
-
|
|
15526
|
-
if (folders == null || !folders.hasOwnProperty(id)) {
|
|
15527
|
-
return null;
|
|
15528
|
-
}
|
|
15529
|
-
return new Folder(folders[id]);
|
|
15530
|
-
});
|
|
15531
|
-
}
|
|
15532
|
-
getAll() {
|
|
15533
|
-
return folder_service_awaiter(this, void 0, void 0, function* () {
|
|
15534
|
-
const folders = yield this.stateService.getEncryptedFolders();
|
|
15535
|
-
const response = [];
|
|
15536
|
-
for (const id in folders) {
|
|
15537
|
-
// eslint-disable-next-line
|
|
15538
|
-
if (folders.hasOwnProperty(id)) {
|
|
15539
|
-
response.push(new Folder(folders[id]));
|
|
15540
|
-
}
|
|
15541
|
-
}
|
|
15542
|
-
return response;
|
|
15804
|
+
const folders = this._folders.getValue();
|
|
15805
|
+
return folders.find((folder) => folder.id === id);
|
|
15543
15806
|
});
|
|
15544
15807
|
}
|
|
15545
|
-
|
|
15546
|
-
|
|
15547
|
-
|
|
15548
|
-
|
|
15549
|
-
return decryptedFolders;
|
|
15550
|
-
}
|
|
15551
|
-
const hasKey = yield this.cryptoService.hasKey();
|
|
15552
|
-
if (!hasKey) {
|
|
15553
|
-
throw new Error("No key.");
|
|
15554
|
-
}
|
|
15555
|
-
const decFolders = [];
|
|
15556
|
-
const promises = [];
|
|
15557
|
-
const folders = yield this.getAll();
|
|
15558
|
-
folders.forEach((folder) => {
|
|
15559
|
-
promises.push(folder.decrypt().then((f) => decFolders.push(f)));
|
|
15560
|
-
});
|
|
15561
|
-
yield Promise.all(promises);
|
|
15562
|
-
decFolders.sort(Utils.getSortFunction(this.i18nService, "name"));
|
|
15563
|
-
const noneFolder = new FolderView();
|
|
15564
|
-
noneFolder.name = this.i18nService.t("noneFolder");
|
|
15565
|
-
decFolders.push(noneFolder);
|
|
15566
|
-
yield this.stateService.setDecryptedFolders(decFolders);
|
|
15567
|
-
return decFolders;
|
|
15568
|
-
});
|
|
15569
|
-
}
|
|
15570
|
-
getAllNested(folders) {
|
|
15571
|
-
return folder_service_awaiter(this, void 0, void 0, function* () {
|
|
15572
|
-
folders = folders !== null && folders !== void 0 ? folders : (yield this.getAllDecrypted());
|
|
15573
|
-
const nodes = [];
|
|
15574
|
-
folders.forEach((f) => {
|
|
15575
|
-
const folderCopy = new FolderView();
|
|
15576
|
-
folderCopy.id = f.id;
|
|
15577
|
-
folderCopy.revisionDate = f.revisionDate;
|
|
15578
|
-
const parts = f.name != null ? f.name.replace(/^\/+|\/+$/g, "").split(folder_service_NestingDelimiter) : [];
|
|
15579
|
-
ServiceUtils.nestedTraverse(nodes, 0, parts, folderCopy, null, folder_service_NestingDelimiter);
|
|
15580
|
-
});
|
|
15581
|
-
return nodes;
|
|
15582
|
-
});
|
|
15583
|
-
}
|
|
15584
|
-
getNested(id) {
|
|
15808
|
+
/**
|
|
15809
|
+
* @deprecated Only use in CLI!
|
|
15810
|
+
*/
|
|
15811
|
+
getAllDecryptedFromState() {
|
|
15585
15812
|
return folder_service_awaiter(this, void 0, void 0, function* () {
|
|
15586
|
-
const
|
|
15587
|
-
|
|
15588
|
-
|
|
15589
|
-
}
|
|
15590
|
-
saveWithServer(folder) {
|
|
15591
|
-
return folder_service_awaiter(this, void 0, void 0, function* () {
|
|
15592
|
-
const request = new FolderRequest(folder);
|
|
15593
|
-
let response;
|
|
15594
|
-
if (folder.id == null) {
|
|
15595
|
-
response = yield this.apiService.postFolder(request);
|
|
15596
|
-
folder.id = response.id;
|
|
15597
|
-
}
|
|
15598
|
-
else {
|
|
15599
|
-
response = yield this.apiService.putFolder(folder.id, request);
|
|
15600
|
-
}
|
|
15601
|
-
const data = new FolderData(response);
|
|
15602
|
-
yield this.upsert(data);
|
|
15813
|
+
const data = yield this.stateService.getEncryptedFolders();
|
|
15814
|
+
const folders = Object.values(data || {}).map((f) => new Folder(f));
|
|
15815
|
+
return this.decryptFolders(folders);
|
|
15603
15816
|
});
|
|
15604
15817
|
}
|
|
15605
15818
|
upsert(folder) {
|
|
@@ -15617,19 +15830,22 @@ class FolderService {
|
|
|
15617
15830
|
folders[f.id] = f;
|
|
15618
15831
|
});
|
|
15619
15832
|
}
|
|
15620
|
-
yield this.
|
|
15833
|
+
yield this.updateObservables(folders);
|
|
15621
15834
|
yield this.stateService.setEncryptedFolders(folders);
|
|
15622
15835
|
});
|
|
15623
15836
|
}
|
|
15624
15837
|
replace(folders) {
|
|
15625
15838
|
return folder_service_awaiter(this, void 0, void 0, function* () {
|
|
15626
|
-
yield this.
|
|
15839
|
+
yield this.updateObservables(folders);
|
|
15627
15840
|
yield this.stateService.setEncryptedFolders(folders);
|
|
15628
15841
|
});
|
|
15629
15842
|
}
|
|
15630
15843
|
clear(userId) {
|
|
15631
15844
|
return folder_service_awaiter(this, void 0, void 0, function* () {
|
|
15632
|
-
yield this.stateService.
|
|
15845
|
+
if (userId == null || userId == (yield this.stateService.getUserId())) {
|
|
15846
|
+
this._folders.next([]);
|
|
15847
|
+
this._folderViews.next([]);
|
|
15848
|
+
}
|
|
15633
15849
|
yield this.stateService.setEncryptedFolders(null, { userId: userId });
|
|
15634
15850
|
});
|
|
15635
15851
|
}
|
|
@@ -15650,7 +15866,7 @@ class FolderService {
|
|
|
15650
15866
|
delete folders[i];
|
|
15651
15867
|
});
|
|
15652
15868
|
}
|
|
15653
|
-
yield this.
|
|
15869
|
+
yield this.updateObservables(folders);
|
|
15654
15870
|
yield this.stateService.setEncryptedFolders(folders);
|
|
15655
15871
|
// Items in a deleted folder are re-assigned to "No Folder"
|
|
15656
15872
|
const ciphers = yield this.stateService.getEncryptedCiphers();
|
|
@@ -15668,10 +15884,24 @@ class FolderService {
|
|
|
15668
15884
|
}
|
|
15669
15885
|
});
|
|
15670
15886
|
}
|
|
15671
|
-
|
|
15887
|
+
updateObservables(foldersMap) {
|
|
15672
15888
|
return folder_service_awaiter(this, void 0, void 0, function* () {
|
|
15673
|
-
|
|
15674
|
-
|
|
15889
|
+
const folders = Object.values(foldersMap || {}).map((f) => new Folder(f));
|
|
15890
|
+
this._folders.next(folders);
|
|
15891
|
+
if (yield this.cryptoService.hasKey()) {
|
|
15892
|
+
this._folderViews.next(yield this.decryptFolders(folders));
|
|
15893
|
+
}
|
|
15894
|
+
});
|
|
15895
|
+
}
|
|
15896
|
+
decryptFolders(folders) {
|
|
15897
|
+
return folder_service_awaiter(this, void 0, void 0, function* () {
|
|
15898
|
+
const decryptFolderPromises = folders.map((f) => f.decrypt());
|
|
15899
|
+
const decryptedFolders = yield Promise.all(decryptFolderPromises);
|
|
15900
|
+
decryptedFolders.sort(Utils.getSortFunction(this.i18nService, "name"));
|
|
15901
|
+
const noneFolder = new FolderView();
|
|
15902
|
+
noneFolder.name = this.i18nService.t("noneFolder");
|
|
15903
|
+
decryptedFolders.push(noneFolder);
|
|
15904
|
+
return decryptedFolders;
|
|
15675
15905
|
});
|
|
15676
15906
|
}
|
|
15677
15907
|
}
|
|
@@ -21731,6 +21961,45 @@ class KeyConnectorService {
|
|
|
21731
21961
|
}
|
|
21732
21962
|
}
|
|
21733
21963
|
|
|
21964
|
+
;// CONCATENATED MODULE: ../../libs/common/src/services/memoryStorage.service.ts
|
|
21965
|
+
var memoryStorage_service_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
21966
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
21967
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
21968
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21969
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
21970
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
21971
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21972
|
+
});
|
|
21973
|
+
};
|
|
21974
|
+
class MemoryStorageService {
|
|
21975
|
+
constructor() {
|
|
21976
|
+
this.store = new Map();
|
|
21977
|
+
}
|
|
21978
|
+
get(key) {
|
|
21979
|
+
if (this.store.has(key)) {
|
|
21980
|
+
const obj = this.store.get(key);
|
|
21981
|
+
return Promise.resolve(obj);
|
|
21982
|
+
}
|
|
21983
|
+
return Promise.resolve(null);
|
|
21984
|
+
}
|
|
21985
|
+
has(key) {
|
|
21986
|
+
return memoryStorage_service_awaiter(this, void 0, void 0, function* () {
|
|
21987
|
+
return this.get(key) != null;
|
|
21988
|
+
});
|
|
21989
|
+
}
|
|
21990
|
+
save(key, obj) {
|
|
21991
|
+
if (obj == null) {
|
|
21992
|
+
return this.remove(key);
|
|
21993
|
+
}
|
|
21994
|
+
this.store.set(key, obj);
|
|
21995
|
+
return Promise.resolve();
|
|
21996
|
+
}
|
|
21997
|
+
remove(key) {
|
|
21998
|
+
this.store.delete(key);
|
|
21999
|
+
return Promise.resolve();
|
|
22000
|
+
}
|
|
22001
|
+
}
|
|
22002
|
+
|
|
21734
22003
|
;// CONCATENATED MODULE: ../../libs/common/src/services/noopMessaging.service.ts
|
|
21735
22004
|
class NoopMessagingService {
|
|
21736
22005
|
send(subscriber, arg = {}) {
|
|
@@ -21744,6 +22013,7 @@ var OrganizationUserStatusType;
|
|
|
21744
22013
|
OrganizationUserStatusType[OrganizationUserStatusType["Invited"] = 0] = "Invited";
|
|
21745
22014
|
OrganizationUserStatusType[OrganizationUserStatusType["Accepted"] = 1] = "Accepted";
|
|
21746
22015
|
OrganizationUserStatusType[OrganizationUserStatusType["Confirmed"] = 2] = "Confirmed";
|
|
22016
|
+
OrganizationUserStatusType[OrganizationUserStatusType["Deactivated"] = -1] = "Deactivated";
|
|
21747
22017
|
})(OrganizationUserStatusType || (OrganizationUserStatusType = {}));
|
|
21748
22018
|
|
|
21749
22019
|
;// CONCATENATED MODULE: ../../libs/common/src/enums/permissions.ts
|
|
@@ -21775,6 +22045,7 @@ var Permissions;
|
|
|
21775
22045
|
Permissions[Permissions["DeleteAssignedCollections"] = 15] = "DeleteAssignedCollections";
|
|
21776
22046
|
Permissions[Permissions["ManageSso"] = 16] = "ManageSso";
|
|
21777
22047
|
Permissions[Permissions["ManageBilling"] = 17] = "ManageBilling";
|
|
22048
|
+
Permissions[Permissions["ManageScim"] = 18] = "ManageScim";
|
|
21778
22049
|
})(Permissions || (Permissions = {}));
|
|
21779
22050
|
|
|
21780
22051
|
;// CONCATENATED MODULE: ../../libs/common/src/models/domain/organization.ts
|
|
@@ -21800,6 +22071,7 @@ class Organization {
|
|
|
21800
22071
|
this.useApi = obj.useApi;
|
|
21801
22072
|
this.useSso = obj.useSso;
|
|
21802
22073
|
this.useKeyConnector = obj.useKeyConnector;
|
|
22074
|
+
this.useScim = obj.useScim;
|
|
21803
22075
|
this.useResetPassword = obj.useResetPassword;
|
|
21804
22076
|
this.selfHost = obj.selfHost;
|
|
21805
22077
|
this.usersGetPremium = obj.usersGetPremium;
|
|
@@ -21886,6 +22158,9 @@ class Organization {
|
|
|
21886
22158
|
get canManageSso() {
|
|
21887
22159
|
return this.isAdmin || this.permissions.manageSso;
|
|
21888
22160
|
}
|
|
22161
|
+
get canManageScim() {
|
|
22162
|
+
return this.isAdmin || this.permissions.manageScim;
|
|
22163
|
+
}
|
|
21889
22164
|
get canManagePolicies() {
|
|
21890
22165
|
return this.isAdmin || this.permissions.managePolicies;
|
|
21891
22166
|
}
|
|
@@ -21915,6 +22190,7 @@ class Organization {
|
|
|
21915
22190
|
(permissions.includes(Permissions.ManageUsers) && this.canManageUsers) ||
|
|
21916
22191
|
(permissions.includes(Permissions.ManageUsersPassword) && this.canManageUsersPassword) ||
|
|
21917
22192
|
(permissions.includes(Permissions.ManageSso) && this.canManageSso) ||
|
|
22193
|
+
(permissions.includes(Permissions.ManageScim) && this.canManageScim) ||
|
|
21918
22194
|
(permissions.includes(Permissions.ManageBilling) && this.canManageBilling);
|
|
21919
22195
|
return specifiedPermissions && (this.enabled || this.isOwner);
|
|
21920
22196
|
}
|
|
@@ -22381,6 +22657,7 @@ class PasswordGenerationService {
|
|
|
22381
22657
|
currentHistory.pop();
|
|
22382
22658
|
}
|
|
22383
22659
|
const newHistory = yield this.encryptHistory(currentHistory);
|
|
22660
|
+
yield this.stateService.setDecryptedPasswordGenerationHistory(currentHistory);
|
|
22384
22661
|
return yield this.stateService.setEncryptedPasswordGenerationHistory(newHistory);
|
|
22385
22662
|
});
|
|
22386
22663
|
}
|
|
@@ -22814,6 +23091,7 @@ var ProviderUserStatusType;
|
|
|
22814
23091
|
ProviderUserStatusType[ProviderUserStatusType["Invited"] = 0] = "Invited";
|
|
22815
23092
|
ProviderUserStatusType[ProviderUserStatusType["Accepted"] = 1] = "Accepted";
|
|
22816
23093
|
ProviderUserStatusType[ProviderUserStatusType["Confirmed"] = 2] = "Confirmed";
|
|
23094
|
+
ProviderUserStatusType[ProviderUserStatusType["Deactivated"] = -1] = "Deactivated";
|
|
22817
23095
|
})(ProviderUserStatusType || (ProviderUserStatusType = {}));
|
|
22818
23096
|
|
|
22819
23097
|
;// CONCATENATED MODULE: ../../libs/common/src/enums/providerUserType.ts
|
|
@@ -22928,10 +23206,17 @@ class SearchService {
|
|
|
22928
23206
|
this.indexedEntityId = null;
|
|
22929
23207
|
this.indexing = false;
|
|
22930
23208
|
this.index = null;
|
|
22931
|
-
this.
|
|
22932
|
-
|
|
22933
|
-
|
|
22934
|
-
|
|
23209
|
+
this.immediateSearchLocales = ["zh-CN", "zh-TW", "ja", "ko", "vi"];
|
|
23210
|
+
this.defaultSearchableMinLength = 2;
|
|
23211
|
+
this.searchableMinLength = this.defaultSearchableMinLength;
|
|
23212
|
+
this.i18nService.locale$.subscribe((locale) => {
|
|
23213
|
+
if (this.immediateSearchLocales.indexOf(locale) !== -1) {
|
|
23214
|
+
this.searchableMinLength = 1;
|
|
23215
|
+
}
|
|
23216
|
+
else {
|
|
23217
|
+
this.searchableMinLength = this.defaultSearchableMinLength;
|
|
23218
|
+
}
|
|
23219
|
+
});
|
|
22935
23220
|
//register lunr pipeline function
|
|
22936
23221
|
external_lunr_namespaceObject.Pipeline.registerFunction(this.normalizeAccentsPipelineFunction, "normalizeAccents");
|
|
22937
23222
|
}
|
|
@@ -23073,7 +23358,9 @@ class SearchService {
|
|
|
23073
23358
|
if (c.subTitle != null && c.subTitle.toLowerCase().indexOf(query) > -1) {
|
|
23074
23359
|
return true;
|
|
23075
23360
|
}
|
|
23076
|
-
if (c.login &&
|
|
23361
|
+
if (c.login &&
|
|
23362
|
+
c.login.hasUris &&
|
|
23363
|
+
c.login.uris.some((loginUri) => loginUri.uri.toLowerCase().indexOf(query) > -1)) {
|
|
23077
23364
|
return true;
|
|
23078
23365
|
}
|
|
23079
23366
|
return false;
|
|
@@ -23912,6 +24199,23 @@ var StorageLocation;
|
|
|
23912
24199
|
StorageLocation["Memory"] = "memory";
|
|
23913
24200
|
})(StorageLocation || (StorageLocation = {}));
|
|
23914
24201
|
|
|
24202
|
+
;// CONCATENATED MODULE: ../../libs/common/src/models/data/eventData.ts
|
|
24203
|
+
class EventData {
|
|
24204
|
+
}
|
|
24205
|
+
|
|
24206
|
+
;// CONCATENATED MODULE: ../../libs/common/src/models/data/providerData.ts
|
|
24207
|
+
class ProviderData {
|
|
24208
|
+
constructor(response) {
|
|
24209
|
+
this.id = response.id;
|
|
24210
|
+
this.name = response.name;
|
|
24211
|
+
this.status = response.status;
|
|
24212
|
+
this.type = response.type;
|
|
24213
|
+
this.enabled = response.enabled;
|
|
24214
|
+
this.userId = response.userId;
|
|
24215
|
+
this.useEvents = response.useEvents;
|
|
24216
|
+
}
|
|
24217
|
+
}
|
|
24218
|
+
|
|
23915
24219
|
;// CONCATENATED MODULE: ../../libs/common/src/models/domain/state.ts
|
|
23916
24220
|
class State {
|
|
23917
24221
|
constructor(globals) {
|
|
@@ -23923,6 +24227,15 @@ class State {
|
|
|
23923
24227
|
}
|
|
23924
24228
|
|
|
23925
24229
|
;// CONCATENATED MODULE: ../../libs/common/src/services/state.service.ts
|
|
24230
|
+
var state_service_decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
24231
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
24232
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
24233
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
24234
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
24235
|
+
};
|
|
24236
|
+
var state_service_metadata = (undefined && undefined.__metadata) || function (k, v) {
|
|
24237
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
24238
|
+
};
|
|
23926
24239
|
var state_service_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
23927
24240
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
23928
24241
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -23937,9 +24250,25 @@ var state_service_awaiter = (undefined && undefined.__awaiter) || function (this
|
|
|
23937
24250
|
|
|
23938
24251
|
|
|
23939
24252
|
|
|
24253
|
+
|
|
24254
|
+
|
|
24255
|
+
|
|
24256
|
+
|
|
24257
|
+
|
|
24258
|
+
|
|
24259
|
+
|
|
24260
|
+
|
|
24261
|
+
|
|
24262
|
+
|
|
24263
|
+
|
|
24264
|
+
|
|
24265
|
+
|
|
24266
|
+
|
|
24267
|
+
|
|
23940
24268
|
|
|
23941
24269
|
|
|
23942
24270
|
const keys = {
|
|
24271
|
+
state: "state",
|
|
23943
24272
|
global: "global",
|
|
23944
24273
|
authenticatedAccounts: "authenticatedAccounts",
|
|
23945
24274
|
activeUserId: "activeUserId",
|
|
@@ -23952,18 +24281,33 @@ const partialKeys = {
|
|
|
23952
24281
|
masterKey: "_masterkey",
|
|
23953
24282
|
};
|
|
23954
24283
|
class StateService {
|
|
23955
|
-
constructor(storageService, secureStorageService, logService, stateMigrationService, stateFactory, useAccountCache = true) {
|
|
24284
|
+
constructor(storageService, secureStorageService, memoryStorageService, logService, stateMigrationService, stateFactory, useAccountCache = true) {
|
|
23956
24285
|
this.storageService = storageService;
|
|
23957
24286
|
this.secureStorageService = secureStorageService;
|
|
24287
|
+
this.memoryStorageService = memoryStorageService;
|
|
23958
24288
|
this.logService = logService;
|
|
23959
24289
|
this.stateMigrationService = stateMigrationService;
|
|
23960
24290
|
this.stateFactory = stateFactory;
|
|
23961
24291
|
this.useAccountCache = useAccountCache;
|
|
23962
24292
|
this.accounts = new external_rxjs_namespaceObject.BehaviorSubject({});
|
|
23963
24293
|
this.activeAccount = new external_rxjs_namespaceObject.BehaviorSubject(null);
|
|
23964
|
-
this.
|
|
24294
|
+
this.activeAccountUnlocked = new external_rxjs_namespaceObject.BehaviorSubject(false);
|
|
23965
24295
|
this.hasBeenInited = false;
|
|
24296
|
+
this.isRecoveredSession = false;
|
|
23966
24297
|
this.accountDiskCache = new Map();
|
|
24298
|
+
// If the account gets changed, verify the new account is unlocked
|
|
24299
|
+
this.activeAccount.subscribe((userId) => state_service_awaiter(this, void 0, void 0, function* () {
|
|
24300
|
+
if (userId == null && this.activeAccountUnlocked.getValue() == false) {
|
|
24301
|
+
return;
|
|
24302
|
+
}
|
|
24303
|
+
else if (userId == null) {
|
|
24304
|
+
this.activeAccountUnlocked.next(false);
|
|
24305
|
+
}
|
|
24306
|
+
// FIXME: This should be refactored into AuthService or a similar service,
|
|
24307
|
+
// as checking for the existance of the crypto key is a low level
|
|
24308
|
+
// implementation detail.
|
|
24309
|
+
this.activeAccountUnlocked.next((yield this.getCryptoMasterKey()) != null);
|
|
24310
|
+
}));
|
|
23967
24311
|
}
|
|
23968
24312
|
init() {
|
|
23969
24313
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
@@ -23973,26 +24317,40 @@ class StateService {
|
|
|
23973
24317
|
if (yield this.stateMigrationService.needsMigration()) {
|
|
23974
24318
|
yield this.stateMigrationService.migrate();
|
|
23975
24319
|
}
|
|
24320
|
+
yield this.state().then((state) => state_service_awaiter(this, void 0, void 0, function* () {
|
|
24321
|
+
if (state == null) {
|
|
24322
|
+
yield this.setState(new State(this.createGlobals()));
|
|
24323
|
+
}
|
|
24324
|
+
else {
|
|
24325
|
+
this.isRecoveredSession = true;
|
|
24326
|
+
}
|
|
24327
|
+
}));
|
|
23976
24328
|
yield this.initAccountState();
|
|
23977
24329
|
this.hasBeenInited = true;
|
|
23978
24330
|
});
|
|
23979
24331
|
}
|
|
23980
24332
|
initAccountState() {
|
|
23981
|
-
var _a;
|
|
23982
24333
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
23983
|
-
this.
|
|
23984
|
-
|
|
23985
|
-
for (const i in this.state.authenticatedAccounts) {
|
|
23986
|
-
if (i != null) {
|
|
23987
|
-
yield this.syncAccountFromDisk(this.state.authenticatedAccounts[i]);
|
|
23988
|
-
}
|
|
23989
|
-
}
|
|
23990
|
-
const storedActiveUser = yield this.storageService.get(keys.activeUserId);
|
|
23991
|
-
if (storedActiveUser != null) {
|
|
23992
|
-
this.state.activeUserId = storedActiveUser;
|
|
24334
|
+
if (this.isRecoveredSession) {
|
|
24335
|
+
return;
|
|
23993
24336
|
}
|
|
23994
|
-
yield this.
|
|
23995
|
-
|
|
24337
|
+
yield this.updateState((state) => state_service_awaiter(this, void 0, void 0, function* () {
|
|
24338
|
+
var _a;
|
|
24339
|
+
state.authenticatedAccounts =
|
|
24340
|
+
(_a = (yield this.storageService.get(keys.authenticatedAccounts))) !== null && _a !== void 0 ? _a : [];
|
|
24341
|
+
for (const i in state.authenticatedAccounts) {
|
|
24342
|
+
if (i != null) {
|
|
24343
|
+
yield this.syncAccountFromDisk(state.authenticatedAccounts[i]);
|
|
24344
|
+
}
|
|
24345
|
+
}
|
|
24346
|
+
const storedActiveUser = yield this.storageService.get(keys.activeUserId);
|
|
24347
|
+
if (storedActiveUser != null) {
|
|
24348
|
+
state.activeUserId = storedActiveUser;
|
|
24349
|
+
}
|
|
24350
|
+
yield this.pushAccounts();
|
|
24351
|
+
this.activeAccount.next(state.activeUserId);
|
|
24352
|
+
return state;
|
|
24353
|
+
}));
|
|
23996
24354
|
});
|
|
23997
24355
|
}
|
|
23998
24356
|
syncAccountFromDisk(userId) {
|
|
@@ -24000,17 +24358,23 @@ class StateService {
|
|
|
24000
24358
|
if (userId == null) {
|
|
24001
24359
|
return;
|
|
24002
24360
|
}
|
|
24003
|
-
this.state
|
|
24004
|
-
|
|
24005
|
-
|
|
24361
|
+
yield this.updateState((state) => state_service_awaiter(this, void 0, void 0, function* () {
|
|
24362
|
+
state.accounts[userId] = this.createAccount();
|
|
24363
|
+
const diskAccount = yield this.getAccountFromDisk({ userId: userId });
|
|
24364
|
+
state.accounts[userId].profile = diskAccount.profile;
|
|
24365
|
+
return state;
|
|
24366
|
+
}));
|
|
24006
24367
|
});
|
|
24007
24368
|
}
|
|
24008
24369
|
addAccount(account) {
|
|
24009
24370
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
24010
24371
|
account = yield this.setAccountEnvironmentUrls(account);
|
|
24011
|
-
this.state
|
|
24012
|
-
|
|
24013
|
-
|
|
24372
|
+
yield this.updateState((state) => state_service_awaiter(this, void 0, void 0, function* () {
|
|
24373
|
+
state.authenticatedAccounts.push(account.profile.userId);
|
|
24374
|
+
yield this.storageService.save(keys.authenticatedAccounts, state.authenticatedAccounts);
|
|
24375
|
+
state.accounts[account.profile.userId] = account;
|
|
24376
|
+
return state;
|
|
24377
|
+
}));
|
|
24014
24378
|
yield this.scaffoldNewAccountStorage(account);
|
|
24015
24379
|
yield this.setLastActive(new Date().getTime(), { userId: account.profile.userId });
|
|
24016
24380
|
yield this.setActiveUser(account.profile.userId);
|
|
@@ -24020,17 +24384,21 @@ class StateService {
|
|
|
24020
24384
|
setActiveUser(userId) {
|
|
24021
24385
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
24022
24386
|
this.clearDecryptedDataForActiveUser();
|
|
24023
|
-
this.state
|
|
24024
|
-
|
|
24025
|
-
|
|
24387
|
+
yield this.updateState((state) => state_service_awaiter(this, void 0, void 0, function* () {
|
|
24388
|
+
state.activeUserId = userId;
|
|
24389
|
+
yield this.storageService.save(keys.activeUserId, userId);
|
|
24390
|
+
this.activeAccount.next(state.activeUserId);
|
|
24391
|
+
return state;
|
|
24392
|
+
}));
|
|
24026
24393
|
yield this.pushAccounts();
|
|
24027
24394
|
});
|
|
24028
24395
|
}
|
|
24029
24396
|
clean(options) {
|
|
24397
|
+
var _a;
|
|
24030
24398
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
24031
|
-
options = this.reconcileOptions(options, this.defaultInMemoryOptions);
|
|
24399
|
+
options = this.reconcileOptions(options, yield this.defaultInMemoryOptions());
|
|
24032
24400
|
yield this.deAuthenticateAccount(options.userId);
|
|
24033
|
-
if (options.userId === this.state.activeUserId) {
|
|
24401
|
+
if (options.userId === ((_a = (yield this.state())) === null || _a === void 0 ? void 0 : _a.activeUserId)) {
|
|
24034
24402
|
yield this.dynamicallySetActiveUser();
|
|
24035
24403
|
}
|
|
24036
24404
|
yield this.removeAccountFromDisk(options === null || options === void 0 ? void 0 : options.userId);
|
|
@@ -24056,14 +24424,14 @@ class StateService {
|
|
|
24056
24424
|
getAddEditCipherInfo(options) {
|
|
24057
24425
|
var _a, _b;
|
|
24058
24426
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
24059
|
-
return (_b = (_a = (yield this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions)))) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.addEditCipherInfo;
|
|
24427
|
+
return (_b = (_a = (yield this.getAccount(this.reconcileOptions(options, yield this.defaultInMemoryOptions())))) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.addEditCipherInfo;
|
|
24060
24428
|
});
|
|
24061
24429
|
}
|
|
24062
24430
|
setAddEditCipherInfo(value, options) {
|
|
24063
24431
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
24064
|
-
const account = yield this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
24432
|
+
const account = yield this.getAccount(this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
24065
24433
|
account.data.addEditCipherInfo = value;
|
|
24066
|
-
yield this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
24434
|
+
yield this.saveAccount(account, this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
24067
24435
|
});
|
|
24068
24436
|
}
|
|
24069
24437
|
getAlwaysShowDock(options) {
|
|
@@ -24164,14 +24532,14 @@ class StateService {
|
|
|
24164
24532
|
getBiometricLocked(options) {
|
|
24165
24533
|
var _a, _b, _c;
|
|
24166
24534
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
24167
|
-
return ((_c = (_b = (_a = (yield this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions)))) === null || _a === void 0 ? void 0 : _a.settings) === null || _b === void 0 ? void 0 : _b.biometricLocked) !== null && _c !== void 0 ? _c : false);
|
|
24535
|
+
return ((_c = (_b = (_a = (yield this.getAccount(this.reconcileOptions(options, yield this.defaultInMemoryOptions())))) === null || _a === void 0 ? void 0 : _a.settings) === null || _b === void 0 ? void 0 : _b.biometricLocked) !== null && _c !== void 0 ? _c : false);
|
|
24168
24536
|
});
|
|
24169
24537
|
}
|
|
24170
24538
|
setBiometricLocked(value, options) {
|
|
24171
24539
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
24172
|
-
const account = yield this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
24540
|
+
const account = yield this.getAccount(this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
24173
24541
|
account.settings.biometricLocked = value;
|
|
24174
|
-
yield this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
24542
|
+
yield this.saveAccount(account, this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
24175
24543
|
});
|
|
24176
24544
|
}
|
|
24177
24545
|
getBiometricText(options) {
|
|
@@ -24294,14 +24662,21 @@ class StateService {
|
|
|
24294
24662
|
getCryptoMasterKey(options) {
|
|
24295
24663
|
var _a, _b;
|
|
24296
24664
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
24297
|
-
return (_b = (_a = (yield this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions)))) === null || _a === void 0 ? void 0 : _a.keys) === null || _b === void 0 ? void 0 : _b.cryptoMasterKey;
|
|
24665
|
+
return (_b = (_a = (yield this.getAccount(this.reconcileOptions(options, yield this.defaultInMemoryOptions())))) === null || _a === void 0 ? void 0 : _a.keys) === null || _b === void 0 ? void 0 : _b.cryptoMasterKey;
|
|
24298
24666
|
});
|
|
24299
24667
|
}
|
|
24300
24668
|
setCryptoMasterKey(value, options) {
|
|
24301
24669
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
24302
|
-
const account = yield this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
24670
|
+
const account = yield this.getAccount(this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
24303
24671
|
account.keys.cryptoMasterKey = value;
|
|
24304
|
-
yield this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
24672
|
+
yield this.saveAccount(account, this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
24673
|
+
if (options.userId == this.activeAccount.getValue()) {
|
|
24674
|
+
const nextValue = value != null;
|
|
24675
|
+
// Avoid emitting if we are already unlocked
|
|
24676
|
+
if (this.activeAccountUnlocked.getValue() != nextValue) {
|
|
24677
|
+
this.activeAccountUnlocked.next(nextValue);
|
|
24678
|
+
}
|
|
24679
|
+
}
|
|
24305
24680
|
});
|
|
24306
24681
|
}
|
|
24307
24682
|
getCryptoMasterKeyAuto(options) {
|
|
@@ -24370,157 +24745,152 @@ class StateService {
|
|
|
24370
24745
|
getDecodedToken(options) {
|
|
24371
24746
|
var _a, _b;
|
|
24372
24747
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
24373
|
-
return (_b = (_a = (yield this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions)))) === null || _a === void 0 ? void 0 : _a.tokens) === null || _b === void 0 ? void 0 : _b.decodedToken;
|
|
24748
|
+
return (_b = (_a = (yield this.getAccount(this.reconcileOptions(options, yield this.defaultInMemoryOptions())))) === null || _a === void 0 ? void 0 : _a.tokens) === null || _b === void 0 ? void 0 : _b.decodedToken;
|
|
24374
24749
|
});
|
|
24375
24750
|
}
|
|
24376
24751
|
setDecodedToken(value, options) {
|
|
24377
24752
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
24378
|
-
const account = yield this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
24753
|
+
const account = yield this.getAccount(this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
24379
24754
|
account.tokens.decodedToken = value;
|
|
24380
|
-
yield this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
24755
|
+
yield this.saveAccount(account, this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
24381
24756
|
});
|
|
24382
24757
|
}
|
|
24383
24758
|
getDecryptedCiphers(options) {
|
|
24384
24759
|
var _a, _b, _c;
|
|
24385
24760
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
24386
|
-
return (_c = (_b = (_a = (yield this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions)))) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.ciphers) === null || _c === void 0 ? void 0 : _c.decrypted;
|
|
24761
|
+
return (_c = (_b = (_a = (yield this.getAccount(this.reconcileOptions(options, yield this.defaultInMemoryOptions())))) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.ciphers) === null || _c === void 0 ? void 0 : _c.decrypted;
|
|
24387
24762
|
});
|
|
24388
24763
|
}
|
|
24389
24764
|
setDecryptedCiphers(value, options) {
|
|
24390
24765
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
24391
|
-
const account = yield this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
24766
|
+
const account = yield this.getAccount(this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
24392
24767
|
account.data.ciphers.decrypted = value;
|
|
24393
|
-
yield this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
24768
|
+
yield this.saveAccount(account, this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
24394
24769
|
});
|
|
24395
24770
|
}
|
|
24396
24771
|
getDecryptedCollections(options) {
|
|
24397
24772
|
var _a, _b, _c;
|
|
24398
24773
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
24399
|
-
return (_c = (_b = (_a = (yield this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions)))) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.collections) === null || _c === void 0 ? void 0 : _c.decrypted;
|
|
24774
|
+
return (_c = (_b = (_a = (yield this.getAccount(this.reconcileOptions(options, yield this.defaultInMemoryOptions())))) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.collections) === null || _c === void 0 ? void 0 : _c.decrypted;
|
|
24400
24775
|
});
|
|
24401
24776
|
}
|
|
24402
24777
|
setDecryptedCollections(value, options) {
|
|
24403
24778
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
24404
|
-
const account = yield this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
24779
|
+
const account = yield this.getAccount(this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
24405
24780
|
account.data.collections.decrypted = value;
|
|
24406
|
-
yield this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
24781
|
+
yield this.saveAccount(account, this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
24407
24782
|
});
|
|
24408
24783
|
}
|
|
24409
24784
|
getDecryptedCryptoSymmetricKey(options) {
|
|
24410
24785
|
var _a, _b, _c;
|
|
24411
24786
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
24412
|
-
return (_c = (_b = (_a = (yield this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions)))) === null || _a === void 0 ? void 0 : _a.keys) === null || _b === void 0 ? void 0 : _b.cryptoSymmetricKey) === null || _c === void 0 ? void 0 : _c.decrypted;
|
|
24787
|
+
return (_c = (_b = (_a = (yield this.getAccount(this.reconcileOptions(options, yield this.defaultInMemoryOptions())))) === null || _a === void 0 ? void 0 : _a.keys) === null || _b === void 0 ? void 0 : _b.cryptoSymmetricKey) === null || _c === void 0 ? void 0 : _c.decrypted;
|
|
24413
24788
|
});
|
|
24414
24789
|
}
|
|
24415
24790
|
setDecryptedCryptoSymmetricKey(value, options) {
|
|
24416
24791
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
24417
|
-
const account = yield this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
24792
|
+
const account = yield this.getAccount(this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
24418
24793
|
account.keys.cryptoSymmetricKey.decrypted = value;
|
|
24419
|
-
yield this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
24420
|
-
});
|
|
24421
|
-
}
|
|
24422
|
-
getDecryptedFolders(options) {
|
|
24423
|
-
var _a, _b, _c;
|
|
24424
|
-
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
24425
|
-
return (_c = (_b = (_a = (yield this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions)))) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.folders) === null || _c === void 0 ? void 0 : _c.decrypted;
|
|
24426
|
-
});
|
|
24427
|
-
}
|
|
24428
|
-
setDecryptedFolders(value, options) {
|
|
24429
|
-
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
24430
|
-
const account = yield this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
24431
|
-
account.data.folders.decrypted = value;
|
|
24432
|
-
yield this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
24794
|
+
yield this.saveAccount(account, this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
24433
24795
|
});
|
|
24434
24796
|
}
|
|
24435
24797
|
getDecryptedOrganizationKeys(options) {
|
|
24436
|
-
var _a, _b
|
|
24798
|
+
var _a, _b;
|
|
24437
24799
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
24438
|
-
|
|
24800
|
+
const account = yield this.getAccount(this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
24801
|
+
return (_b = (_a = account === null || account === void 0 ? void 0 : account.keys) === null || _a === void 0 ? void 0 : _a.organizationKeys) === null || _b === void 0 ? void 0 : _b.decrypted;
|
|
24439
24802
|
});
|
|
24440
24803
|
}
|
|
24441
24804
|
setDecryptedOrganizationKeys(value, options) {
|
|
24442
24805
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
24443
|
-
const account = yield this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
24806
|
+
const account = yield this.getAccount(this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
24444
24807
|
account.keys.organizationKeys.decrypted = value;
|
|
24445
|
-
yield this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
24808
|
+
yield this.saveAccount(account, this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
24446
24809
|
});
|
|
24447
24810
|
}
|
|
24448
24811
|
getDecryptedPasswordGenerationHistory(options) {
|
|
24449
24812
|
var _a, _b, _c;
|
|
24450
24813
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
24451
|
-
return (_c = (_b = (_a = (yield this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions)))) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.passwordGenerationHistory) === null || _c === void 0 ? void 0 : _c.decrypted;
|
|
24814
|
+
return (_c = (_b = (_a = (yield this.getAccount(this.reconcileOptions(options, yield this.defaultInMemoryOptions())))) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.passwordGenerationHistory) === null || _c === void 0 ? void 0 : _c.decrypted;
|
|
24452
24815
|
});
|
|
24453
24816
|
}
|
|
24454
24817
|
setDecryptedPasswordGenerationHistory(value, options) {
|
|
24455
24818
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
24456
|
-
const account = yield this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
24819
|
+
const account = yield this.getAccount(this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
24457
24820
|
account.data.passwordGenerationHistory.decrypted = value;
|
|
24458
|
-
yield this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
24821
|
+
yield this.saveAccount(account, this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
24459
24822
|
});
|
|
24460
24823
|
}
|
|
24461
24824
|
getDecryptedPinProtected(options) {
|
|
24462
24825
|
var _a, _b, _c;
|
|
24463
24826
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
24464
|
-
return (_c = (_b = (_a = (yield this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions)))) === null || _a === void 0 ? void 0 : _a.settings) === null || _b === void 0 ? void 0 : _b.pinProtected) === null || _c === void 0 ? void 0 : _c.decrypted;
|
|
24827
|
+
return (_c = (_b = (_a = (yield this.getAccount(this.reconcileOptions(options, yield this.defaultInMemoryOptions())))) === null || _a === void 0 ? void 0 : _a.settings) === null || _b === void 0 ? void 0 : _b.pinProtected) === null || _c === void 0 ? void 0 : _c.decrypted;
|
|
24465
24828
|
});
|
|
24466
24829
|
}
|
|
24467
24830
|
setDecryptedPinProtected(value, options) {
|
|
24468
24831
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
24469
|
-
const account = yield this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
24832
|
+
const account = yield this.getAccount(this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
24470
24833
|
account.settings.pinProtected.decrypted = value;
|
|
24471
|
-
yield this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
24834
|
+
yield this.saveAccount(account, this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
24472
24835
|
});
|
|
24473
24836
|
}
|
|
24474
24837
|
getDecryptedPolicies(options) {
|
|
24475
24838
|
var _a, _b, _c;
|
|
24476
24839
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
24477
|
-
return (_c = (_b = (_a = (yield this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions)))) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.policies) === null || _c === void 0 ? void 0 : _c.decrypted;
|
|
24840
|
+
return (_c = (_b = (_a = (yield this.getAccount(this.reconcileOptions(options, yield this.defaultInMemoryOptions())))) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.policies) === null || _c === void 0 ? void 0 : _c.decrypted;
|
|
24478
24841
|
});
|
|
24479
24842
|
}
|
|
24480
24843
|
setDecryptedPolicies(value, options) {
|
|
24481
24844
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
24482
|
-
const account = yield this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
24845
|
+
const account = yield this.getAccount(this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
24483
24846
|
account.data.policies.decrypted = value;
|
|
24484
|
-
yield this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
24847
|
+
yield this.saveAccount(account, this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
24485
24848
|
});
|
|
24486
24849
|
}
|
|
24487
24850
|
getDecryptedPrivateKey(options) {
|
|
24488
|
-
var _a, _b
|
|
24851
|
+
var _a, _b;
|
|
24489
24852
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
24490
|
-
|
|
24853
|
+
const privateKey = (_b = (_a = (yield this.getAccount(this.reconcileOptions(options, yield this.defaultInMemoryOptions())))) === null || _a === void 0 ? void 0 : _a.keys) === null || _b === void 0 ? void 0 : _b.privateKey;
|
|
24854
|
+
let result = privateKey === null || privateKey === void 0 ? void 0 : privateKey.decrypted;
|
|
24855
|
+
if (result == null && (privateKey === null || privateKey === void 0 ? void 0 : privateKey.decryptedSerialized) != null) {
|
|
24856
|
+
result = Utils.fromByteStringToArray(privateKey.decryptedSerialized);
|
|
24857
|
+
}
|
|
24858
|
+
return result;
|
|
24491
24859
|
});
|
|
24492
24860
|
}
|
|
24493
24861
|
setDecryptedPrivateKey(value, options) {
|
|
24494
24862
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
24495
|
-
const account = yield this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
24863
|
+
const account = yield this.getAccount(this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
24496
24864
|
account.keys.privateKey.decrypted = value;
|
|
24497
|
-
|
|
24865
|
+
account.keys.privateKey.decryptedSerialized =
|
|
24866
|
+
value == null ? null : Utils.fromBufferToByteString(value);
|
|
24867
|
+
yield this.saveAccount(account, this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
24498
24868
|
});
|
|
24499
24869
|
}
|
|
24500
24870
|
getDecryptedProviderKeys(options) {
|
|
24501
24871
|
var _a, _b, _c;
|
|
24502
24872
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
24503
|
-
return (_c = (_b = (_a = (yield this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions)))) === null || _a === void 0 ? void 0 : _a.keys) === null || _b === void 0 ? void 0 : _b.providerKeys) === null || _c === void 0 ? void 0 : _c.decrypted;
|
|
24873
|
+
return (_c = (_b = (_a = (yield this.getAccount(this.reconcileOptions(options, yield this.defaultInMemoryOptions())))) === null || _a === void 0 ? void 0 : _a.keys) === null || _b === void 0 ? void 0 : _b.providerKeys) === null || _c === void 0 ? void 0 : _c.decrypted;
|
|
24504
24874
|
});
|
|
24505
24875
|
}
|
|
24506
24876
|
setDecryptedProviderKeys(value, options) {
|
|
24507
24877
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
24508
|
-
const account = yield this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
24878
|
+
const account = yield this.getAccount(this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
24509
24879
|
account.keys.providerKeys.decrypted = value;
|
|
24510
|
-
yield this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
24880
|
+
yield this.saveAccount(account, this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
24511
24881
|
});
|
|
24512
24882
|
}
|
|
24513
24883
|
getDecryptedSends(options) {
|
|
24514
24884
|
var _a, _b, _c;
|
|
24515
24885
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
24516
|
-
return (_c = (_b = (_a = (yield this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions)))) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.sends) === null || _c === void 0 ? void 0 : _c.decrypted;
|
|
24886
|
+
return (_c = (_b = (_a = (yield this.getAccount(this.reconcileOptions(options, yield this.defaultInMemoryOptions())))) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.sends) === null || _c === void 0 ? void 0 : _c.decrypted;
|
|
24517
24887
|
});
|
|
24518
24888
|
}
|
|
24519
24889
|
setDecryptedSends(value, options) {
|
|
24520
24890
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
24521
|
-
const account = yield this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
24891
|
+
const account = yield this.getAccount(this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
24522
24892
|
account.data.sends.decrypted = value;
|
|
24523
|
-
yield this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
24893
|
+
yield this.saveAccount(account, this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
24524
24894
|
});
|
|
24525
24895
|
}
|
|
24526
24896
|
getDefaultUriMatch(options) {
|
|
@@ -24669,14 +25039,14 @@ class StateService {
|
|
|
24669
25039
|
getEmail(options) {
|
|
24670
25040
|
var _a, _b;
|
|
24671
25041
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
24672
|
-
return (_b = (_a = (yield this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions)))) === null || _a === void 0 ? void 0 : _a.profile) === null || _b === void 0 ? void 0 : _b.email;
|
|
25042
|
+
return (_b = (_a = (yield this.getAccount(this.reconcileOptions(options, yield this.defaultInMemoryOptions())))) === null || _a === void 0 ? void 0 : _a.profile) === null || _b === void 0 ? void 0 : _b.email;
|
|
24673
25043
|
});
|
|
24674
25044
|
}
|
|
24675
25045
|
setEmail(value, options) {
|
|
24676
25046
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
24677
|
-
const account = yield this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
25047
|
+
const account = yield this.getAccount(this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
24678
25048
|
account.profile.email = value;
|
|
24679
|
-
yield this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
25049
|
+
yield this.saveAccount(account, this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
24680
25050
|
});
|
|
24681
25051
|
}
|
|
24682
25052
|
getEmailVerified(options) {
|
|
@@ -24945,9 +25315,10 @@ class StateService {
|
|
|
24945
25315
|
});
|
|
24946
25316
|
}
|
|
24947
25317
|
getEncryptedPrivateKey(options) {
|
|
24948
|
-
var _a, _b
|
|
25318
|
+
var _a, _b;
|
|
24949
25319
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
24950
|
-
|
|
25320
|
+
const account = yield this.getAccount(this.reconcileOptions(options, yield this.defaultOnDiskOptions()));
|
|
25321
|
+
return (_b = (_a = account === null || account === void 0 ? void 0 : account.keys) === null || _a === void 0 ? void 0 : _a.privateKey) === null || _b === void 0 ? void 0 : _b.encrypted;
|
|
24951
25322
|
});
|
|
24952
25323
|
}
|
|
24953
25324
|
setEncryptedPrivateKey(value, options) {
|
|
@@ -25010,13 +25381,13 @@ class StateService {
|
|
|
25010
25381
|
});
|
|
25011
25382
|
}
|
|
25012
25383
|
getEnvironmentUrls(options) {
|
|
25013
|
-
var _a, _b, _c;
|
|
25384
|
+
var _a, _b, _c, _d;
|
|
25014
25385
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
25015
|
-
if (this.state.activeUserId == null) {
|
|
25386
|
+
if (((_a = (yield this.state())) === null || _a === void 0 ? void 0 : _a.activeUserId) == null) {
|
|
25016
25387
|
return yield this.getGlobalEnvironmentUrls(options);
|
|
25017
25388
|
}
|
|
25018
25389
|
options = this.reconcileOptions(options, yield this.defaultOnDiskOptions());
|
|
25019
|
-
return (
|
|
25390
|
+
return (_d = (_c = (_b = (yield this.getAccount(options))) === null || _b === void 0 ? void 0 : _b.settings) === null || _c === void 0 ? void 0 : _c.environmentUrls) !== null && _d !== void 0 ? _d : new EnvironmentUrls();
|
|
25020
25391
|
});
|
|
25021
25392
|
}
|
|
25022
25393
|
setEnvironmentUrls(value, options) {
|
|
@@ -25057,27 +25428,27 @@ class StateService {
|
|
|
25057
25428
|
getEverBeenUnlocked(options) {
|
|
25058
25429
|
var _a, _b, _c;
|
|
25059
25430
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
25060
|
-
return ((_c = (_b = (_a = (yield this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions)))) === null || _a === void 0 ? void 0 : _a.profile) === null || _b === void 0 ? void 0 : _b.everBeenUnlocked) !== null && _c !== void 0 ? _c : false);
|
|
25431
|
+
return ((_c = (_b = (_a = (yield this.getAccount(this.reconcileOptions(options, yield this.defaultInMemoryOptions())))) === null || _a === void 0 ? void 0 : _a.profile) === null || _b === void 0 ? void 0 : _b.everBeenUnlocked) !== null && _c !== void 0 ? _c : false);
|
|
25061
25432
|
});
|
|
25062
25433
|
}
|
|
25063
25434
|
setEverBeenUnlocked(value, options) {
|
|
25064
25435
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
25065
|
-
const account = yield this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
25436
|
+
const account = yield this.getAccount(this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
25066
25437
|
account.profile.everBeenUnlocked = value;
|
|
25067
|
-
yield this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
25438
|
+
yield this.saveAccount(account, this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
25068
25439
|
});
|
|
25069
25440
|
}
|
|
25070
25441
|
getForcePasswordReset(options) {
|
|
25071
25442
|
var _a, _b, _c;
|
|
25072
25443
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
25073
|
-
return ((_c = (_b = (_a = (yield this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions)))) === null || _a === void 0 ? void 0 : _a.profile) === null || _b === void 0 ? void 0 : _b.forcePasswordReset) !== null && _c !== void 0 ? _c : false);
|
|
25444
|
+
return ((_c = (_b = (_a = (yield this.getAccount(this.reconcileOptions(options, yield this.defaultInMemoryOptions())))) === null || _a === void 0 ? void 0 : _a.profile) === null || _b === void 0 ? void 0 : _b.forcePasswordReset) !== null && _c !== void 0 ? _c : false);
|
|
25074
25445
|
});
|
|
25075
25446
|
}
|
|
25076
25447
|
setForcePasswordReset(value, options) {
|
|
25077
25448
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
25078
|
-
const account = yield this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
25449
|
+
const account = yield this.getAccount(this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
25079
25450
|
account.profile.forcePasswordReset = value;
|
|
25080
|
-
yield this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
25451
|
+
yield this.saveAccount(account, this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
25081
25452
|
});
|
|
25082
25453
|
}
|
|
25083
25454
|
getInstalledVersion(options) {
|
|
@@ -25214,14 +25585,14 @@ class StateService {
|
|
|
25214
25585
|
getMainWindowSize(options) {
|
|
25215
25586
|
var _a;
|
|
25216
25587
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
25217
|
-
return (_a = (yield this.getGlobals(this.reconcileOptions(options, this.defaultInMemoryOptions)))) === null || _a === void 0 ? void 0 : _a.mainWindowSize;
|
|
25588
|
+
return (_a = (yield this.getGlobals(this.reconcileOptions(options, yield this.defaultInMemoryOptions())))) === null || _a === void 0 ? void 0 : _a.mainWindowSize;
|
|
25218
25589
|
});
|
|
25219
25590
|
}
|
|
25220
25591
|
setMainWindowSize(value, options) {
|
|
25221
25592
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
25222
|
-
const globals = yield this.getGlobals(this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
25593
|
+
const globals = yield this.getGlobals(this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
25223
25594
|
globals.mainWindowSize = value;
|
|
25224
|
-
yield this.saveGlobals(globals, this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
25595
|
+
yield this.saveGlobals(globals, this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
25225
25596
|
});
|
|
25226
25597
|
}
|
|
25227
25598
|
getMinimizeOnCopyToClipboard(options) {
|
|
@@ -25292,14 +25663,14 @@ class StateService {
|
|
|
25292
25663
|
getOrganizationInvitation(options) {
|
|
25293
25664
|
var _a;
|
|
25294
25665
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
25295
|
-
return (_a = (yield this.getGlobals(this.reconcileOptions(options, this.defaultInMemoryOptions)))) === null || _a === void 0 ? void 0 : _a.organizationInvitation;
|
|
25666
|
+
return (_a = (yield this.getGlobals(this.reconcileOptions(options, yield this.defaultInMemoryOptions())))) === null || _a === void 0 ? void 0 : _a.organizationInvitation;
|
|
25296
25667
|
});
|
|
25297
25668
|
}
|
|
25298
25669
|
setOrganizationInvitation(value, options) {
|
|
25299
25670
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
25300
|
-
const globals = yield this.getGlobals(this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
25671
|
+
const globals = yield this.getGlobals(this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
25301
25672
|
globals.organizationInvitation = value;
|
|
25302
|
-
yield this.saveGlobals(globals, this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
25673
|
+
yield this.saveGlobals(globals, this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
25303
25674
|
});
|
|
25304
25675
|
}
|
|
25305
25676
|
getOrganizations(options) {
|
|
@@ -25318,40 +25689,40 @@ class StateService {
|
|
|
25318
25689
|
getPasswordGenerationOptions(options) {
|
|
25319
25690
|
var _a, _b;
|
|
25320
25691
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
25321
|
-
return (_b = (_a = (yield this.getAccount(this.reconcileOptions(options, yield this.
|
|
25692
|
+
return (_b = (_a = (yield this.getAccount(this.reconcileOptions(options, yield this.defaultOnDiskLocalOptions())))) === null || _a === void 0 ? void 0 : _a.settings) === null || _b === void 0 ? void 0 : _b.passwordGenerationOptions;
|
|
25322
25693
|
});
|
|
25323
25694
|
}
|
|
25324
25695
|
setPasswordGenerationOptions(value, options) {
|
|
25325
25696
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
25326
|
-
const account = yield this.getAccount(this.reconcileOptions(options, yield this.
|
|
25697
|
+
const account = yield this.getAccount(this.reconcileOptions(options, yield this.defaultOnDiskLocalOptions()));
|
|
25327
25698
|
account.settings.passwordGenerationOptions = value;
|
|
25328
|
-
yield this.saveAccount(account, this.reconcileOptions(options, yield this.
|
|
25699
|
+
yield this.saveAccount(account, this.reconcileOptions(options, yield this.defaultOnDiskLocalOptions()));
|
|
25329
25700
|
});
|
|
25330
25701
|
}
|
|
25331
25702
|
getUsernameGenerationOptions(options) {
|
|
25332
25703
|
var _a, _b;
|
|
25333
25704
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
25334
|
-
return (_b = (_a = (yield this.getAccount(this.reconcileOptions(options, yield this.
|
|
25705
|
+
return (_b = (_a = (yield this.getAccount(this.reconcileOptions(options, yield this.defaultOnDiskLocalOptions())))) === null || _a === void 0 ? void 0 : _a.settings) === null || _b === void 0 ? void 0 : _b.usernameGenerationOptions;
|
|
25335
25706
|
});
|
|
25336
25707
|
}
|
|
25337
25708
|
setUsernameGenerationOptions(value, options) {
|
|
25338
25709
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
25339
|
-
const account = yield this.getAccount(this.reconcileOptions(options, yield this.
|
|
25710
|
+
const account = yield this.getAccount(this.reconcileOptions(options, yield this.defaultOnDiskLocalOptions()));
|
|
25340
25711
|
account.settings.usernameGenerationOptions = value;
|
|
25341
|
-
yield this.saveAccount(account, this.reconcileOptions(options, yield this.
|
|
25712
|
+
yield this.saveAccount(account, this.reconcileOptions(options, yield this.defaultOnDiskLocalOptions()));
|
|
25342
25713
|
});
|
|
25343
25714
|
}
|
|
25344
25715
|
getGeneratorOptions(options) {
|
|
25345
25716
|
var _a, _b;
|
|
25346
25717
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
25347
|
-
return (_b = (_a = (yield this.getAccount(this.reconcileOptions(options, yield this.
|
|
25718
|
+
return (_b = (_a = (yield this.getAccount(this.reconcileOptions(options, yield this.defaultOnDiskLocalOptions())))) === null || _a === void 0 ? void 0 : _a.settings) === null || _b === void 0 ? void 0 : _b.generatorOptions;
|
|
25348
25719
|
});
|
|
25349
25720
|
}
|
|
25350
25721
|
setGeneratorOptions(value, options) {
|
|
25351
25722
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
25352
|
-
const account = yield this.getAccount(this.reconcileOptions(options, yield this.
|
|
25723
|
+
const account = yield this.getAccount(this.reconcileOptions(options, yield this.defaultOnDiskLocalOptions()));
|
|
25353
25724
|
account.settings.generatorOptions = value;
|
|
25354
|
-
yield this.saveAccount(account, this.reconcileOptions(options, yield this.
|
|
25725
|
+
yield this.saveAccount(account, this.reconcileOptions(options, yield this.defaultOnDiskLocalOptions()));
|
|
25355
25726
|
});
|
|
25356
25727
|
}
|
|
25357
25728
|
getProtectedPin(options) {
|
|
@@ -25381,16 +25752,22 @@ class StateService {
|
|
|
25381
25752
|
});
|
|
25382
25753
|
}
|
|
25383
25754
|
getPublicKey(options) {
|
|
25384
|
-
var _a
|
|
25755
|
+
var _a;
|
|
25385
25756
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
25386
|
-
|
|
25757
|
+
const keys = (_a = (yield this.getAccount(this.reconcileOptions(options, yield this.defaultInMemoryOptions())))) === null || _a === void 0 ? void 0 : _a.keys;
|
|
25758
|
+
let result = keys === null || keys === void 0 ? void 0 : keys.publicKey;
|
|
25759
|
+
if (result == null && (keys === null || keys === void 0 ? void 0 : keys.publicKeySerialized) != null) {
|
|
25760
|
+
result = Utils.fromByteStringToArray(keys.publicKeySerialized);
|
|
25761
|
+
}
|
|
25762
|
+
return result;
|
|
25387
25763
|
});
|
|
25388
25764
|
}
|
|
25389
25765
|
setPublicKey(value, options) {
|
|
25390
25766
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
25391
|
-
const account = yield this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
25767
|
+
const account = yield this.getAccount(this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
25392
25768
|
account.keys.publicKey = value;
|
|
25393
|
-
|
|
25769
|
+
account.keys.publicKeySerialized = value == null ? null : Utils.fromBufferToByteString(value);
|
|
25770
|
+
yield this.saveAccount(account, this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
25394
25771
|
});
|
|
25395
25772
|
}
|
|
25396
25773
|
getRefreshToken(options) {
|
|
@@ -25424,14 +25801,14 @@ class StateService {
|
|
|
25424
25801
|
getSecurityStamp(options) {
|
|
25425
25802
|
var _a, _b;
|
|
25426
25803
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
25427
|
-
return (_b = (_a = (yield this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions)))) === null || _a === void 0 ? void 0 : _a.tokens) === null || _b === void 0 ? void 0 : _b.securityStamp;
|
|
25804
|
+
return (_b = (_a = (yield this.getAccount(this.reconcileOptions(options, yield this.defaultInMemoryOptions())))) === null || _a === void 0 ? void 0 : _a.tokens) === null || _b === void 0 ? void 0 : _b.securityStamp;
|
|
25428
25805
|
});
|
|
25429
25806
|
}
|
|
25430
25807
|
setSecurityStamp(value, options) {
|
|
25431
25808
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
25432
|
-
const account = yield this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
25809
|
+
const account = yield this.getAccount(this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
25433
25810
|
account.tokens.securityStamp = value;
|
|
25434
|
-
yield this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions));
|
|
25811
|
+
yield this.saveAccount(account, this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
25435
25812
|
});
|
|
25436
25813
|
}
|
|
25437
25814
|
getSettings(options) {
|
|
@@ -25592,7 +25969,7 @@ class StateService {
|
|
|
25592
25969
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
25593
25970
|
let globals;
|
|
25594
25971
|
if (this.useMemory(options.storageLocation)) {
|
|
25595
|
-
globals = this.getGlobalsFromMemory();
|
|
25972
|
+
globals = yield this.getGlobalsFromMemory();
|
|
25596
25973
|
}
|
|
25597
25974
|
if (this.useDisk && globals == null) {
|
|
25598
25975
|
globals = yield this.getGlobalsFromDisk(options);
|
|
@@ -25608,7 +25985,9 @@ class StateService {
|
|
|
25608
25985
|
});
|
|
25609
25986
|
}
|
|
25610
25987
|
getGlobalsFromMemory() {
|
|
25611
|
-
return this
|
|
25988
|
+
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
25989
|
+
return (yield this.state()).globals;
|
|
25990
|
+
});
|
|
25612
25991
|
}
|
|
25613
25992
|
getGlobalsFromDisk(options) {
|
|
25614
25993
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
@@ -25616,7 +25995,12 @@ class StateService {
|
|
|
25616
25995
|
});
|
|
25617
25996
|
}
|
|
25618
25997
|
saveGlobalsToMemory(globals) {
|
|
25619
|
-
this
|
|
25998
|
+
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
25999
|
+
yield this.updateState((state) => state_service_awaiter(this, void 0, void 0, function* () {
|
|
26000
|
+
state.globals = globals;
|
|
26001
|
+
return state;
|
|
26002
|
+
}));
|
|
26003
|
+
});
|
|
25620
26004
|
}
|
|
25621
26005
|
saveGlobalsToDisk(globals, options) {
|
|
25622
26006
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
@@ -25633,7 +26017,7 @@ class StateService {
|
|
|
25633
26017
|
try {
|
|
25634
26018
|
let account;
|
|
25635
26019
|
if (this.useMemory(options.storageLocation)) {
|
|
25636
|
-
account = this.getAccountFromMemory(options);
|
|
26020
|
+
account = yield this.getAccountFromMemory(options);
|
|
25637
26021
|
}
|
|
25638
26022
|
if (this.useDisk(options.storageLocation) && account == null) {
|
|
25639
26023
|
account = yield this.getAccountFromDisk(options);
|
|
@@ -25646,21 +26030,29 @@ class StateService {
|
|
|
25646
26030
|
});
|
|
25647
26031
|
}
|
|
25648
26032
|
getAccountFromMemory(options) {
|
|
25649
|
-
|
|
25650
|
-
return
|
|
25651
|
-
|
|
25652
|
-
|
|
26033
|
+
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
26034
|
+
return yield this.state().then((state) => state_service_awaiter(this, void 0, void 0, function* () {
|
|
26035
|
+
if (state.accounts == null) {
|
|
26036
|
+
return null;
|
|
26037
|
+
}
|
|
26038
|
+
return state.accounts[yield this.getUserIdFromMemory(options)];
|
|
26039
|
+
}));
|
|
26040
|
+
});
|
|
25653
26041
|
}
|
|
25654
26042
|
getUserIdFromMemory(options) {
|
|
25655
|
-
|
|
25656
|
-
|
|
25657
|
-
|
|
25658
|
-
|
|
26043
|
+
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
26044
|
+
return yield this.state().then((state) => {
|
|
26045
|
+
var _a, _b;
|
|
26046
|
+
return (options === null || options === void 0 ? void 0 : options.userId) != null
|
|
26047
|
+
? (_b = (_a = state.accounts[options.userId]) === null || _a === void 0 ? void 0 : _a.profile) === null || _b === void 0 ? void 0 : _b.userId
|
|
26048
|
+
: state.activeUserId;
|
|
26049
|
+
});
|
|
26050
|
+
});
|
|
25659
26051
|
}
|
|
25660
26052
|
getAccountFromDisk(options) {
|
|
25661
|
-
var _a;
|
|
26053
|
+
var _a, _b;
|
|
25662
26054
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
25663
|
-
if ((options === null || options === void 0 ? void 0 : options.userId) == null && this.state.activeUserId == null) {
|
|
26055
|
+
if ((options === null || options === void 0 ? void 0 : options.userId) == null && ((_a = (yield this.state())) === null || _a === void 0 ? void 0 : _a.activeUserId) == null) {
|
|
25664
26056
|
return null;
|
|
25665
26057
|
}
|
|
25666
26058
|
if (this.useAccountCache) {
|
|
@@ -25670,7 +26062,7 @@ class StateService {
|
|
|
25670
26062
|
}
|
|
25671
26063
|
}
|
|
25672
26064
|
const account = (options === null || options === void 0 ? void 0 : options.useSecureStorage)
|
|
25673
|
-
? (
|
|
26065
|
+
? (_b = (yield this.secureStorageService.get(options.userId, options))) !== null && _b !== void 0 ? _b : (yield this.storageService.get(options.userId, this.reconcileOptions(options, { htmlStorageLocation: HtmlStorageLocation.Local })))
|
|
25674
26066
|
: yield this.storageService.get(options.userId, options);
|
|
25675
26067
|
if (this.useAccountCache) {
|
|
25676
26068
|
this.accountDiskCache.set(options.userId, account);
|
|
@@ -25708,7 +26100,12 @@ class StateService {
|
|
|
25708
26100
|
saveAccountToMemory(account) {
|
|
25709
26101
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
25710
26102
|
if (this.getAccountFromMemory({ userId: account.profile.userId }) !== null) {
|
|
25711
|
-
this.state
|
|
26103
|
+
yield this.updateState((state) => {
|
|
26104
|
+
return new Promise((resolve) => {
|
|
26105
|
+
state.accounts[account.profile.userId] = account;
|
|
26106
|
+
resolve(state);
|
|
26107
|
+
});
|
|
26108
|
+
});
|
|
25712
26109
|
}
|
|
25713
26110
|
yield this.pushAccounts();
|
|
25714
26111
|
});
|
|
@@ -25770,14 +26167,15 @@ class StateService {
|
|
|
25770
26167
|
}
|
|
25771
26168
|
//
|
|
25772
26169
|
pushAccounts() {
|
|
25773
|
-
var _a;
|
|
25774
26170
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
25775
26171
|
yield this.pruneInMemoryAccounts();
|
|
25776
|
-
|
|
25777
|
-
|
|
25778
|
-
|
|
25779
|
-
|
|
25780
|
-
|
|
26172
|
+
yield this.state().then((state) => {
|
|
26173
|
+
if (state.accounts == null || Object.keys(state.accounts).length < 1) {
|
|
26174
|
+
this.accounts.next(null);
|
|
26175
|
+
return;
|
|
26176
|
+
}
|
|
26177
|
+
this.accounts.next(state.accounts);
|
|
26178
|
+
});
|
|
25781
26179
|
});
|
|
25782
26180
|
}
|
|
25783
26181
|
reconcileOptions(requestedOptions, defaultOptions) {
|
|
@@ -25795,49 +26193,54 @@ class StateService {
|
|
|
25795
26193
|
requestedOptions.keySuffix = (_e = requestedOptions === null || requestedOptions === void 0 ? void 0 : requestedOptions.keySuffix) !== null && _e !== void 0 ? _e : defaultOptions.keySuffix;
|
|
25796
26194
|
return requestedOptions;
|
|
25797
26195
|
}
|
|
25798
|
-
|
|
25799
|
-
return
|
|
26196
|
+
defaultInMemoryOptions() {
|
|
26197
|
+
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
26198
|
+
return {
|
|
26199
|
+
storageLocation: StorageLocation.Memory,
|
|
26200
|
+
userId: (yield this.state()).activeUserId,
|
|
26201
|
+
};
|
|
26202
|
+
});
|
|
25800
26203
|
}
|
|
25801
26204
|
defaultOnDiskOptions() {
|
|
25802
|
-
var _a;
|
|
26205
|
+
var _a, _b;
|
|
25803
26206
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
25804
26207
|
return {
|
|
25805
26208
|
storageLocation: StorageLocation.Disk,
|
|
25806
26209
|
htmlStorageLocation: HtmlStorageLocation.Session,
|
|
25807
|
-
userId: (_a = this.state.activeUserId) !== null &&
|
|
26210
|
+
userId: (_b = (_a = (yield this.state())) === null || _a === void 0 ? void 0 : _a.activeUserId) !== null && _b !== void 0 ? _b : (yield this.getActiveUserIdFromStorage()),
|
|
25808
26211
|
useSecureStorage: false,
|
|
25809
26212
|
};
|
|
25810
26213
|
});
|
|
25811
26214
|
}
|
|
25812
26215
|
defaultOnDiskLocalOptions() {
|
|
25813
|
-
var _a;
|
|
26216
|
+
var _a, _b;
|
|
25814
26217
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
25815
26218
|
return {
|
|
25816
26219
|
storageLocation: StorageLocation.Disk,
|
|
25817
26220
|
htmlStorageLocation: HtmlStorageLocation.Local,
|
|
25818
|
-
userId: (_a = this.state.activeUserId) !== null &&
|
|
26221
|
+
userId: (_b = (_a = (yield this.state())) === null || _a === void 0 ? void 0 : _a.activeUserId) !== null && _b !== void 0 ? _b : (yield this.getActiveUserIdFromStorage()),
|
|
25819
26222
|
useSecureStorage: false,
|
|
25820
26223
|
};
|
|
25821
26224
|
});
|
|
25822
26225
|
}
|
|
25823
26226
|
defaultOnDiskMemoryOptions() {
|
|
25824
|
-
var _a;
|
|
26227
|
+
var _a, _b;
|
|
25825
26228
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
25826
26229
|
return {
|
|
25827
26230
|
storageLocation: StorageLocation.Disk,
|
|
25828
26231
|
htmlStorageLocation: HtmlStorageLocation.Memory,
|
|
25829
|
-
userId: (_a = this.state.activeUserId) !== null &&
|
|
26232
|
+
userId: (_b = (_a = (yield this.state())) === null || _a === void 0 ? void 0 : _a.activeUserId) !== null && _b !== void 0 ? _b : (yield this.getUserId()),
|
|
25830
26233
|
useSecureStorage: false,
|
|
25831
26234
|
};
|
|
25832
26235
|
});
|
|
25833
26236
|
}
|
|
25834
26237
|
defaultSecureStorageOptions() {
|
|
25835
|
-
var _a;
|
|
26238
|
+
var _a, _b;
|
|
25836
26239
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
25837
26240
|
return {
|
|
25838
26241
|
storageLocation: StorageLocation.Disk,
|
|
25839
26242
|
useSecureStorage: true,
|
|
25840
|
-
userId: (_a = this.state.activeUserId) !== null &&
|
|
26243
|
+
userId: (_b = (_a = (yield this.state())) === null || _a === void 0 ? void 0 : _a.activeUserId) !== null && _b !== void 0 ? _b : (yield this.getActiveUserIdFromStorage()),
|
|
25841
26244
|
};
|
|
25842
26245
|
});
|
|
25843
26246
|
}
|
|
@@ -25846,37 +26249,50 @@ class StateService {
|
|
|
25846
26249
|
return yield this.storageService.get(keys.activeUserId);
|
|
25847
26250
|
});
|
|
25848
26251
|
}
|
|
25849
|
-
removeAccountFromLocalStorage(userId =
|
|
26252
|
+
removeAccountFromLocalStorage(userId = null) {
|
|
26253
|
+
var _a;
|
|
25850
26254
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
26255
|
+
userId = userId !== null && userId !== void 0 ? userId : (_a = (yield this.state())) === null || _a === void 0 ? void 0 : _a.activeUserId;
|
|
25851
26256
|
const storedAccount = yield this.getAccount(this.reconcileOptions({ userId: userId }, yield this.defaultOnDiskLocalOptions()));
|
|
25852
26257
|
yield this.saveAccount(this.resetAccount(storedAccount), this.reconcileOptions({ userId: userId }, yield this.defaultOnDiskLocalOptions()));
|
|
25853
26258
|
});
|
|
25854
26259
|
}
|
|
25855
|
-
removeAccountFromSessionStorage(userId =
|
|
26260
|
+
removeAccountFromSessionStorage(userId = null) {
|
|
26261
|
+
var _a;
|
|
25856
26262
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
26263
|
+
userId = userId !== null && userId !== void 0 ? userId : (_a = (yield this.state())) === null || _a === void 0 ? void 0 : _a.activeUserId;
|
|
25857
26264
|
const storedAccount = yield this.getAccount(this.reconcileOptions({ userId: userId }, yield this.defaultOnDiskOptions()));
|
|
25858
26265
|
yield this.saveAccount(this.resetAccount(storedAccount), this.reconcileOptions({ userId: userId }, yield this.defaultOnDiskOptions()));
|
|
25859
26266
|
});
|
|
25860
26267
|
}
|
|
25861
|
-
removeAccountFromSecureStorage(userId =
|
|
26268
|
+
removeAccountFromSecureStorage(userId = null) {
|
|
26269
|
+
var _a;
|
|
25862
26270
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
26271
|
+
userId = userId !== null && userId !== void 0 ? userId : (_a = (yield this.state())) === null || _a === void 0 ? void 0 : _a.activeUserId;
|
|
25863
26272
|
yield this.setCryptoMasterKeyAuto(null, { userId: userId });
|
|
25864
26273
|
yield this.setCryptoMasterKeyBiometric(null, { userId: userId });
|
|
25865
26274
|
yield this.setCryptoMasterKeyB64(null, { userId: userId });
|
|
25866
26275
|
});
|
|
25867
26276
|
}
|
|
25868
|
-
removeAccountFromMemory(userId =
|
|
25869
|
-
|
|
25870
|
-
|
|
25871
|
-
|
|
25872
|
-
|
|
26277
|
+
removeAccountFromMemory(userId = null) {
|
|
26278
|
+
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
26279
|
+
yield this.updateState((state) => state_service_awaiter(this, void 0, void 0, function* () {
|
|
26280
|
+
userId = userId !== null && userId !== void 0 ? userId : state.activeUserId;
|
|
26281
|
+
delete state.accounts[userId];
|
|
26282
|
+
if (this.useAccountCache) {
|
|
26283
|
+
this.accountDiskCache.delete(userId);
|
|
26284
|
+
}
|
|
26285
|
+
return state;
|
|
26286
|
+
}));
|
|
26287
|
+
});
|
|
25873
26288
|
}
|
|
25874
26289
|
pruneInMemoryAccounts() {
|
|
26290
|
+
var _a;
|
|
25875
26291
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
25876
26292
|
// We preserve settings for logged out accounts, but we don't want to consider them when thinking about active account state
|
|
25877
|
-
for (const userId in this.state.accounts) {
|
|
26293
|
+
for (const userId in (_a = (yield this.state())) === null || _a === void 0 ? void 0 : _a.accounts) {
|
|
25878
26294
|
if (!(yield this.getIsAuthenticated({ userId: userId }))) {
|
|
25879
|
-
this.removeAccountFromMemory(userId);
|
|
26295
|
+
yield this.removeAccountFromMemory(userId);
|
|
25880
26296
|
}
|
|
25881
26297
|
}
|
|
25882
26298
|
});
|
|
@@ -25900,12 +26316,16 @@ class StateService {
|
|
|
25900
26316
|
});
|
|
25901
26317
|
}
|
|
25902
26318
|
clearDecryptedDataForActiveUser() {
|
|
25903
|
-
|
|
25904
|
-
|
|
25905
|
-
|
|
25906
|
-
|
|
25907
|
-
|
|
25908
|
-
|
|
26319
|
+
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
26320
|
+
yield this.updateState((state) => state_service_awaiter(this, void 0, void 0, function* () {
|
|
26321
|
+
var _a;
|
|
26322
|
+
const userId = state === null || state === void 0 ? void 0 : state.activeUserId;
|
|
26323
|
+
if (userId != null && ((_a = state === null || state === void 0 ? void 0 : state.accounts[userId]) === null || _a === void 0 ? void 0 : _a.data) != null) {
|
|
26324
|
+
state.accounts[userId].data = new AccountData();
|
|
26325
|
+
}
|
|
26326
|
+
return state;
|
|
26327
|
+
}));
|
|
26328
|
+
});
|
|
25909
26329
|
}
|
|
25910
26330
|
createAccount(init = null) {
|
|
25911
26331
|
return this.stateFactory.createAccount(init);
|
|
@@ -25917,8 +26337,11 @@ class StateService {
|
|
|
25917
26337
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
25918
26338
|
yield this.setAccessToken(null, { userId: userId });
|
|
25919
26339
|
yield this.setLastActive(null, { userId: userId });
|
|
25920
|
-
|
|
25921
|
-
|
|
26340
|
+
yield this.updateState((state) => state_service_awaiter(this, void 0, void 0, function* () {
|
|
26341
|
+
state.authenticatedAccounts = state.authenticatedAccounts.filter((id) => id !== userId);
|
|
26342
|
+
yield this.storageService.save(keys.authenticatedAccounts, state.authenticatedAccounts);
|
|
26343
|
+
return state;
|
|
26344
|
+
}));
|
|
25922
26345
|
});
|
|
25923
26346
|
}
|
|
25924
26347
|
removeAccountFromDisk(userId) {
|
|
@@ -25929,12 +26352,14 @@ class StateService {
|
|
|
25929
26352
|
});
|
|
25930
26353
|
}
|
|
25931
26354
|
dynamicallySetActiveUser() {
|
|
26355
|
+
var _a;
|
|
25932
26356
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
25933
|
-
|
|
26357
|
+
const accounts = (_a = (yield this.state())) === null || _a === void 0 ? void 0 : _a.accounts;
|
|
26358
|
+
if (accounts == null || Object.keys(accounts).length < 1) {
|
|
25934
26359
|
yield this.setActiveUser(null);
|
|
25935
26360
|
return;
|
|
25936
26361
|
}
|
|
25937
|
-
for (const userId in
|
|
26362
|
+
for (const userId in accounts) {
|
|
25938
26363
|
if (userId == null) {
|
|
25939
26364
|
continue;
|
|
25940
26365
|
}
|
|
@@ -25951,7 +26376,7 @@ class StateService {
|
|
|
25951
26376
|
const timeoutAction = yield this.getVaultTimeoutAction({ userId: options === null || options === void 0 ? void 0 : options.userId });
|
|
25952
26377
|
const timeout = yield this.getVaultTimeout({ userId: options === null || options === void 0 ? void 0 : options.userId });
|
|
25953
26378
|
const defaultOptions = timeoutAction === "logOut" && timeout != null
|
|
25954
|
-
? this.defaultInMemoryOptions
|
|
26379
|
+
? yield this.defaultInMemoryOptions()
|
|
25955
26380
|
: yield this.defaultOnDiskOptions();
|
|
25956
26381
|
return this.reconcileOptions(options, defaultOptions);
|
|
25957
26382
|
});
|
|
@@ -25963,6 +26388,251 @@ class StateService {
|
|
|
25963
26388
|
: yield this.secureStorageService.save(`${options.userId}${key}`, value, options);
|
|
25964
26389
|
});
|
|
25965
26390
|
}
|
|
26391
|
+
state() {
|
|
26392
|
+
return this.memoryStorageService.get(keys.state);
|
|
26393
|
+
}
|
|
26394
|
+
setState(state) {
|
|
26395
|
+
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
26396
|
+
yield this.memoryStorageService.save(keys.state, state);
|
|
26397
|
+
});
|
|
26398
|
+
}
|
|
26399
|
+
updateState(stateUpdater) {
|
|
26400
|
+
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
26401
|
+
yield this.state().then((state) => state_service_awaiter(this, void 0, void 0, function* () {
|
|
26402
|
+
const updatedState = yield stateUpdater(state);
|
|
26403
|
+
if (updatedState == null) {
|
|
26404
|
+
throw new Error("Attempted to update state to null value");
|
|
26405
|
+
}
|
|
26406
|
+
yield this.setState(updatedState);
|
|
26407
|
+
}));
|
|
26408
|
+
});
|
|
26409
|
+
}
|
|
26410
|
+
}
|
|
26411
|
+
state_service_decorate([
|
|
26412
|
+
withPrototype(SymmetricCryptoKey, SymmetricCryptoKey.initFromJson),
|
|
26413
|
+
state_service_metadata("design:type", Function),
|
|
26414
|
+
state_service_metadata("design:paramtypes", [Object]),
|
|
26415
|
+
state_service_metadata("design:returntype", Promise)
|
|
26416
|
+
], StateService.prototype, "getCryptoMasterKey", null);
|
|
26417
|
+
state_service_decorate([
|
|
26418
|
+
withPrototypeForArrayMembers(CipherView),
|
|
26419
|
+
state_service_metadata("design:type", Function),
|
|
26420
|
+
state_service_metadata("design:paramtypes", [Object]),
|
|
26421
|
+
state_service_metadata("design:returntype", Promise)
|
|
26422
|
+
], StateService.prototype, "getDecryptedCiphers", null);
|
|
26423
|
+
state_service_decorate([
|
|
26424
|
+
withPrototypeForArrayMembers(CollectionView),
|
|
26425
|
+
state_service_metadata("design:type", Function),
|
|
26426
|
+
state_service_metadata("design:paramtypes", [Object]),
|
|
26427
|
+
state_service_metadata("design:returntype", Promise)
|
|
26428
|
+
], StateService.prototype, "getDecryptedCollections", null);
|
|
26429
|
+
state_service_decorate([
|
|
26430
|
+
withPrototype(SymmetricCryptoKey, SymmetricCryptoKey.initFromJson),
|
|
26431
|
+
state_service_metadata("design:type", Function),
|
|
26432
|
+
state_service_metadata("design:paramtypes", [Object]),
|
|
26433
|
+
state_service_metadata("design:returntype", Promise)
|
|
26434
|
+
], StateService.prototype, "getDecryptedCryptoSymmetricKey", null);
|
|
26435
|
+
state_service_decorate([
|
|
26436
|
+
withPrototypeForMap(SymmetricCryptoKey, SymmetricCryptoKey.initFromJson),
|
|
26437
|
+
state_service_metadata("design:type", Function),
|
|
26438
|
+
state_service_metadata("design:paramtypes", [Object]),
|
|
26439
|
+
state_service_metadata("design:returntype", Promise)
|
|
26440
|
+
], StateService.prototype, "getDecryptedOrganizationKeys", null);
|
|
26441
|
+
state_service_decorate([
|
|
26442
|
+
withPrototypeForArrayMembers(GeneratedPasswordHistory),
|
|
26443
|
+
state_service_metadata("design:type", Function),
|
|
26444
|
+
state_service_metadata("design:paramtypes", [Object]),
|
|
26445
|
+
state_service_metadata("design:returntype", Promise)
|
|
26446
|
+
], StateService.prototype, "getDecryptedPasswordGenerationHistory", null);
|
|
26447
|
+
state_service_decorate([
|
|
26448
|
+
withPrototype(EncString),
|
|
26449
|
+
state_service_metadata("design:type", Function),
|
|
26450
|
+
state_service_metadata("design:paramtypes", [Object]),
|
|
26451
|
+
state_service_metadata("design:returntype", Promise)
|
|
26452
|
+
], StateService.prototype, "getDecryptedPinProtected", null);
|
|
26453
|
+
state_service_decorate([
|
|
26454
|
+
withPrototypeForArrayMembers(Policy),
|
|
26455
|
+
state_service_metadata("design:type", Function),
|
|
26456
|
+
state_service_metadata("design:paramtypes", [Object]),
|
|
26457
|
+
state_service_metadata("design:returntype", Promise)
|
|
26458
|
+
], StateService.prototype, "getDecryptedPolicies", null);
|
|
26459
|
+
state_service_decorate([
|
|
26460
|
+
withPrototypeForMap(SymmetricCryptoKey, SymmetricCryptoKey.initFromJson),
|
|
26461
|
+
state_service_metadata("design:type", Function),
|
|
26462
|
+
state_service_metadata("design:paramtypes", [Object]),
|
|
26463
|
+
state_service_metadata("design:returntype", Promise)
|
|
26464
|
+
], StateService.prototype, "getDecryptedProviderKeys", null);
|
|
26465
|
+
state_service_decorate([
|
|
26466
|
+
withPrototypeForArrayMembers(SendView),
|
|
26467
|
+
state_service_metadata("design:type", Function),
|
|
26468
|
+
state_service_metadata("design:paramtypes", [Object]),
|
|
26469
|
+
state_service_metadata("design:returntype", Promise)
|
|
26470
|
+
], StateService.prototype, "getDecryptedSends", null);
|
|
26471
|
+
state_service_decorate([
|
|
26472
|
+
withPrototypeForObjectValues(CipherData),
|
|
26473
|
+
state_service_metadata("design:type", Function),
|
|
26474
|
+
state_service_metadata("design:paramtypes", [Object]),
|
|
26475
|
+
state_service_metadata("design:returntype", Promise)
|
|
26476
|
+
], StateService.prototype, "getEncryptedCiphers", null);
|
|
26477
|
+
state_service_decorate([
|
|
26478
|
+
withPrototypeForObjectValues(CollectionData),
|
|
26479
|
+
state_service_metadata("design:type", Function),
|
|
26480
|
+
state_service_metadata("design:paramtypes", [Object]),
|
|
26481
|
+
state_service_metadata("design:returntype", Promise)
|
|
26482
|
+
], StateService.prototype, "getEncryptedCollections", null);
|
|
26483
|
+
state_service_decorate([
|
|
26484
|
+
withPrototypeForObjectValues(FolderData),
|
|
26485
|
+
state_service_metadata("design:type", Function),
|
|
26486
|
+
state_service_metadata("design:paramtypes", [Object]),
|
|
26487
|
+
state_service_metadata("design:returntype", Promise)
|
|
26488
|
+
], StateService.prototype, "getEncryptedFolders", null);
|
|
26489
|
+
state_service_decorate([
|
|
26490
|
+
withPrototypeForArrayMembers(GeneratedPasswordHistory),
|
|
26491
|
+
state_service_metadata("design:type", Function),
|
|
26492
|
+
state_service_metadata("design:paramtypes", [Object]),
|
|
26493
|
+
state_service_metadata("design:returntype", Promise)
|
|
26494
|
+
], StateService.prototype, "getEncryptedPasswordGenerationHistory", null);
|
|
26495
|
+
state_service_decorate([
|
|
26496
|
+
withPrototypeForObjectValues(PolicyData),
|
|
26497
|
+
state_service_metadata("design:type", Function),
|
|
26498
|
+
state_service_metadata("design:paramtypes", [Object]),
|
|
26499
|
+
state_service_metadata("design:returntype", Promise)
|
|
26500
|
+
], StateService.prototype, "getEncryptedPolicies", null);
|
|
26501
|
+
state_service_decorate([
|
|
26502
|
+
withPrototypeForObjectValues(SendData),
|
|
26503
|
+
state_service_metadata("design:type", Function),
|
|
26504
|
+
state_service_metadata("design:paramtypes", [Object]),
|
|
26505
|
+
state_service_metadata("design:returntype", Promise)
|
|
26506
|
+
], StateService.prototype, "getEncryptedSends", null);
|
|
26507
|
+
state_service_decorate([
|
|
26508
|
+
withPrototype(EnvironmentUrls),
|
|
26509
|
+
state_service_metadata("design:type", Function),
|
|
26510
|
+
state_service_metadata("design:paramtypes", [Object]),
|
|
26511
|
+
state_service_metadata("design:returntype", Promise)
|
|
26512
|
+
], StateService.prototype, "getEnvironmentUrls", null);
|
|
26513
|
+
state_service_decorate([
|
|
26514
|
+
withPrototypeForArrayMembers(EventData),
|
|
26515
|
+
state_service_metadata("design:type", Function),
|
|
26516
|
+
state_service_metadata("design:paramtypes", [Object]),
|
|
26517
|
+
state_service_metadata("design:returntype", Promise)
|
|
26518
|
+
], StateService.prototype, "getEventCollection", null);
|
|
26519
|
+
state_service_decorate([
|
|
26520
|
+
withPrototype(SymmetricCryptoKey, SymmetricCryptoKey.initFromJson),
|
|
26521
|
+
state_service_metadata("design:type", Function),
|
|
26522
|
+
state_service_metadata("design:paramtypes", [Object]),
|
|
26523
|
+
state_service_metadata("design:returntype", Promise)
|
|
26524
|
+
], StateService.prototype, "getLegacyEtmKey", null);
|
|
26525
|
+
state_service_decorate([
|
|
26526
|
+
withPrototypeForObjectValues(ProviderData),
|
|
26527
|
+
state_service_metadata("design:type", Function),
|
|
26528
|
+
state_service_metadata("design:paramtypes", [Object]),
|
|
26529
|
+
state_service_metadata("design:returntype", Promise)
|
|
26530
|
+
], StateService.prototype, "getProviders", null);
|
|
26531
|
+
function withPrototype(constructor, converter = (i) => i) {
|
|
26532
|
+
return (target, propertyKey, descriptor) => {
|
|
26533
|
+
const originalMethod = descriptor.value;
|
|
26534
|
+
return {
|
|
26535
|
+
value: function (...args) {
|
|
26536
|
+
const originalResult = originalMethod.apply(this, args);
|
|
26537
|
+
if (!(originalResult instanceof Promise)) {
|
|
26538
|
+
throw new Error(`Error applying prototype to stored value -- result is not a promise for method ${String(propertyKey)}`);
|
|
26539
|
+
}
|
|
26540
|
+
return originalResult.then((result) => {
|
|
26541
|
+
return result == null ||
|
|
26542
|
+
result.constructor.name === constructor.prototype.constructor.name
|
|
26543
|
+
? converter(result)
|
|
26544
|
+
: converter(Object.create(constructor.prototype, Object.getOwnPropertyDescriptors(result)));
|
|
26545
|
+
});
|
|
26546
|
+
},
|
|
26547
|
+
};
|
|
26548
|
+
};
|
|
26549
|
+
}
|
|
26550
|
+
function withPrototypeForArrayMembers(memberConstructor, memberConverter = (i) => i) {
|
|
26551
|
+
return (target, propertyKey, descriptor) => {
|
|
26552
|
+
const originalMethod = descriptor.value;
|
|
26553
|
+
return {
|
|
26554
|
+
value: function (...args) {
|
|
26555
|
+
const originalResult = originalMethod.apply(this, args);
|
|
26556
|
+
if (!(originalResult instanceof Promise)) {
|
|
26557
|
+
throw new Error(`Error applying prototype to stored value -- result is not a promise for method ${String(propertyKey)}`);
|
|
26558
|
+
}
|
|
26559
|
+
return originalResult.then((result) => {
|
|
26560
|
+
if (result == null) {
|
|
26561
|
+
return null;
|
|
26562
|
+
}
|
|
26563
|
+
else if (!(result instanceof Array)) {
|
|
26564
|
+
throw new Error(`Attempted to retrieve non array type from state as an array for method ${String(propertyKey)}`);
|
|
26565
|
+
}
|
|
26566
|
+
else {
|
|
26567
|
+
return result.map((r) => {
|
|
26568
|
+
return r == null ||
|
|
26569
|
+
r.constructor.name === memberConstructor.prototype.constructor.name
|
|
26570
|
+
? memberConverter(r)
|
|
26571
|
+
: memberConverter(Object.create(memberConstructor.prototype, Object.getOwnPropertyDescriptors(r)));
|
|
26572
|
+
});
|
|
26573
|
+
}
|
|
26574
|
+
});
|
|
26575
|
+
},
|
|
26576
|
+
};
|
|
26577
|
+
};
|
|
26578
|
+
}
|
|
26579
|
+
function withPrototypeForObjectValues(valuesConstructor, valuesConverter = (i) => i) {
|
|
26580
|
+
return (target, propertyKey, descriptor) => {
|
|
26581
|
+
const originalMethod = descriptor.value;
|
|
26582
|
+
return {
|
|
26583
|
+
value: function (...args) {
|
|
26584
|
+
const originalResult = originalMethod.apply(this, args);
|
|
26585
|
+
if (!(originalResult instanceof Promise)) {
|
|
26586
|
+
throw new Error(`Error applying prototype to stored value -- result is not a promise for method ${String(propertyKey)}`);
|
|
26587
|
+
}
|
|
26588
|
+
return originalResult.then((result) => {
|
|
26589
|
+
if (result == null) {
|
|
26590
|
+
return null;
|
|
26591
|
+
}
|
|
26592
|
+
else {
|
|
26593
|
+
for (const [key, val] of Object.entries(result)) {
|
|
26594
|
+
result[key] =
|
|
26595
|
+
val == null || val.constructor.name === valuesConstructor.prototype.constructor.name
|
|
26596
|
+
? valuesConverter(val)
|
|
26597
|
+
: valuesConverter(Object.create(valuesConstructor.prototype, Object.getOwnPropertyDescriptors(val)));
|
|
26598
|
+
}
|
|
26599
|
+
return result;
|
|
26600
|
+
}
|
|
26601
|
+
});
|
|
26602
|
+
},
|
|
26603
|
+
};
|
|
26604
|
+
};
|
|
26605
|
+
}
|
|
26606
|
+
function withPrototypeForMap(valuesConstructor, valuesConverter = (i) => i) {
|
|
26607
|
+
return (target, propertyKey, descriptor) => {
|
|
26608
|
+
const originalMethod = descriptor.value;
|
|
26609
|
+
return {
|
|
26610
|
+
value: function (...args) {
|
|
26611
|
+
const originalResult = originalMethod.apply(this, args);
|
|
26612
|
+
if (!(originalResult instanceof Promise)) {
|
|
26613
|
+
throw new Error(`Error applying prototype to stored value -- result is not a promise for method ${String(propertyKey)}`);
|
|
26614
|
+
}
|
|
26615
|
+
return originalResult.then((result) => {
|
|
26616
|
+
if (result == null) {
|
|
26617
|
+
return null;
|
|
26618
|
+
}
|
|
26619
|
+
else if (result instanceof Map) {
|
|
26620
|
+
return result;
|
|
26621
|
+
}
|
|
26622
|
+
else {
|
|
26623
|
+
for (const key in Object.keys(result)) {
|
|
26624
|
+
result[key] =
|
|
26625
|
+
result[key] == null ||
|
|
26626
|
+
result[key].constructor.name === valuesConstructor.prototype.constructor.name
|
|
26627
|
+
? valuesConverter(result[key])
|
|
26628
|
+
: valuesConverter(Object.create(valuesConstructor.prototype, Object.getOwnPropertyDescriptors(result[key])));
|
|
26629
|
+
}
|
|
26630
|
+
return new Map(Object.entries(result));
|
|
26631
|
+
}
|
|
26632
|
+
});
|
|
26633
|
+
},
|
|
26634
|
+
};
|
|
26635
|
+
};
|
|
25966
26636
|
}
|
|
25967
26637
|
|
|
25968
26638
|
;// CONCATENATED MODULE: ../../libs/common/src/services/token.service.ts
|
|
@@ -26305,6 +26975,15 @@ class StateMigrationService {
|
|
|
26305
26975
|
case StateVersion.Three:
|
|
26306
26976
|
yield this.migrateStateFrom3To4();
|
|
26307
26977
|
break;
|
|
26978
|
+
case StateVersion.Four: {
|
|
26979
|
+
const authenticatedAccounts = yield this.getAuthenticatedAccounts();
|
|
26980
|
+
for (const account of authenticatedAccounts) {
|
|
26981
|
+
const migratedAccount = yield this.migrateAccountFrom4To5(account);
|
|
26982
|
+
yield this.set(account.profile.userId, migratedAccount);
|
|
26983
|
+
}
|
|
26984
|
+
yield this.setCurrentStateVersion(StateVersion.Five);
|
|
26985
|
+
break;
|
|
26986
|
+
}
|
|
26308
26987
|
}
|
|
26309
26988
|
currentStateVersion += 1;
|
|
26310
26989
|
}
|
|
@@ -26559,6 +27238,21 @@ class StateMigrationService {
|
|
|
26559
27238
|
yield this.set(stateMigration_service_keys.global, globals);
|
|
26560
27239
|
});
|
|
26561
27240
|
}
|
|
27241
|
+
migrateAccountFrom4To5(account) {
|
|
27242
|
+
var _a, _b;
|
|
27243
|
+
return stateMigration_service_awaiter(this, void 0, void 0, function* () {
|
|
27244
|
+
const encryptedOrgKeys = (_b = (_a = account.keys) === null || _a === void 0 ? void 0 : _a.organizationKeys) === null || _b === void 0 ? void 0 : _b.encrypted;
|
|
27245
|
+
if (encryptedOrgKeys != null) {
|
|
27246
|
+
for (const [orgId, encKey] of Object.entries(encryptedOrgKeys)) {
|
|
27247
|
+
encryptedOrgKeys[orgId] = {
|
|
27248
|
+
type: "organization",
|
|
27249
|
+
key: encKey, // Account v4 does not reflect the current account model so we have to cast
|
|
27250
|
+
};
|
|
27251
|
+
}
|
|
27252
|
+
}
|
|
27253
|
+
return account;
|
|
27254
|
+
});
|
|
27255
|
+
}
|
|
26562
27256
|
get options() {
|
|
26563
27257
|
return { htmlStorageLocation: HtmlStorageLocation.Local };
|
|
26564
27258
|
}
|
|
@@ -26582,6 +27276,19 @@ class StateMigrationService {
|
|
|
26582
27276
|
return (_b = (_a = (yield this.getGlobals())) === null || _a === void 0 ? void 0 : _a.stateVersion) !== null && _b !== void 0 ? _b : StateVersion.One;
|
|
26583
27277
|
});
|
|
26584
27278
|
}
|
|
27279
|
+
setCurrentStateVersion(newVersion) {
|
|
27280
|
+
return stateMigration_service_awaiter(this, void 0, void 0, function* () {
|
|
27281
|
+
const globals = yield this.getGlobals();
|
|
27282
|
+
globals.stateVersion = newVersion;
|
|
27283
|
+
yield this.set(stateMigration_service_keys.global, globals);
|
|
27284
|
+
});
|
|
27285
|
+
}
|
|
27286
|
+
getAuthenticatedAccounts() {
|
|
27287
|
+
return stateMigration_service_awaiter(this, void 0, void 0, function* () {
|
|
27288
|
+
const authenticatedUserIds = yield this.get(stateMigration_service_keys.authenticatedAccounts);
|
|
27289
|
+
return Promise.all(authenticatedUserIds.map((id) => this.get(id)));
|
|
27290
|
+
});
|
|
27291
|
+
}
|
|
26585
27292
|
}
|
|
26586
27293
|
|
|
26587
27294
|
;// CONCATENATED MODULE: ../../libs/common/src/models/data/organizationData.ts
|
|
@@ -26601,6 +27308,7 @@ class OrganizationData {
|
|
|
26601
27308
|
this.useApi = response.useApi;
|
|
26602
27309
|
this.useSso = response.useSso;
|
|
26603
27310
|
this.useKeyConnector = response.useKeyConnector;
|
|
27311
|
+
this.useScim = response.useScim;
|
|
26604
27312
|
this.useResetPassword = response.useResetPassword;
|
|
26605
27313
|
this.selfHost = response.selfHost;
|
|
26606
27314
|
this.usersGetPremium = response.usersGetPremium;
|
|
@@ -26626,19 +27334,6 @@ class OrganizationData {
|
|
|
26626
27334
|
}
|
|
26627
27335
|
}
|
|
26628
27336
|
|
|
26629
|
-
;// CONCATENATED MODULE: ../../libs/common/src/models/data/providerData.ts
|
|
26630
|
-
class ProviderData {
|
|
26631
|
-
constructor(response) {
|
|
26632
|
-
this.id = response.id;
|
|
26633
|
-
this.name = response.name;
|
|
26634
|
-
this.status = response.status;
|
|
26635
|
-
this.type = response.type;
|
|
26636
|
-
this.enabled = response.enabled;
|
|
26637
|
-
this.userId = response.userId;
|
|
26638
|
-
this.useEvents = response.useEvents;
|
|
26639
|
-
}
|
|
26640
|
-
}
|
|
26641
|
-
|
|
26642
27337
|
;// CONCATENATED MODULE: ../../libs/common/src/services/sync.service.ts
|
|
26643
27338
|
var sync_service_decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
26644
27339
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -26667,7 +27362,7 @@ var sync_service_awaiter = (undefined && undefined.__awaiter) || function (thisA
|
|
|
26667
27362
|
|
|
26668
27363
|
|
|
26669
27364
|
class SyncService {
|
|
26670
|
-
constructor(apiService, settingsService, folderService, cipherService, cryptoService, collectionService, messagingService, policyService, sendService, logService, keyConnectorService, stateService, organizationService, providerService, logoutCallback) {
|
|
27365
|
+
constructor(apiService, settingsService, folderService, cipherService, cryptoService, collectionService, messagingService, policyService, sendService, logService, keyConnectorService, stateService, organizationService, providerService, folderApiService, logoutCallback) {
|
|
26671
27366
|
this.apiService = apiService;
|
|
26672
27367
|
this.settingsService = settingsService;
|
|
26673
27368
|
this.folderService = folderService;
|
|
@@ -26682,6 +27377,7 @@ class SyncService {
|
|
|
26682
27377
|
this.stateService = stateService;
|
|
26683
27378
|
this.organizationService = organizationService;
|
|
26684
27379
|
this.providerService = providerService;
|
|
27380
|
+
this.folderApiService = folderApiService;
|
|
26685
27381
|
this.logoutCallback = logoutCallback;
|
|
26686
27382
|
this.syncInProgress = false;
|
|
26687
27383
|
}
|
|
@@ -26754,7 +27450,7 @@ class SyncService {
|
|
|
26754
27450
|
const localFolder = yield this.folderService.get(notification.id);
|
|
26755
27451
|
if ((!isEdit && localFolder == null) ||
|
|
26756
27452
|
(isEdit && localFolder != null && localFolder.revisionDate < notification.revisionDate)) {
|
|
26757
|
-
const remoteFolder = yield this.
|
|
27453
|
+
const remoteFolder = yield this.folderApiService.get(notification.id);
|
|
26758
27454
|
if (remoteFolder != null) {
|
|
26759
27455
|
yield this.folderService.upsert(new FolderData(remoteFolder));
|
|
26760
27456
|
this.messagingService.send("syncedUpsertedFolder", { folderId: notification.id });
|
|
@@ -26823,7 +27519,7 @@ class SyncService {
|
|
|
26823
27519
|
}
|
|
26824
27520
|
}
|
|
26825
27521
|
if (shouldUpdate) {
|
|
26826
|
-
const remoteCipher = yield this.apiService.
|
|
27522
|
+
const remoteCipher = yield this.apiService.getFullCipherDetails(notification.id);
|
|
26827
27523
|
if (remoteCipher != null) {
|
|
26828
27524
|
yield this.cipherService.upsert(new CipherData(remoteCipher));
|
|
26829
27525
|
this.messagingService.send("syncedUpsertedCipher", { cipherId: notification.id });
|
|
@@ -27043,10 +27739,9 @@ var totp_service_awaiter = (undefined && undefined.__awaiter) || function (thisA
|
|
|
27043
27739
|
const B32Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
|
|
27044
27740
|
const SteamChars = "23456789BCDFGHJKMNPQRTVWXY";
|
|
27045
27741
|
class TotpService {
|
|
27046
|
-
constructor(cryptoFunctionService, logService
|
|
27742
|
+
constructor(cryptoFunctionService, logService) {
|
|
27047
27743
|
this.cryptoFunctionService = cryptoFunctionService;
|
|
27048
27744
|
this.logService = logService;
|
|
27049
|
-
this.stateService = stateService;
|
|
27050
27745
|
}
|
|
27051
27746
|
getCode(key) {
|
|
27052
27747
|
return totp_service_awaiter(this, void 0, void 0, function* () {
|
|
@@ -27146,11 +27841,6 @@ class TotpService {
|
|
|
27146
27841
|
}
|
|
27147
27842
|
return period;
|
|
27148
27843
|
}
|
|
27149
|
-
isAutoCopyEnabled() {
|
|
27150
|
-
return totp_service_awaiter(this, void 0, void 0, function* () {
|
|
27151
|
-
return !(yield this.stateService.getDisableAutoTotpCopy());
|
|
27152
|
-
});
|
|
27153
|
-
}
|
|
27154
27844
|
// Helpers
|
|
27155
27845
|
leftPad(s, l, p) {
|
|
27156
27846
|
if (l + 1 >= s.length) {
|
|
@@ -27516,6 +28206,7 @@ class VaultTimeoutService {
|
|
|
27516
28206
|
}
|
|
27517
28207
|
if (userId == null || userId === (yield this.stateService.getUserId())) {
|
|
27518
28208
|
this.searchService.clearIndex();
|
|
28209
|
+
yield this.folderService.clearCache();
|
|
27519
28210
|
}
|
|
27520
28211
|
yield this.stateService.setEverBeenUnlocked(true, { userId: userId });
|
|
27521
28212
|
yield this.stateService.setBiometricLocked(true, { userId: userId });
|
|
@@ -27524,7 +28215,6 @@ class VaultTimeoutService {
|
|
|
27524
28215
|
yield this.cryptoService.clearOrgKeys(true, userId);
|
|
27525
28216
|
yield this.cryptoService.clearKeyPair(true, userId);
|
|
27526
28217
|
yield this.cryptoService.clearEncKey(true, userId);
|
|
27527
|
-
yield this.folderService.clearCache(userId);
|
|
27528
28218
|
yield this.cipherService.clearCache(userId);
|
|
27529
28219
|
yield this.collectionService.clearCache(userId);
|
|
27530
28220
|
this.messagingService.send("locked", { userId: userId });
|
|
@@ -27659,7 +28349,6 @@ var DeviceType;
|
|
|
27659
28349
|
;// CONCATENATED MODULE: ../../libs/node/src/cli/services/cliPlatformUtils.service.ts
|
|
27660
28350
|
|
|
27661
28351
|
|
|
27662
|
-
|
|
27663
28352
|
// eslint-disable-next-line
|
|
27664
28353
|
const cliPlatformUtils_service_open = __webpack_require__(634);
|
|
27665
28354
|
class CliPlatformUtilsService {
|
|
@@ -27724,9 +28413,6 @@ class CliPlatformUtilsService {
|
|
|
27724
28413
|
cliPlatformUtils_service_open(uri);
|
|
27725
28414
|
}
|
|
27726
28415
|
}
|
|
27727
|
-
saveFile(win, blobData, blobOptions, fileName) {
|
|
27728
|
-
throw new Error("Not implemented.");
|
|
27729
|
-
}
|
|
27730
28416
|
getApplicationVersion() {
|
|
27731
28417
|
return Promise.resolve(this.packageJson.version);
|
|
27732
28418
|
}
|
|
@@ -27763,15 +28449,6 @@ class CliPlatformUtilsService {
|
|
|
27763
28449
|
authenticateBiometric() {
|
|
27764
28450
|
return Promise.resolve(false);
|
|
27765
28451
|
}
|
|
27766
|
-
getDefaultSystemTheme() {
|
|
27767
|
-
return Promise.resolve(ThemeType.Light);
|
|
27768
|
-
}
|
|
27769
|
-
onDefaultSystemThemeChange() {
|
|
27770
|
-
/* noop */
|
|
27771
|
-
}
|
|
27772
|
-
getEffectiveTheme() {
|
|
27773
|
-
return Promise.resolve(ThemeType.Light);
|
|
27774
|
-
}
|
|
27775
28452
|
supportsSecureStorage() {
|
|
27776
28453
|
return false;
|
|
27777
28454
|
}
|
|
@@ -27803,117 +28480,6 @@ const external_https_proxy_agent_namespaceObject = require("https-proxy-agent");
|
|
|
27803
28480
|
;// CONCATENATED MODULE: external "node-fetch"
|
|
27804
28481
|
const external_node_fetch_namespaceObject = require("node-fetch");
|
|
27805
28482
|
var external_node_fetch_default = /*#__PURE__*/__webpack_require__.n(external_node_fetch_namespaceObject);
|
|
27806
|
-
;// CONCATENATED MODULE: ../../libs/common/src/models/response/billingResponse.ts
|
|
27807
|
-
|
|
27808
|
-
class BillingResponse extends BaseResponse {
|
|
27809
|
-
constructor(response) {
|
|
27810
|
-
super(response);
|
|
27811
|
-
this.invoices = [];
|
|
27812
|
-
this.transactions = [];
|
|
27813
|
-
this.balance = this.getResponseProperty("Balance");
|
|
27814
|
-
const paymentSource = this.getResponseProperty("PaymentSource");
|
|
27815
|
-
const transactions = this.getResponseProperty("Transactions");
|
|
27816
|
-
const invoices = this.getResponseProperty("Invoices");
|
|
27817
|
-
this.paymentSource = paymentSource == null ? null : new BillingSourceResponse(paymentSource);
|
|
27818
|
-
if (transactions != null) {
|
|
27819
|
-
this.transactions = transactions.map((t) => new BillingTransactionResponse(t));
|
|
27820
|
-
}
|
|
27821
|
-
if (invoices != null) {
|
|
27822
|
-
this.invoices = invoices.map((i) => new BillingInvoiceResponse(i));
|
|
27823
|
-
}
|
|
27824
|
-
}
|
|
27825
|
-
}
|
|
27826
|
-
class BillingSourceResponse extends BaseResponse {
|
|
27827
|
-
constructor(response) {
|
|
27828
|
-
super(response);
|
|
27829
|
-
this.type = this.getResponseProperty("Type");
|
|
27830
|
-
this.cardBrand = this.getResponseProperty("CardBrand");
|
|
27831
|
-
this.description = this.getResponseProperty("Description");
|
|
27832
|
-
this.needsVerification = this.getResponseProperty("NeedsVerification");
|
|
27833
|
-
}
|
|
27834
|
-
}
|
|
27835
|
-
class BillingInvoiceResponse extends BaseResponse {
|
|
27836
|
-
constructor(response) {
|
|
27837
|
-
super(response);
|
|
27838
|
-
this.url = this.getResponseProperty("Url");
|
|
27839
|
-
this.pdfUrl = this.getResponseProperty("PdfUrl");
|
|
27840
|
-
this.number = this.getResponseProperty("Number");
|
|
27841
|
-
this.paid = this.getResponseProperty("Paid");
|
|
27842
|
-
this.date = this.getResponseProperty("Date");
|
|
27843
|
-
this.amount = this.getResponseProperty("Amount");
|
|
27844
|
-
}
|
|
27845
|
-
}
|
|
27846
|
-
class BillingTransactionResponse extends BaseResponse {
|
|
27847
|
-
constructor(response) {
|
|
27848
|
-
super(response);
|
|
27849
|
-
this.createdDate = this.getResponseProperty("CreatedDate");
|
|
27850
|
-
this.amount = this.getResponseProperty("Amount");
|
|
27851
|
-
this.refunded = this.getResponseProperty("Refunded");
|
|
27852
|
-
this.partiallyRefunded = this.getResponseProperty("PartiallyRefunded");
|
|
27853
|
-
this.refundedAmount = this.getResponseProperty("RefundedAmount");
|
|
27854
|
-
this.type = this.getResponseProperty("Type");
|
|
27855
|
-
this.paymentMethodType = this.getResponseProperty("PaymentMethodType");
|
|
27856
|
-
this.details = this.getResponseProperty("Details");
|
|
27857
|
-
}
|
|
27858
|
-
}
|
|
27859
|
-
|
|
27860
|
-
;// CONCATENATED MODULE: ../../libs/common/src/models/response/billingHistoryResponse.ts
|
|
27861
|
-
|
|
27862
|
-
|
|
27863
|
-
class BillingHistoryResponse extends BaseResponse {
|
|
27864
|
-
constructor(response) {
|
|
27865
|
-
super(response);
|
|
27866
|
-
this.invoices = [];
|
|
27867
|
-
this.transactions = [];
|
|
27868
|
-
const transactions = this.getResponseProperty("Transactions");
|
|
27869
|
-
const invoices = this.getResponseProperty("Invoices");
|
|
27870
|
-
if (transactions != null) {
|
|
27871
|
-
this.transactions = transactions.map((t) => new BillingTransactionResponse(t));
|
|
27872
|
-
}
|
|
27873
|
-
if (invoices != null) {
|
|
27874
|
-
this.invoices = invoices.map((i) => new BillingInvoiceResponse(i));
|
|
27875
|
-
}
|
|
27876
|
-
}
|
|
27877
|
-
get hasNoHistory() {
|
|
27878
|
-
return this.invoices.length == 0 && this.transactions.length == 0;
|
|
27879
|
-
}
|
|
27880
|
-
}
|
|
27881
|
-
|
|
27882
|
-
;// CONCATENATED MODULE: ../../libs/common/src/models/response/billingPaymentResponse.ts
|
|
27883
|
-
|
|
27884
|
-
|
|
27885
|
-
class BillingPaymentResponse extends BaseResponse {
|
|
27886
|
-
constructor(response) {
|
|
27887
|
-
super(response);
|
|
27888
|
-
this.balance = this.getResponseProperty("Balance");
|
|
27889
|
-
const paymentSource = this.getResponseProperty("PaymentSource");
|
|
27890
|
-
this.paymentSource = paymentSource == null ? null : new BillingSourceResponse(paymentSource);
|
|
27891
|
-
}
|
|
27892
|
-
}
|
|
27893
|
-
|
|
27894
|
-
;// CONCATENATED MODULE: ../../libs/common/src/models/response/organizationConnectionResponse.ts
|
|
27895
|
-
|
|
27896
|
-
class OrganizationConnectionResponse extends BaseResponse {
|
|
27897
|
-
constructor(response, configType) {
|
|
27898
|
-
super(response);
|
|
27899
|
-
this.id = this.getResponseProperty("Id");
|
|
27900
|
-
this.type = this.getResponseProperty("Type");
|
|
27901
|
-
this.organizationId = this.getResponseProperty("OrganizationId");
|
|
27902
|
-
this.enabled = this.getResponseProperty("Enabled");
|
|
27903
|
-
const rawConfig = this.getResponseProperty("Config");
|
|
27904
|
-
this.config = rawConfig == null ? null : new configType(rawConfig);
|
|
27905
|
-
}
|
|
27906
|
-
}
|
|
27907
|
-
|
|
27908
|
-
;// CONCATENATED MODULE: ../../libs/common/src/models/response/ssoPreValidateResponse.ts
|
|
27909
|
-
|
|
27910
|
-
class SsoPreValidateResponse extends BaseResponse {
|
|
27911
|
-
constructor(response) {
|
|
27912
|
-
super(response);
|
|
27913
|
-
this.token = this.getResponseProperty("Token");
|
|
27914
|
-
}
|
|
27915
|
-
}
|
|
27916
|
-
|
|
27917
28483
|
;// CONCATENATED MODULE: ../../libs/common/src/models/response/apiKeyResponse.ts
|
|
27918
28484
|
|
|
27919
28485
|
class ApiKeyResponse extends BaseResponse {
|
|
@@ -28029,6 +28595,94 @@ class AttachmentUploadDataResponse extends BaseResponse {
|
|
|
28029
28595
|
}
|
|
28030
28596
|
}
|
|
28031
28597
|
|
|
28598
|
+
;// CONCATENATED MODULE: ../../libs/common/src/models/response/billingResponse.ts
|
|
28599
|
+
|
|
28600
|
+
class BillingResponse extends BaseResponse {
|
|
28601
|
+
constructor(response) {
|
|
28602
|
+
super(response);
|
|
28603
|
+
this.invoices = [];
|
|
28604
|
+
this.transactions = [];
|
|
28605
|
+
this.balance = this.getResponseProperty("Balance");
|
|
28606
|
+
const paymentSource = this.getResponseProperty("PaymentSource");
|
|
28607
|
+
const transactions = this.getResponseProperty("Transactions");
|
|
28608
|
+
const invoices = this.getResponseProperty("Invoices");
|
|
28609
|
+
this.paymentSource = paymentSource == null ? null : new BillingSourceResponse(paymentSource);
|
|
28610
|
+
if (transactions != null) {
|
|
28611
|
+
this.transactions = transactions.map((t) => new BillingTransactionResponse(t));
|
|
28612
|
+
}
|
|
28613
|
+
if (invoices != null) {
|
|
28614
|
+
this.invoices = invoices.map((i) => new BillingInvoiceResponse(i));
|
|
28615
|
+
}
|
|
28616
|
+
}
|
|
28617
|
+
}
|
|
28618
|
+
class BillingSourceResponse extends BaseResponse {
|
|
28619
|
+
constructor(response) {
|
|
28620
|
+
super(response);
|
|
28621
|
+
this.type = this.getResponseProperty("Type");
|
|
28622
|
+
this.cardBrand = this.getResponseProperty("CardBrand");
|
|
28623
|
+
this.description = this.getResponseProperty("Description");
|
|
28624
|
+
this.needsVerification = this.getResponseProperty("NeedsVerification");
|
|
28625
|
+
}
|
|
28626
|
+
}
|
|
28627
|
+
class BillingInvoiceResponse extends BaseResponse {
|
|
28628
|
+
constructor(response) {
|
|
28629
|
+
super(response);
|
|
28630
|
+
this.url = this.getResponseProperty("Url");
|
|
28631
|
+
this.pdfUrl = this.getResponseProperty("PdfUrl");
|
|
28632
|
+
this.number = this.getResponseProperty("Number");
|
|
28633
|
+
this.paid = this.getResponseProperty("Paid");
|
|
28634
|
+
this.date = this.getResponseProperty("Date");
|
|
28635
|
+
this.amount = this.getResponseProperty("Amount");
|
|
28636
|
+
}
|
|
28637
|
+
}
|
|
28638
|
+
class BillingTransactionResponse extends BaseResponse {
|
|
28639
|
+
constructor(response) {
|
|
28640
|
+
super(response);
|
|
28641
|
+
this.createdDate = this.getResponseProperty("CreatedDate");
|
|
28642
|
+
this.amount = this.getResponseProperty("Amount");
|
|
28643
|
+
this.refunded = this.getResponseProperty("Refunded");
|
|
28644
|
+
this.partiallyRefunded = this.getResponseProperty("PartiallyRefunded");
|
|
28645
|
+
this.refundedAmount = this.getResponseProperty("RefundedAmount");
|
|
28646
|
+
this.type = this.getResponseProperty("Type");
|
|
28647
|
+
this.paymentMethodType = this.getResponseProperty("PaymentMethodType");
|
|
28648
|
+
this.details = this.getResponseProperty("Details");
|
|
28649
|
+
}
|
|
28650
|
+
}
|
|
28651
|
+
|
|
28652
|
+
;// CONCATENATED MODULE: ../../libs/common/src/models/response/billingHistoryResponse.ts
|
|
28653
|
+
|
|
28654
|
+
|
|
28655
|
+
class BillingHistoryResponse extends BaseResponse {
|
|
28656
|
+
constructor(response) {
|
|
28657
|
+
super(response);
|
|
28658
|
+
this.invoices = [];
|
|
28659
|
+
this.transactions = [];
|
|
28660
|
+
const transactions = this.getResponseProperty("Transactions");
|
|
28661
|
+
const invoices = this.getResponseProperty("Invoices");
|
|
28662
|
+
if (transactions != null) {
|
|
28663
|
+
this.transactions = transactions.map((t) => new BillingTransactionResponse(t));
|
|
28664
|
+
}
|
|
28665
|
+
if (invoices != null) {
|
|
28666
|
+
this.invoices = invoices.map((i) => new BillingInvoiceResponse(i));
|
|
28667
|
+
}
|
|
28668
|
+
}
|
|
28669
|
+
get hasNoHistory() {
|
|
28670
|
+
return this.invoices.length == 0 && this.transactions.length == 0;
|
|
28671
|
+
}
|
|
28672
|
+
}
|
|
28673
|
+
|
|
28674
|
+
;// CONCATENATED MODULE: ../../libs/common/src/models/response/billingPaymentResponse.ts
|
|
28675
|
+
|
|
28676
|
+
|
|
28677
|
+
class BillingPaymentResponse extends BaseResponse {
|
|
28678
|
+
constructor(response) {
|
|
28679
|
+
super(response);
|
|
28680
|
+
this.balance = this.getResponseProperty("Balance");
|
|
28681
|
+
const paymentSource = this.getResponseProperty("PaymentSource");
|
|
28682
|
+
this.paymentSource = paymentSource == null ? null : new BillingSourceResponse(paymentSource);
|
|
28683
|
+
}
|
|
28684
|
+
}
|
|
28685
|
+
|
|
28032
28686
|
;// CONCATENATED MODULE: ../../libs/common/src/models/response/breachAccountResponse.ts
|
|
28033
28687
|
|
|
28034
28688
|
class BreachAccountResponse extends BaseResponse {
|
|
@@ -28201,17 +28855,6 @@ class EventResponse extends BaseResponse {
|
|
|
28201
28855
|
}
|
|
28202
28856
|
}
|
|
28203
28857
|
|
|
28204
|
-
;// CONCATENATED MODULE: ../../libs/common/src/models/response/folderResponse.ts
|
|
28205
|
-
|
|
28206
|
-
class FolderResponse extends BaseResponse {
|
|
28207
|
-
constructor(response) {
|
|
28208
|
-
super(response);
|
|
28209
|
-
this.id = this.getResponseProperty("Id");
|
|
28210
|
-
this.name = this.getResponseProperty("Name");
|
|
28211
|
-
this.revisionDate = this.getResponseProperty("RevisionDate");
|
|
28212
|
-
}
|
|
28213
|
-
}
|
|
28214
|
-
|
|
28215
28858
|
;// CONCATENATED MODULE: ../../libs/common/src/models/response/groupResponse.ts
|
|
28216
28859
|
|
|
28217
28860
|
|
|
@@ -28416,6 +29059,20 @@ class OrganizationAutoEnrollStatusResponse extends BaseResponse {
|
|
|
28416
29059
|
}
|
|
28417
29060
|
}
|
|
28418
29061
|
|
|
29062
|
+
;// CONCATENATED MODULE: ../../libs/common/src/models/response/organizationConnectionResponse.ts
|
|
29063
|
+
|
|
29064
|
+
class OrganizationConnectionResponse extends BaseResponse {
|
|
29065
|
+
constructor(response, configType) {
|
|
29066
|
+
super(response);
|
|
29067
|
+
this.id = this.getResponseProperty("Id");
|
|
29068
|
+
this.type = this.getResponseProperty("Type");
|
|
29069
|
+
this.organizationId = this.getResponseProperty("OrganizationId");
|
|
29070
|
+
this.enabled = this.getResponseProperty("Enabled");
|
|
29071
|
+
const rawConfig = this.getResponseProperty("Config");
|
|
29072
|
+
this.config = rawConfig == null ? null : new configType(rawConfig);
|
|
29073
|
+
}
|
|
29074
|
+
}
|
|
29075
|
+
|
|
28419
29076
|
;// CONCATENATED MODULE: ../../libs/common/src/models/response/keysResponse.ts
|
|
28420
29077
|
|
|
28421
29078
|
class KeysResponse extends BaseResponse {
|
|
@@ -28649,6 +29306,7 @@ class PermissionsApi extends BaseResponse {
|
|
|
28649
29306
|
this.managePolicies = this.getResponseProperty("ManagePolicies");
|
|
28650
29307
|
this.manageUsers = this.getResponseProperty("ManageUsers");
|
|
28651
29308
|
this.manageResetPassword = this.getResponseProperty("ManageResetPassword");
|
|
29309
|
+
this.manageScim = this.getResponseProperty("ManageScim");
|
|
28652
29310
|
}
|
|
28653
29311
|
}
|
|
28654
29312
|
|
|
@@ -28703,7 +29361,7 @@ class OrganizationUserResetPasswordDetailsReponse extends BaseResponse {
|
|
|
28703
29361
|
|
|
28704
29362
|
class ProfileOrganizationResponse extends BaseResponse {
|
|
28705
29363
|
constructor(response) {
|
|
28706
|
-
var _a, _b;
|
|
29364
|
+
var _a, _b, _c;
|
|
28707
29365
|
super(response);
|
|
28708
29366
|
this.id = this.getResponseProperty("Id");
|
|
28709
29367
|
this.name = this.getResponseProperty("Name");
|
|
@@ -28716,6 +29374,7 @@ class ProfileOrganizationResponse extends BaseResponse {
|
|
|
28716
29374
|
this.useApi = this.getResponseProperty("UseApi");
|
|
28717
29375
|
this.useSso = this.getResponseProperty("UseSso");
|
|
28718
29376
|
this.useKeyConnector = (_a = this.getResponseProperty("UseKeyConnector")) !== null && _a !== void 0 ? _a : false;
|
|
29377
|
+
this.useScim = (_b = this.getResponseProperty("UseScim")) !== null && _b !== void 0 ? _b : false;
|
|
28719
29378
|
this.useResetPassword = this.getResponseProperty("UseResetPassword");
|
|
28720
29379
|
this.selfHost = this.getResponseProperty("SelfHost");
|
|
28721
29380
|
this.usersGetPremium = this.getResponseProperty("UsersGetPremium");
|
|
@@ -28737,7 +29396,7 @@ class ProfileOrganizationResponse extends BaseResponse {
|
|
|
28737
29396
|
this.familySponsorshipFriendlyName = this.getResponseProperty("FamilySponsorshipFriendlyName");
|
|
28738
29397
|
this.familySponsorshipAvailable = this.getResponseProperty("FamilySponsorshipAvailable");
|
|
28739
29398
|
this.planProductType = this.getResponseProperty("PlanProductType");
|
|
28740
|
-
this.keyConnectorEnabled = (
|
|
29399
|
+
this.keyConnectorEnabled = (_c = this.getResponseProperty("KeyConnectorEnabled")) !== null && _c !== void 0 ? _c : false;
|
|
28741
29400
|
this.keyConnectorUrl = this.getResponseProperty("KeyConnectorUrl");
|
|
28742
29401
|
const familySponsorshipLastSyncDateString = this.getResponseProperty("FamilySponsorshipLastSyncDate");
|
|
28743
29402
|
if (familySponsorshipLastSyncDateString) {
|
|
@@ -29007,6 +29666,15 @@ class SendFileUploadDataResponse extends BaseResponse {
|
|
|
29007
29666
|
}
|
|
29008
29667
|
}
|
|
29009
29668
|
|
|
29669
|
+
;// CONCATENATED MODULE: ../../libs/common/src/models/response/ssoPreValidateResponse.ts
|
|
29670
|
+
|
|
29671
|
+
class SsoPreValidateResponse extends BaseResponse {
|
|
29672
|
+
constructor(response) {
|
|
29673
|
+
super(response);
|
|
29674
|
+
this.token = this.getResponseProperty("Token");
|
|
29675
|
+
}
|
|
29676
|
+
}
|
|
29677
|
+
|
|
29010
29678
|
;// CONCATENATED MODULE: ../../libs/common/src/models/response/syncResponse.ts
|
|
29011
29679
|
|
|
29012
29680
|
|
|
@@ -29271,7 +29939,6 @@ var api_service_awaiter = (undefined && undefined.__awaiter) || function (thisAr
|
|
|
29271
29939
|
|
|
29272
29940
|
|
|
29273
29941
|
|
|
29274
|
-
|
|
29275
29942
|
|
|
29276
29943
|
|
|
29277
29944
|
class ApiService {
|
|
@@ -29526,28 +30193,6 @@ class ApiService {
|
|
|
29526
30193
|
return new BillingPaymentResponse(r);
|
|
29527
30194
|
});
|
|
29528
30195
|
}
|
|
29529
|
-
// Folder APIs
|
|
29530
|
-
getFolder(id) {
|
|
29531
|
-
return api_service_awaiter(this, void 0, void 0, function* () {
|
|
29532
|
-
const r = yield this.send("GET", "/folders/" + id, null, true, true);
|
|
29533
|
-
return new FolderResponse(r);
|
|
29534
|
-
});
|
|
29535
|
-
}
|
|
29536
|
-
postFolder(request) {
|
|
29537
|
-
return api_service_awaiter(this, void 0, void 0, function* () {
|
|
29538
|
-
const r = yield this.send("POST", "/folders", request, true, true);
|
|
29539
|
-
return new FolderResponse(r);
|
|
29540
|
-
});
|
|
29541
|
-
}
|
|
29542
|
-
putFolder(id, request) {
|
|
29543
|
-
return api_service_awaiter(this, void 0, void 0, function* () {
|
|
29544
|
-
const r = yield this.send("PUT", "/folders/" + id, request, true, true);
|
|
29545
|
-
return new FolderResponse(r);
|
|
29546
|
-
});
|
|
29547
|
-
}
|
|
29548
|
-
deleteFolder(id) {
|
|
29549
|
-
return this.send("DELETE", "/folders/" + id, null, true, false);
|
|
29550
|
-
}
|
|
29551
30196
|
// Send APIs
|
|
29552
30197
|
getSend(id) {
|
|
29553
30198
|
return api_service_awaiter(this, void 0, void 0, function* () {
|
|
@@ -29632,6 +30277,12 @@ class ApiService {
|
|
|
29632
30277
|
return new CipherResponse(r);
|
|
29633
30278
|
});
|
|
29634
30279
|
}
|
|
30280
|
+
getFullCipherDetails(id) {
|
|
30281
|
+
return api_service_awaiter(this, void 0, void 0, function* () {
|
|
30282
|
+
const r = yield this.send("GET", "/ciphers/" + id + "/details", null, true, true);
|
|
30283
|
+
return new CipherResponse(r);
|
|
30284
|
+
});
|
|
30285
|
+
}
|
|
29635
30286
|
getCipherAdmin(id) {
|
|
29636
30287
|
return api_service_awaiter(this, void 0, void 0, function* () {
|
|
29637
30288
|
const r = yield this.send("GET", "/ciphers/" + id + "/admin", null, true, true);
|
|
@@ -30013,6 +30664,24 @@ class ApiService {
|
|
|
30013
30664
|
return new ListResponse(r, OrganizationUserBulkResponse);
|
|
30014
30665
|
});
|
|
30015
30666
|
}
|
|
30667
|
+
deactivateOrganizationUser(organizationId, id) {
|
|
30668
|
+
return this.send("PUT", "/organizations/" + organizationId + "/users/" + id + "/deactivate", null, true, false);
|
|
30669
|
+
}
|
|
30670
|
+
deactivateManyOrganizationUsers(organizationId, request) {
|
|
30671
|
+
return api_service_awaiter(this, void 0, void 0, function* () {
|
|
30672
|
+
const r = yield this.send("PUT", "/organizations/" + organizationId + "/users/deactivate", request, true, true);
|
|
30673
|
+
return new ListResponse(r, OrganizationUserBulkResponse);
|
|
30674
|
+
});
|
|
30675
|
+
}
|
|
30676
|
+
activateOrganizationUser(organizationId, id) {
|
|
30677
|
+
return this.send("PUT", "/organizations/" + organizationId + "/users/" + id + "/activate", null, true, false);
|
|
30678
|
+
}
|
|
30679
|
+
activateManyOrganizationUsers(organizationId, request) {
|
|
30680
|
+
return api_service_awaiter(this, void 0, void 0, function* () {
|
|
30681
|
+
const r = yield this.send("PUT", "/organizations/" + organizationId + "/users/activate", request, true, true);
|
|
30682
|
+
return new ListResponse(r, OrganizationUserBulkResponse);
|
|
30683
|
+
});
|
|
30684
|
+
}
|
|
30016
30685
|
// Plan APIs
|
|
30017
30686
|
getPlans() {
|
|
30018
30687
|
return api_service_awaiter(this, void 0, void 0, function* () {
|
|
@@ -30376,9 +31045,12 @@ class ApiService {
|
|
|
30376
31045
|
return new ApiKeyResponse(r);
|
|
30377
31046
|
});
|
|
30378
31047
|
}
|
|
30379
|
-
getOrganizationApiKeyInformation(id) {
|
|
31048
|
+
getOrganizationApiKeyInformation(id, type = null) {
|
|
30380
31049
|
return api_service_awaiter(this, void 0, void 0, function* () {
|
|
30381
|
-
const
|
|
31050
|
+
const uri = type === null
|
|
31051
|
+
? "/organizations/" + id + "/api-key-information"
|
|
31052
|
+
: "/organizations/" + id + "/api-key-information/" + type;
|
|
31053
|
+
const r = yield this.send("GET", uri, null, true, true);
|
|
30382
31054
|
return new ListResponse(r, OrganizationApiKeyInformationResponse);
|
|
30383
31055
|
});
|
|
30384
31056
|
}
|
|
@@ -32948,12 +33620,13 @@ var create_command_awaiter = (undefined && undefined.__awaiter) || function (thi
|
|
|
32948
33620
|
|
|
32949
33621
|
|
|
32950
33622
|
class CreateCommand {
|
|
32951
|
-
constructor(cipherService, folderService, stateService, cryptoService, apiService) {
|
|
33623
|
+
constructor(cipherService, folderService, stateService, cryptoService, apiService, folderApiService) {
|
|
32952
33624
|
this.cipherService = cipherService;
|
|
32953
33625
|
this.folderService = folderService;
|
|
32954
33626
|
this.stateService = stateService;
|
|
32955
33627
|
this.cryptoService = cryptoService;
|
|
32956
33628
|
this.apiService = apiService;
|
|
33629
|
+
this.folderApiService = folderApiService;
|
|
32957
33630
|
}
|
|
32958
33631
|
run(object, requestJson, cmdOptions, additionalData = null) {
|
|
32959
33632
|
return create_command_awaiter(this, void 0, void 0, function* () {
|
|
@@ -33064,7 +33737,7 @@ class CreateCommand {
|
|
|
33064
33737
|
return create_command_awaiter(this, void 0, void 0, function* () {
|
|
33065
33738
|
const folder = yield this.folderService.encrypt(FolderExport.toView(req));
|
|
33066
33739
|
try {
|
|
33067
|
-
yield this.
|
|
33740
|
+
yield this.folderApiService.save(folder);
|
|
33068
33741
|
const newFolder = yield this.folderService.get(folder.id);
|
|
33069
33742
|
const decFolder = yield newFolder.decrypt();
|
|
33070
33743
|
const res = new folderResponse_FolderResponse(decFolder);
|
|
@@ -33132,11 +33805,12 @@ var delete_command_awaiter = (undefined && undefined.__awaiter) || function (thi
|
|
|
33132
33805
|
|
|
33133
33806
|
|
|
33134
33807
|
class DeleteCommand {
|
|
33135
|
-
constructor(cipherService, folderService, stateService, apiService) {
|
|
33808
|
+
constructor(cipherService, folderService, stateService, apiService, folderApiService) {
|
|
33136
33809
|
this.cipherService = cipherService;
|
|
33137
33810
|
this.folderService = folderService;
|
|
33138
33811
|
this.stateService = stateService;
|
|
33139
33812
|
this.apiService = apiService;
|
|
33813
|
+
this.folderApiService = folderApiService;
|
|
33140
33814
|
}
|
|
33141
33815
|
run(object, id, cmdOptions) {
|
|
33142
33816
|
return delete_command_awaiter(this, void 0, void 0, function* () {
|
|
@@ -33214,7 +33888,7 @@ class DeleteCommand {
|
|
|
33214
33888
|
return Response.notFound();
|
|
33215
33889
|
}
|
|
33216
33890
|
try {
|
|
33217
|
-
yield this.
|
|
33891
|
+
yield this.folderApiService.delete(id);
|
|
33218
33892
|
return Response.success();
|
|
33219
33893
|
}
|
|
33220
33894
|
catch (e) {
|
|
@@ -33273,11 +33947,12 @@ var edit_command_awaiter = (undefined && undefined.__awaiter) || function (thisA
|
|
|
33273
33947
|
|
|
33274
33948
|
|
|
33275
33949
|
class EditCommand {
|
|
33276
|
-
constructor(cipherService, folderService, cryptoService, apiService) {
|
|
33950
|
+
constructor(cipherService, folderService, cryptoService, apiService, folderApiService) {
|
|
33277
33951
|
this.cipherService = cipherService;
|
|
33278
33952
|
this.folderService = folderService;
|
|
33279
33953
|
this.cryptoService = cryptoService;
|
|
33280
33954
|
this.apiService = apiService;
|
|
33955
|
+
this.folderApiService = folderApiService;
|
|
33281
33956
|
}
|
|
33282
33957
|
run(object, id, requestJson, cmdOptions) {
|
|
33283
33958
|
return edit_command_awaiter(this, void 0, void 0, function* () {
|
|
@@ -33374,7 +34049,7 @@ class EditCommand {
|
|
|
33374
34049
|
folderView = FolderExport.toView(req, folderView);
|
|
33375
34050
|
const encFolder = yield this.folderService.encrypt(folderView);
|
|
33376
34051
|
try {
|
|
33377
|
-
yield this.
|
|
34052
|
+
yield this.folderApiService.save(encFolder);
|
|
33378
34053
|
const updatedFolder = yield this.folderService.get(folder.id);
|
|
33379
34054
|
const decFolder = yield updatedFolder.decrypt();
|
|
33380
34055
|
const res = new folderResponse_FolderResponse(decFolder);
|
|
@@ -33986,7 +34661,7 @@ class GetCommand extends DownloadCommand {
|
|
|
33986
34661
|
}
|
|
33987
34662
|
}
|
|
33988
34663
|
else if (id.trim() !== "") {
|
|
33989
|
-
let folders = yield this.folderService.
|
|
34664
|
+
let folders = yield this.folderService.getAllDecryptedFromState();
|
|
33990
34665
|
folders = CliUtils.searchFolders(folders, id);
|
|
33991
34666
|
if (folders.length > 1) {
|
|
33992
34667
|
return Response.multipleResults(folders.map((f) => f.id));
|
|
@@ -34295,7 +34970,7 @@ class ListCommand {
|
|
|
34295
34970
|
}
|
|
34296
34971
|
listFolders(options) {
|
|
34297
34972
|
return list_command_awaiter(this, void 0, void 0, function* () {
|
|
34298
|
-
let folders = yield this.folderService.
|
|
34973
|
+
let folders = yield this.folderService.getAllDecryptedFromState();
|
|
34299
34974
|
if (options.search != null && options.search.trim() !== "") {
|
|
34300
34975
|
folders = CliUtils.searchFolders(folders, options.search);
|
|
34301
34976
|
}
|
|
@@ -35267,12 +35942,12 @@ class ServeCommand {
|
|
|
35267
35942
|
this.main = main;
|
|
35268
35943
|
this.getCommand = new GetCommand(this.main.cipherService, this.main.folderService, this.main.collectionService, this.main.totpService, this.main.auditService, this.main.cryptoService, this.main.stateService, this.main.searchService, this.main.apiService, this.main.organizationService);
|
|
35269
35944
|
this.listCommand = new ListCommand(this.main.cipherService, this.main.folderService, this.main.collectionService, this.main.organizationService, this.main.searchService, this.main.apiService);
|
|
35270
|
-
this.createCommand = new CreateCommand(this.main.cipherService, this.main.folderService, this.main.stateService, this.main.cryptoService, this.main.apiService);
|
|
35271
|
-
this.editCommand = new EditCommand(this.main.cipherService, this.main.folderService, this.main.cryptoService, this.main.apiService);
|
|
35945
|
+
this.createCommand = new CreateCommand(this.main.cipherService, this.main.folderService, this.main.stateService, this.main.cryptoService, this.main.apiService, this.main.folderApiService);
|
|
35946
|
+
this.editCommand = new EditCommand(this.main.cipherService, this.main.folderService, this.main.cryptoService, this.main.apiService, this.main.folderApiService);
|
|
35272
35947
|
this.generateCommand = new GenerateCommand(this.main.passwordGenerationService, this.main.stateService);
|
|
35273
35948
|
this.syncCommand = new SyncCommand(this.main.syncService);
|
|
35274
35949
|
this.statusCommand = new StatusCommand(this.main.environmentService, this.main.syncService, this.main.stateService, this.main.authService);
|
|
35275
|
-
this.deleteCommand = new DeleteCommand(this.main.cipherService, this.main.folderService, this.main.stateService, this.main.apiService);
|
|
35950
|
+
this.deleteCommand = new DeleteCommand(this.main.cipherService, this.main.folderService, this.main.stateService, this.main.apiService, this.main.folderApiService);
|
|
35276
35951
|
this.confirmCommand = new ConfirmCommand(this.main.apiService, this.main.cryptoService);
|
|
35277
35952
|
this.restoreCommand = new RestoreCommand(this.main.cipherService);
|
|
35278
35953
|
this.shareCommand = new ShareCommand(this.main.cipherService);
|
|
@@ -36462,11 +37137,14 @@ var i18n_service_awaiter = (undefined && undefined.__awaiter) || function (thisA
|
|
|
36462
37137
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
36463
37138
|
});
|
|
36464
37139
|
};
|
|
37140
|
+
|
|
36465
37141
|
class i18n_service_I18nService {
|
|
36466
37142
|
constructor(systemLanguage, localesDirectory, getLocalesJson) {
|
|
36467
37143
|
this.systemLanguage = systemLanguage;
|
|
36468
37144
|
this.localesDirectory = localesDirectory;
|
|
36469
37145
|
this.getLocalesJson = getLocalesJson;
|
|
37146
|
+
this._locale = new external_rxjs_namespaceObject.ReplaySubject(1);
|
|
37147
|
+
this.locale$ = this._locale.asObservable();
|
|
36470
37148
|
// First locale is the default (English)
|
|
36471
37149
|
this.supportedTranslationLocales = ["en"];
|
|
36472
37150
|
this.localeNames = new Map([
|
|
@@ -36539,9 +37217,13 @@ class i18n_service_I18nService {
|
|
|
36539
37217
|
throw new Error("supportedTranslationLocales not set.");
|
|
36540
37218
|
}
|
|
36541
37219
|
this.inited = true;
|
|
36542
|
-
this.
|
|
37220
|
+
this.translationLocale = locale != null ? locale : this.systemLanguage;
|
|
37221
|
+
this._locale.next(this.translationLocale);
|
|
36543
37222
|
try {
|
|
36544
|
-
this.collator = new Intl.Collator(this.
|
|
37223
|
+
this.collator = new Intl.Collator(this.translationLocale, {
|
|
37224
|
+
numeric: true,
|
|
37225
|
+
sensitivity: "base",
|
|
37226
|
+
});
|
|
36545
37227
|
}
|
|
36546
37228
|
catch (_a) {
|
|
36547
37229
|
this.collator = null;
|
|
@@ -37352,7 +38034,7 @@ class VaultProgram extends Program {
|
|
|
37352
38034
|
return;
|
|
37353
38035
|
}
|
|
37354
38036
|
yield this.exitIfLocked();
|
|
37355
|
-
const command = new CreateCommand(this.main.cipherService, this.main.folderService, this.main.stateService, this.main.cryptoService, this.main.apiService);
|
|
38037
|
+
const command = new CreateCommand(this.main.cipherService, this.main.folderService, this.main.stateService, this.main.cryptoService, this.main.apiService, this.main.folderApiService);
|
|
37356
38038
|
const response = yield command.run(object, encodedJson, cmd);
|
|
37357
38039
|
this.processResponse(response);
|
|
37358
38040
|
}));
|
|
@@ -37382,7 +38064,7 @@ class VaultProgram extends Program {
|
|
|
37382
38064
|
return;
|
|
37383
38065
|
}
|
|
37384
38066
|
yield this.exitIfLocked();
|
|
37385
|
-
const command = new EditCommand(this.main.cipherService, this.main.folderService, this.main.cryptoService, this.main.apiService);
|
|
38067
|
+
const command = new EditCommand(this.main.cipherService, this.main.folderService, this.main.cryptoService, this.main.apiService, this.main.folderApiService);
|
|
37386
38068
|
const response = yield command.run(object, id, encodedJson, cmd);
|
|
37387
38069
|
this.processResponse(response);
|
|
37388
38070
|
}));
|
|
@@ -37412,7 +38094,7 @@ class VaultProgram extends Program {
|
|
|
37412
38094
|
return;
|
|
37413
38095
|
}
|
|
37414
38096
|
yield this.exitIfLocked();
|
|
37415
|
-
const command = new DeleteCommand(this.main.cipherService, this.main.folderService, this.main.stateService, this.main.apiService);
|
|
38097
|
+
const command = new DeleteCommand(this.main.cipherService, this.main.folderService, this.main.stateService, this.main.apiService, this.main.folderApiService);
|
|
37416
38098
|
const response = yield command.run(object, id, cmd);
|
|
37417
38099
|
this.processResponse(response);
|
|
37418
38100
|
}));
|
|
@@ -37612,6 +38294,10 @@ var bw_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argum
|
|
|
37612
38294
|
|
|
37613
38295
|
|
|
37614
38296
|
|
|
38297
|
+
|
|
38298
|
+
|
|
38299
|
+
|
|
38300
|
+
|
|
37615
38301
|
|
|
37616
38302
|
|
|
37617
38303
|
|
|
@@ -37647,11 +38333,13 @@ class Main {
|
|
|
37647
38333
|
this.platformUtilsService = new CliPlatformUtilsService(ClientType.Cli, packageJson);
|
|
37648
38334
|
this.logService = new ConsoleLogService(this.platformUtilsService.isDev(), (level) => process.env.BITWARDENCLI_DEBUG !== "true" && level <= LogLevelType.Info);
|
|
37649
38335
|
this.cryptoFunctionService = new NodeCryptoFunctionService();
|
|
38336
|
+
this.encryptService = new EncryptService(this.cryptoFunctionService, this.logService, true);
|
|
37650
38337
|
this.storageService = new LowdbStorageService(this.logService, null, p, false, true);
|
|
37651
38338
|
this.secureStorageService = new NodeEnvSecureStorageService(this.storageService, this.logService, () => this.cryptoService);
|
|
38339
|
+
this.memoryStorageService = new MemoryStorageService();
|
|
37652
38340
|
this.stateMigrationService = new StateMigrationService(this.storageService, this.secureStorageService, new StateFactory(GlobalState, Account));
|
|
37653
|
-
this.stateService = new StateService(this.storageService, this.secureStorageService, this.logService, this.stateMigrationService, new StateFactory(GlobalState, Account));
|
|
37654
|
-
this.cryptoService = new CryptoService(this.cryptoFunctionService, this.platformUtilsService, this.logService, this.stateService);
|
|
38341
|
+
this.stateService = new StateService(this.storageService, this.secureStorageService, this.memoryStorageService, this.logService, this.stateMigrationService, new StateFactory(GlobalState, Account));
|
|
38342
|
+
this.cryptoService = new CryptoService(this.cryptoFunctionService, this.encryptService, this.platformUtilsService, this.logService, this.stateService);
|
|
37655
38343
|
this.appIdService = new AppIdService(this.storageService);
|
|
37656
38344
|
this.tokenService = new TokenService(this.stateService);
|
|
37657
38345
|
this.messagingService = new NoopMessagingService();
|
|
@@ -37666,7 +38354,9 @@ class Main {
|
|
|
37666
38354
|
this.settingsService = new SettingsService(this.stateService);
|
|
37667
38355
|
this.fileUploadService = new FileUploadService(this.logService, this.apiService);
|
|
37668
38356
|
this.cipherService = new CipherService(this.cryptoService, this.settingsService, this.apiService, this.fileUploadService, this.i18nService, null, this.logService, this.stateService);
|
|
37669
|
-
this.
|
|
38357
|
+
this.broadcasterService = new BroadcasterService();
|
|
38358
|
+
this.folderService = new FolderService(this.cryptoService, this.i18nService, this.cipherService, this.stateService);
|
|
38359
|
+
this.folderApiService = new FolderApiService(this.folderService, this.apiService);
|
|
37670
38360
|
this.collectionService = new CollectionService(this.cryptoService, this.i18nService, this.stateService);
|
|
37671
38361
|
this.searchService = new SearchService(this.cipherService, this.logService, this.i18nService);
|
|
37672
38362
|
this.providerService = new ProviderService(this.stateService);
|
|
@@ -37678,9 +38368,9 @@ class Main {
|
|
|
37678
38368
|
this.authService = new AuthService(this.cryptoService, this.apiService, this.tokenService, this.appIdService, this.platformUtilsService, this.messagingService, this.logService, this.keyConnectorService, this.environmentService, this.stateService, this.twoFactorService, this.i18nService);
|
|
37679
38369
|
const lockedCallback = () => bw_awaiter(this, void 0, void 0, function* () { return yield this.cryptoService.clearStoredKey(KeySuffixOptions.Auto); });
|
|
37680
38370
|
this.vaultTimeoutService = new VaultTimeoutService(this.cipherService, this.folderService, this.collectionService, this.cryptoService, this.platformUtilsService, this.messagingService, this.searchService, this.tokenService, this.policyService, this.keyConnectorService, this.stateService, this.authService, lockedCallback, null);
|
|
37681
|
-
this.syncService = new SyncService(this.apiService, this.settingsService, this.folderService, this.cipherService, this.cryptoService, this.collectionService, this.messagingService, this.policyService, this.sendService, this.logService, this.keyConnectorService, this.stateService, this.organizationService, this.providerService, (expired) => bw_awaiter(this, void 0, void 0, function* () { return yield this.logout(); }));
|
|
38371
|
+
this.syncService = new SyncService(this.apiService, this.settingsService, this.folderService, this.cipherService, this.cryptoService, this.collectionService, this.messagingService, this.policyService, this.sendService, this.logService, this.keyConnectorService, this.stateService, this.organizationService, this.providerService, this.folderApiService, (expired) => bw_awaiter(this, void 0, void 0, function* () { return yield this.logout(); }));
|
|
37682
38372
|
this.passwordGenerationService = new PasswordGenerationService(this.cryptoService, this.policyService, this.stateService);
|
|
37683
|
-
this.totpService = new TotpService(this.cryptoFunctionService, this.logService
|
|
38373
|
+
this.totpService = new TotpService(this.cryptoFunctionService, this.logService);
|
|
37684
38374
|
this.importService = new ImportService(this.cipherService, this.folderService, this.apiService, this.i18nService, this.collectionService, this.platformUtilsService, this.cryptoService);
|
|
37685
38375
|
this.exportService = new ExportService(this.folderService, this.cipherService, this.apiService, this.cryptoService, this.cryptoFunctionService);
|
|
37686
38376
|
this.auditService = new AuditService(this.cryptoFunctionService, this.apiService);
|