@bitwarden/cli 2022.8.0 → 2022.9.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 +801 -723
- package/build/bw.js.map +1 -1
- package/package.json +1 -1
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.9.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
|
|
|
@@ -237,7 +237,8 @@ var StateVersion;
|
|
|
237
237
|
StateVersion[StateVersion["Three"] = 3] = "Three";
|
|
238
238
|
StateVersion[StateVersion["Four"] = 4] = "Four";
|
|
239
239
|
StateVersion[StateVersion["Five"] = 5] = "Five";
|
|
240
|
-
StateVersion[StateVersion["
|
|
240
|
+
StateVersion[StateVersion["Six"] = 6] = "Six";
|
|
241
|
+
StateVersion[StateVersion["Latest"] = 6] = "Latest";
|
|
241
242
|
})(StateVersion || (StateVersion = {}));
|
|
242
243
|
|
|
243
244
|
;// CONCATENATED MODULE: ../../libs/common/src/enums/themeType.ts
|
|
@@ -295,14 +296,23 @@ class Utils {
|
|
|
295
296
|
Utils.isBrowser = typeof window !== "undefined";
|
|
296
297
|
Utils.isMobileBrowser = Utils.isBrowser && this.isMobile(window);
|
|
297
298
|
Utils.isAppleMobileBrowser = Utils.isBrowser && this.isAppleMobile(window);
|
|
298
|
-
|
|
299
|
+
if (Utils.isNode) {
|
|
300
|
+
Utils.global = global;
|
|
301
|
+
}
|
|
302
|
+
else if (Utils.isBrowser) {
|
|
303
|
+
Utils.global = window;
|
|
304
|
+
}
|
|
305
|
+
else {
|
|
306
|
+
// If it's not browser or node then it must be a service worker
|
|
307
|
+
Utils.global = self;
|
|
308
|
+
}
|
|
299
309
|
}
|
|
300
310
|
static fromB64ToArray(str) {
|
|
301
311
|
if (Utils.isNode) {
|
|
302
312
|
return new Uint8Array(Buffer.from(str, "base64"));
|
|
303
313
|
}
|
|
304
314
|
else {
|
|
305
|
-
const binaryString =
|
|
315
|
+
const binaryString = Utils.global.atob(str);
|
|
306
316
|
const bytes = new Uint8Array(binaryString.length);
|
|
307
317
|
for (let i = 0; i < binaryString.length; i++) {
|
|
308
318
|
bytes[i] = binaryString.charCodeAt(i);
|
|
@@ -355,7 +365,7 @@ class Utils {
|
|
|
355
365
|
for (let i = 0; i < bytes.byteLength; i++) {
|
|
356
366
|
binary += String.fromCharCode(bytes[i]);
|
|
357
367
|
}
|
|
358
|
-
return
|
|
368
|
+
return Utils.global.btoa(binary);
|
|
359
369
|
}
|
|
360
370
|
}
|
|
361
371
|
static fromBufferToUrlB64(buffer) {
|
|
@@ -413,7 +423,7 @@ class Utils {
|
|
|
413
423
|
return Buffer.from(utfStr, "utf8").toString("base64");
|
|
414
424
|
}
|
|
415
425
|
else {
|
|
416
|
-
return decodeURIComponent(escape(
|
|
426
|
+
return decodeURIComponent(escape(Utils.global.btoa(utfStr)));
|
|
417
427
|
}
|
|
418
428
|
}
|
|
419
429
|
static fromUtf8ToUrlB64(utfStr) {
|
|
@@ -424,7 +434,7 @@ class Utils {
|
|
|
424
434
|
return Buffer.from(b64Str, "base64").toString("utf8");
|
|
425
435
|
}
|
|
426
436
|
else {
|
|
427
|
-
return decodeURIComponent(escape(
|
|
437
|
+
return decodeURIComponent(escape(Utils.global.atob(b64Str)));
|
|
428
438
|
}
|
|
429
439
|
}
|
|
430
440
|
// ref: http://stackoverflow.com/a/2117523/1090359
|
|
@@ -596,7 +606,7 @@ class Utils {
|
|
|
596
606
|
else if (typeof URL === "function") {
|
|
597
607
|
return new URL(uriString);
|
|
598
608
|
}
|
|
599
|
-
else if (window
|
|
609
|
+
else if (typeof window !== "undefined") {
|
|
600
610
|
const hasProtocol = uriString.indexOf("://") > -1;
|
|
601
611
|
if (!hasProtocol && uriString.indexOf(".") > -1) {
|
|
602
612
|
uriString = "http://" + uriString;
|
|
@@ -1116,7 +1126,6 @@ class LogInStrategy {
|
|
|
1116
1126
|
yield this.cryptoService.setEncPrivateKey((_a = response.privateKey) !== null && _a !== void 0 ? _a : (yield this.createKeyPairForOldAccount()));
|
|
1117
1127
|
}
|
|
1118
1128
|
yield this.onSuccessfulLogin(response);
|
|
1119
|
-
yield this.stateService.setBiometricLocked(false);
|
|
1120
1129
|
this.messagingService.send("loggedIn");
|
|
1121
1130
|
return result;
|
|
1122
1131
|
});
|
|
@@ -1364,17 +1373,15 @@ class ErrorResponse extends BaseResponse {
|
|
|
1364
1373
|
errorModel = response;
|
|
1365
1374
|
}
|
|
1366
1375
|
}
|
|
1367
|
-
if (
|
|
1376
|
+
if (status === 429) {
|
|
1377
|
+
this.message = "Rate limit exceeded. Try again later.";
|
|
1378
|
+
}
|
|
1379
|
+
else if (errorModel) {
|
|
1368
1380
|
this.message = this.getResponseProperty("Message", errorModel);
|
|
1369
1381
|
this.validationErrors = this.getResponseProperty("ValidationErrors", errorModel);
|
|
1370
1382
|
this.captchaSiteKey = (_b = (_a = this.validationErrors) === null || _a === void 0 ? void 0 : _a.HCaptcha_SiteKey) === null || _b === void 0 ? void 0 : _b[0];
|
|
1371
1383
|
this.captchaRequired = !Utils.isNullOrWhitespace(this.captchaSiteKey);
|
|
1372
1384
|
}
|
|
1373
|
-
else {
|
|
1374
|
-
if (status === 429) {
|
|
1375
|
-
this.message = "Rate limit exceeded. Try again later.";
|
|
1376
|
-
}
|
|
1377
|
-
}
|
|
1378
1385
|
this.statusCode = status;
|
|
1379
1386
|
}
|
|
1380
1387
|
getSingleMessage() {
|
|
@@ -1860,7 +1867,79 @@ class CipherData {
|
|
|
1860
1867
|
}
|
|
1861
1868
|
}
|
|
1862
1869
|
|
|
1870
|
+
;// CONCATENATED MODULE: ../../libs/common/src/enums/encryptionType.ts
|
|
1871
|
+
var EncryptionType;
|
|
1872
|
+
(function (EncryptionType) {
|
|
1873
|
+
EncryptionType[EncryptionType["AesCbc256_B64"] = 0] = "AesCbc256_B64";
|
|
1874
|
+
EncryptionType[EncryptionType["AesCbc128_HmacSha256_B64"] = 1] = "AesCbc128_HmacSha256_B64";
|
|
1875
|
+
EncryptionType[EncryptionType["AesCbc256_HmacSha256_B64"] = 2] = "AesCbc256_HmacSha256_B64";
|
|
1876
|
+
EncryptionType[EncryptionType["Rsa2048_OaepSha256_B64"] = 3] = "Rsa2048_OaepSha256_B64";
|
|
1877
|
+
EncryptionType[EncryptionType["Rsa2048_OaepSha1_B64"] = 4] = "Rsa2048_OaepSha1_B64";
|
|
1878
|
+
EncryptionType[EncryptionType["Rsa2048_OaepSha256_HmacSha256_B64"] = 5] = "Rsa2048_OaepSha256_HmacSha256_B64";
|
|
1879
|
+
EncryptionType[EncryptionType["Rsa2048_OaepSha1_HmacSha256_B64"] = 6] = "Rsa2048_OaepSha1_HmacSha256_B64";
|
|
1880
|
+
})(EncryptionType || (EncryptionType = {}));
|
|
1881
|
+
|
|
1882
|
+
;// CONCATENATED MODULE: ../../libs/common/src/models/domain/symmetricCryptoKey.ts
|
|
1883
|
+
|
|
1884
|
+
|
|
1885
|
+
class SymmetricCryptoKey {
|
|
1886
|
+
constructor(key, encType) {
|
|
1887
|
+
if (key == null) {
|
|
1888
|
+
throw new Error("Must provide key");
|
|
1889
|
+
}
|
|
1890
|
+
if (encType == null) {
|
|
1891
|
+
if (key.byteLength === 32) {
|
|
1892
|
+
encType = EncryptionType.AesCbc256_B64;
|
|
1893
|
+
}
|
|
1894
|
+
else if (key.byteLength === 64) {
|
|
1895
|
+
encType = EncryptionType.AesCbc256_HmacSha256_B64;
|
|
1896
|
+
}
|
|
1897
|
+
else {
|
|
1898
|
+
throw new Error("Unable to determine encType.");
|
|
1899
|
+
}
|
|
1900
|
+
}
|
|
1901
|
+
this.key = key;
|
|
1902
|
+
this.encType = encType;
|
|
1903
|
+
if (encType === EncryptionType.AesCbc256_B64 && key.byteLength === 32) {
|
|
1904
|
+
this.encKey = key;
|
|
1905
|
+
this.macKey = null;
|
|
1906
|
+
}
|
|
1907
|
+
else if (encType === EncryptionType.AesCbc128_HmacSha256_B64 && key.byteLength === 32) {
|
|
1908
|
+
this.encKey = key.slice(0, 16);
|
|
1909
|
+
this.macKey = key.slice(16, 32);
|
|
1910
|
+
}
|
|
1911
|
+
else if (encType === EncryptionType.AesCbc256_HmacSha256_B64 && key.byteLength === 64) {
|
|
1912
|
+
this.encKey = key.slice(0, 32);
|
|
1913
|
+
this.macKey = key.slice(32, 64);
|
|
1914
|
+
}
|
|
1915
|
+
else {
|
|
1916
|
+
throw new Error("Unsupported encType/key length.");
|
|
1917
|
+
}
|
|
1918
|
+
if (this.key != null) {
|
|
1919
|
+
this.keyB64 = Utils.fromBufferToB64(this.key);
|
|
1920
|
+
}
|
|
1921
|
+
if (this.encKey != null) {
|
|
1922
|
+
this.encKeyB64 = Utils.fromBufferToB64(this.encKey);
|
|
1923
|
+
}
|
|
1924
|
+
if (this.macKey != null) {
|
|
1925
|
+
this.macKeyB64 = Utils.fromBufferToB64(this.macKey);
|
|
1926
|
+
}
|
|
1927
|
+
}
|
|
1928
|
+
toJSON() {
|
|
1929
|
+
// The whole object is constructed from the initial key, so just store the B64 key
|
|
1930
|
+
return { keyB64: this.keyB64 };
|
|
1931
|
+
}
|
|
1932
|
+
static fromJSON(obj) {
|
|
1933
|
+
if (obj == null) {
|
|
1934
|
+
return null;
|
|
1935
|
+
}
|
|
1936
|
+
const arrayBuffer = Utils.fromB64ToArray(obj.keyB64).buffer;
|
|
1937
|
+
return new SymmetricCryptoKey(arrayBuffer);
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
|
|
1863
1941
|
;// CONCATENATED MODULE: ../../libs/common/src/models/view/attachmentView.ts
|
|
1942
|
+
|
|
1864
1943
|
class AttachmentView {
|
|
1865
1944
|
constructor(a) {
|
|
1866
1945
|
this.id = null;
|
|
@@ -1888,20 +1967,12 @@ class AttachmentView {
|
|
|
1888
1967
|
}
|
|
1889
1968
|
return 0;
|
|
1890
1969
|
}
|
|
1970
|
+
static fromJSON(obj) {
|
|
1971
|
+
const key = obj.key == null ? null : SymmetricCryptoKey.fromJSON(obj.key);
|
|
1972
|
+
return Object.assign(new AttachmentView(), obj, { key: key });
|
|
1973
|
+
}
|
|
1891
1974
|
}
|
|
1892
1975
|
|
|
1893
|
-
;// CONCATENATED MODULE: ../../libs/common/src/enums/encryptionType.ts
|
|
1894
|
-
var EncryptionType;
|
|
1895
|
-
(function (EncryptionType) {
|
|
1896
|
-
EncryptionType[EncryptionType["AesCbc256_B64"] = 0] = "AesCbc256_B64";
|
|
1897
|
-
EncryptionType[EncryptionType["AesCbc128_HmacSha256_B64"] = 1] = "AesCbc128_HmacSha256_B64";
|
|
1898
|
-
EncryptionType[EncryptionType["AesCbc256_HmacSha256_B64"] = 2] = "AesCbc256_HmacSha256_B64";
|
|
1899
|
-
EncryptionType[EncryptionType["Rsa2048_OaepSha256_B64"] = 3] = "Rsa2048_OaepSha256_B64";
|
|
1900
|
-
EncryptionType[EncryptionType["Rsa2048_OaepSha1_B64"] = 4] = "Rsa2048_OaepSha1_B64";
|
|
1901
|
-
EncryptionType[EncryptionType["Rsa2048_OaepSha256_HmacSha256_B64"] = 5] = "Rsa2048_OaepSha256_HmacSha256_B64";
|
|
1902
|
-
EncryptionType[EncryptionType["Rsa2048_OaepSha1_HmacSha256_B64"] = 6] = "Rsa2048_OaepSha1_HmacSha256_B64";
|
|
1903
|
-
})(EncryptionType || (EncryptionType = {}));
|
|
1904
|
-
|
|
1905
1976
|
;// CONCATENATED MODULE: ../../libs/common/src/models/domain/encString.ts
|
|
1906
1977
|
var encString_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
1907
1978
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -1917,47 +1988,76 @@ var encString_awaiter = (undefined && undefined.__awaiter) || function (thisArg,
|
|
|
1917
1988
|
class EncString {
|
|
1918
1989
|
constructor(encryptedStringOrType, data, iv, mac) {
|
|
1919
1990
|
if (data != null) {
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1991
|
+
this.initFromData(encryptedStringOrType, data, iv, mac);
|
|
1992
|
+
}
|
|
1993
|
+
else {
|
|
1994
|
+
this.initFromEncryptedString(encryptedStringOrType);
|
|
1995
|
+
}
|
|
1996
|
+
}
|
|
1997
|
+
decrypt(orgId, key = null) {
|
|
1998
|
+
return encString_awaiter(this, void 0, void 0, function* () {
|
|
1999
|
+
if (this.decryptedValue != null) {
|
|
2000
|
+
return this.decryptedValue;
|
|
1924
2001
|
}
|
|
1925
|
-
|
|
1926
|
-
|
|
2002
|
+
let cryptoService;
|
|
2003
|
+
const containerService = Utils.global.bitwardenContainerService;
|
|
2004
|
+
if (containerService) {
|
|
2005
|
+
cryptoService = containerService.getCryptoService();
|
|
1927
2006
|
}
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
this.encryptedString += "|" + mac;
|
|
2007
|
+
else {
|
|
2008
|
+
throw new Error("global bitwardenContainerService not initialized.");
|
|
1931
2009
|
}
|
|
1932
|
-
this.encryptionType = encType;
|
|
1933
|
-
this.data = data;
|
|
1934
|
-
this.iv = iv;
|
|
1935
|
-
this.mac = mac;
|
|
1936
|
-
return;
|
|
1937
|
-
}
|
|
1938
|
-
this.encryptedString = encryptedStringOrType;
|
|
1939
|
-
if (!this.encryptedString) {
|
|
1940
|
-
return;
|
|
1941
|
-
}
|
|
1942
|
-
const headerPieces = this.encryptedString.split(".");
|
|
1943
|
-
let encPieces = null;
|
|
1944
|
-
if (headerPieces.length === 2) {
|
|
1945
2010
|
try {
|
|
1946
|
-
|
|
1947
|
-
|
|
2011
|
+
if (key == null) {
|
|
2012
|
+
key = yield cryptoService.getOrgKey(orgId);
|
|
2013
|
+
}
|
|
2014
|
+
this.decryptedValue = yield cryptoService.decryptToUtf8(this, key);
|
|
1948
2015
|
}
|
|
1949
2016
|
catch (e) {
|
|
1950
|
-
|
|
2017
|
+
this.decryptedValue = "[error: cannot decrypt]";
|
|
1951
2018
|
}
|
|
2019
|
+
return this.decryptedValue;
|
|
2020
|
+
});
|
|
2021
|
+
}
|
|
2022
|
+
get ivBytes() {
|
|
2023
|
+
return this.iv == null ? null : Utils.fromB64ToArray(this.iv).buffer;
|
|
2024
|
+
}
|
|
2025
|
+
get macBytes() {
|
|
2026
|
+
return this.mac == null ? null : Utils.fromB64ToArray(this.mac).buffer;
|
|
2027
|
+
}
|
|
2028
|
+
get dataBytes() {
|
|
2029
|
+
return this.data == null ? null : Utils.fromB64ToArray(this.data).buffer;
|
|
2030
|
+
}
|
|
2031
|
+
toJSON() {
|
|
2032
|
+
return this.encryptedString;
|
|
2033
|
+
}
|
|
2034
|
+
static fromJSON(obj) {
|
|
2035
|
+
return new EncString(obj);
|
|
2036
|
+
}
|
|
2037
|
+
initFromData(encType, data, iv, mac) {
|
|
2038
|
+
if (iv != null) {
|
|
2039
|
+
this.encryptedString = encType + "." + iv + "|" + data;
|
|
1952
2040
|
}
|
|
1953
2041
|
else {
|
|
1954
|
-
|
|
1955
|
-
this.encryptionType =
|
|
1956
|
-
encPieces.length === 3
|
|
1957
|
-
? EncryptionType.AesCbc128_HmacSha256_B64
|
|
1958
|
-
: EncryptionType.AesCbc256_B64;
|
|
2042
|
+
this.encryptedString = encType + "." + data;
|
|
1959
2043
|
}
|
|
1960
|
-
|
|
2044
|
+
// mac
|
|
2045
|
+
if (mac != null) {
|
|
2046
|
+
this.encryptedString += "|" + mac;
|
|
2047
|
+
}
|
|
2048
|
+
this.encryptionType = encType;
|
|
2049
|
+
this.data = data;
|
|
2050
|
+
this.iv = iv;
|
|
2051
|
+
this.mac = mac;
|
|
2052
|
+
}
|
|
2053
|
+
initFromEncryptedString(encryptedString) {
|
|
2054
|
+
this.encryptedString = encryptedString;
|
|
2055
|
+
if (!this.encryptedString) {
|
|
2056
|
+
return;
|
|
2057
|
+
}
|
|
2058
|
+
const { encType, encPieces } = this.parseEncryptedString(this.encryptedString);
|
|
2059
|
+
this.encryptionType = encType;
|
|
2060
|
+
switch (encType) {
|
|
1961
2061
|
case EncryptionType.AesCbc128_HmacSha256_B64:
|
|
1962
2062
|
case EncryptionType.AesCbc256_HmacSha256_B64:
|
|
1963
2063
|
if (encPieces.length !== 3) {
|
|
@@ -1985,30 +2085,30 @@ class EncString {
|
|
|
1985
2085
|
return;
|
|
1986
2086
|
}
|
|
1987
2087
|
}
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
let cryptoService;
|
|
1994
|
-
const containerService = Utils.global.bitwardenContainerService;
|
|
1995
|
-
if (containerService) {
|
|
1996
|
-
cryptoService = containerService.getCryptoService();
|
|
1997
|
-
}
|
|
1998
|
-
else {
|
|
1999
|
-
throw new Error("global bitwardenContainerService not initialized.");
|
|
2000
|
-
}
|
|
2088
|
+
parseEncryptedString(encryptedString) {
|
|
2089
|
+
const headerPieces = encryptedString.split(".");
|
|
2090
|
+
let encType;
|
|
2091
|
+
let encPieces = null;
|
|
2092
|
+
if (headerPieces.length === 2) {
|
|
2001
2093
|
try {
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
}
|
|
2005
|
-
this.decryptedValue = yield cryptoService.decryptToUtf8(this, key);
|
|
2094
|
+
encType = parseInt(headerPieces[0], null);
|
|
2095
|
+
encPieces = headerPieces[1].split("|");
|
|
2006
2096
|
}
|
|
2007
2097
|
catch (e) {
|
|
2008
|
-
|
|
2098
|
+
return;
|
|
2009
2099
|
}
|
|
2010
|
-
|
|
2011
|
-
|
|
2100
|
+
}
|
|
2101
|
+
else {
|
|
2102
|
+
encPieces = encryptedString.split("|");
|
|
2103
|
+
encType =
|
|
2104
|
+
encPieces.length === 3
|
|
2105
|
+
? EncryptionType.AesCbc128_HmacSha256_B64
|
|
2106
|
+
: EncryptionType.AesCbc256_B64;
|
|
2107
|
+
}
|
|
2108
|
+
return {
|
|
2109
|
+
encType,
|
|
2110
|
+
encPieces,
|
|
2111
|
+
};
|
|
2012
2112
|
}
|
|
2013
2113
|
}
|
|
2014
2114
|
|
|
@@ -2084,69 +2184,6 @@ class Domain {
|
|
|
2084
2184
|
}
|
|
2085
2185
|
}
|
|
2086
2186
|
|
|
2087
|
-
;// CONCATENATED MODULE: ../../libs/common/src/models/domain/symmetricCryptoKey.ts
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
class SymmetricCryptoKey {
|
|
2091
|
-
constructor(key, encType) {
|
|
2092
|
-
if (key == null) {
|
|
2093
|
-
throw new Error("Must provide key");
|
|
2094
|
-
}
|
|
2095
|
-
if (encType == null) {
|
|
2096
|
-
if (key.byteLength === 32) {
|
|
2097
|
-
encType = EncryptionType.AesCbc256_B64;
|
|
2098
|
-
}
|
|
2099
|
-
else if (key.byteLength === 64) {
|
|
2100
|
-
encType = EncryptionType.AesCbc256_HmacSha256_B64;
|
|
2101
|
-
}
|
|
2102
|
-
else {
|
|
2103
|
-
throw new Error("Unable to determine encType.");
|
|
2104
|
-
}
|
|
2105
|
-
}
|
|
2106
|
-
this.key = key;
|
|
2107
|
-
this.encType = encType;
|
|
2108
|
-
if (encType === EncryptionType.AesCbc256_B64 && key.byteLength === 32) {
|
|
2109
|
-
this.encKey = key;
|
|
2110
|
-
this.macKey = null;
|
|
2111
|
-
}
|
|
2112
|
-
else if (encType === EncryptionType.AesCbc128_HmacSha256_B64 && key.byteLength === 32) {
|
|
2113
|
-
this.encKey = key.slice(0, 16);
|
|
2114
|
-
this.macKey = key.slice(16, 32);
|
|
2115
|
-
}
|
|
2116
|
-
else if (encType === EncryptionType.AesCbc256_HmacSha256_B64 && key.byteLength === 64) {
|
|
2117
|
-
this.encKey = key.slice(0, 32);
|
|
2118
|
-
this.macKey = key.slice(32, 64);
|
|
2119
|
-
}
|
|
2120
|
-
else {
|
|
2121
|
-
throw new Error("Unsupported encType/key length.");
|
|
2122
|
-
}
|
|
2123
|
-
if (this.key != null) {
|
|
2124
|
-
this.keyB64 = Utils.fromBufferToB64(this.key);
|
|
2125
|
-
}
|
|
2126
|
-
if (this.encKey != null) {
|
|
2127
|
-
this.encKeyB64 = Utils.fromBufferToB64(this.encKey);
|
|
2128
|
-
}
|
|
2129
|
-
if (this.macKey != null) {
|
|
2130
|
-
this.macKeyB64 = Utils.fromBufferToB64(this.macKey);
|
|
2131
|
-
}
|
|
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
|
-
}
|
|
2148
|
-
}
|
|
2149
|
-
|
|
2150
2187
|
;// CONCATENATED MODULE: ../../libs/common/src/models/domain/attachment.ts
|
|
2151
2188
|
var attachment_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2152
2189
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -2304,7 +2341,7 @@ var cardView_metadata = (undefined && undefined.__metadata) || function (k, v) {
|
|
|
2304
2341
|
|
|
2305
2342
|
class CardView extends ItemView {
|
|
2306
2343
|
constructor() {
|
|
2307
|
-
super();
|
|
2344
|
+
super(...arguments);
|
|
2308
2345
|
this.cardholderName = null;
|
|
2309
2346
|
this.expMonth = null;
|
|
2310
2347
|
this.expYear = null;
|
|
@@ -2361,6 +2398,9 @@ class CardView extends ItemView {
|
|
|
2361
2398
|
formatYear(year) {
|
|
2362
2399
|
return year.length === 2 ? "20" + year : year;
|
|
2363
2400
|
}
|
|
2401
|
+
static fromJSON(obj) {
|
|
2402
|
+
return Object.assign(new CardView(), obj);
|
|
2403
|
+
}
|
|
2364
2404
|
}
|
|
2365
2405
|
cardView_decorate([
|
|
2366
2406
|
linkedFieldOption(CardLinkedId.CardholderName),
|
|
@@ -2439,6 +2479,30 @@ var CipherRepromptType;
|
|
|
2439
2479
|
CipherRepromptType[CipherRepromptType["Password"] = 1] = "Password";
|
|
2440
2480
|
})(CipherRepromptType || (CipherRepromptType = {}));
|
|
2441
2481
|
|
|
2482
|
+
;// CONCATENATED MODULE: ../../libs/common/src/models/view/fieldView.ts
|
|
2483
|
+
class FieldView {
|
|
2484
|
+
constructor(f) {
|
|
2485
|
+
this.name = null;
|
|
2486
|
+
this.value = null;
|
|
2487
|
+
this.type = null;
|
|
2488
|
+
this.newField = false; // Marks if the field is new and hasn't been saved
|
|
2489
|
+
this.showValue = false;
|
|
2490
|
+
this.showCount = false;
|
|
2491
|
+
this.linkedId = null;
|
|
2492
|
+
if (!f) {
|
|
2493
|
+
return;
|
|
2494
|
+
}
|
|
2495
|
+
this.type = f.type;
|
|
2496
|
+
this.linkedId = f.linkedId;
|
|
2497
|
+
}
|
|
2498
|
+
get maskedValue() {
|
|
2499
|
+
return this.value != null ? "••••••••" : null;
|
|
2500
|
+
}
|
|
2501
|
+
static fromJSON(obj) {
|
|
2502
|
+
return Object.assign(new FieldView(), obj);
|
|
2503
|
+
}
|
|
2504
|
+
}
|
|
2505
|
+
|
|
2442
2506
|
;// CONCATENATED MODULE: ../../libs/common/src/models/view/identityView.ts
|
|
2443
2507
|
var identityView_decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
2444
2508
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -2557,6 +2621,9 @@ class IdentityView extends ItemView {
|
|
|
2557
2621
|
addressPart2 += ", " + postalCode;
|
|
2558
2622
|
return addressPart2;
|
|
2559
2623
|
}
|
|
2624
|
+
static fromJSON(obj) {
|
|
2625
|
+
return Object.assign(new IdentityView(), obj);
|
|
2626
|
+
}
|
|
2560
2627
|
}
|
|
2561
2628
|
identityView_decorate([
|
|
2562
2629
|
linkedFieldOption(IdentityLinkedId.Title),
|
|
@@ -2638,6 +2705,116 @@ identityView_decorate([
|
|
|
2638
2705
|
identityView_metadata("design:paramtypes", [])
|
|
2639
2706
|
], IdentityView.prototype, "fullName", null);
|
|
2640
2707
|
|
|
2708
|
+
;// CONCATENATED MODULE: ../../libs/common/src/models/view/loginUriView.ts
|
|
2709
|
+
|
|
2710
|
+
|
|
2711
|
+
const CanLaunchWhitelist = [
|
|
2712
|
+
"https://",
|
|
2713
|
+
"http://",
|
|
2714
|
+
"ssh://",
|
|
2715
|
+
"ftp://",
|
|
2716
|
+
"sftp://",
|
|
2717
|
+
"irc://",
|
|
2718
|
+
"vnc://",
|
|
2719
|
+
// https://docs.microsoft.com/en-us/windows-server/remote/remote-desktop-services/clients/remote-desktop-uri
|
|
2720
|
+
"rdp://",
|
|
2721
|
+
"ms-rd:",
|
|
2722
|
+
"chrome://",
|
|
2723
|
+
"iosapp://",
|
|
2724
|
+
"androidapp://",
|
|
2725
|
+
];
|
|
2726
|
+
class LoginUriView {
|
|
2727
|
+
constructor(u) {
|
|
2728
|
+
this.match = null;
|
|
2729
|
+
this._uri = null;
|
|
2730
|
+
this._domain = null;
|
|
2731
|
+
this._hostname = null;
|
|
2732
|
+
this._host = null;
|
|
2733
|
+
this._canLaunch = null;
|
|
2734
|
+
if (!u) {
|
|
2735
|
+
return;
|
|
2736
|
+
}
|
|
2737
|
+
this.match = u.match;
|
|
2738
|
+
}
|
|
2739
|
+
get uri() {
|
|
2740
|
+
return this._uri;
|
|
2741
|
+
}
|
|
2742
|
+
set uri(value) {
|
|
2743
|
+
this._uri = value;
|
|
2744
|
+
this._domain = null;
|
|
2745
|
+
this._canLaunch = null;
|
|
2746
|
+
}
|
|
2747
|
+
get domain() {
|
|
2748
|
+
if (this._domain == null && this.uri != null) {
|
|
2749
|
+
this._domain = Utils.getDomain(this.uri);
|
|
2750
|
+
if (this._domain === "") {
|
|
2751
|
+
this._domain = null;
|
|
2752
|
+
}
|
|
2753
|
+
}
|
|
2754
|
+
return this._domain;
|
|
2755
|
+
}
|
|
2756
|
+
get hostname() {
|
|
2757
|
+
if (this.match === UriMatchType.RegularExpression) {
|
|
2758
|
+
return null;
|
|
2759
|
+
}
|
|
2760
|
+
if (this._hostname == null && this.uri != null) {
|
|
2761
|
+
this._hostname = Utils.getHostname(this.uri);
|
|
2762
|
+
if (this._hostname === "") {
|
|
2763
|
+
this._hostname = null;
|
|
2764
|
+
}
|
|
2765
|
+
}
|
|
2766
|
+
return this._hostname;
|
|
2767
|
+
}
|
|
2768
|
+
get host() {
|
|
2769
|
+
if (this.match === UriMatchType.RegularExpression) {
|
|
2770
|
+
return null;
|
|
2771
|
+
}
|
|
2772
|
+
if (this._host == null && this.uri != null) {
|
|
2773
|
+
this._host = Utils.getHost(this.uri);
|
|
2774
|
+
if (this._host === "") {
|
|
2775
|
+
this._host = null;
|
|
2776
|
+
}
|
|
2777
|
+
}
|
|
2778
|
+
return this._host;
|
|
2779
|
+
}
|
|
2780
|
+
get hostnameOrUri() {
|
|
2781
|
+
return this.hostname != null ? this.hostname : this.uri;
|
|
2782
|
+
}
|
|
2783
|
+
get hostOrUri() {
|
|
2784
|
+
return this.host != null ? this.host : this.uri;
|
|
2785
|
+
}
|
|
2786
|
+
get isWebsite() {
|
|
2787
|
+
return (this.uri != null &&
|
|
2788
|
+
(this.uri.indexOf("http://") === 0 ||
|
|
2789
|
+
this.uri.indexOf("https://") === 0 ||
|
|
2790
|
+
(this.uri.indexOf("://") < 0 && Utils.tldEndingRegex.test(this.uri))));
|
|
2791
|
+
}
|
|
2792
|
+
get canLaunch() {
|
|
2793
|
+
if (this._canLaunch != null) {
|
|
2794
|
+
return this._canLaunch;
|
|
2795
|
+
}
|
|
2796
|
+
if (this.uri != null && this.match !== UriMatchType.RegularExpression) {
|
|
2797
|
+
const uri = this.launchUri;
|
|
2798
|
+
for (let i = 0; i < CanLaunchWhitelist.length; i++) {
|
|
2799
|
+
if (uri.indexOf(CanLaunchWhitelist[i]) === 0) {
|
|
2800
|
+
this._canLaunch = true;
|
|
2801
|
+
return this._canLaunch;
|
|
2802
|
+
}
|
|
2803
|
+
}
|
|
2804
|
+
}
|
|
2805
|
+
this._canLaunch = false;
|
|
2806
|
+
return this._canLaunch;
|
|
2807
|
+
}
|
|
2808
|
+
get launchUri() {
|
|
2809
|
+
return this.uri.indexOf("://") < 0 && Utils.tldEndingRegex.test(this.uri)
|
|
2810
|
+
? "http://" + this.uri
|
|
2811
|
+
: this.uri;
|
|
2812
|
+
}
|
|
2813
|
+
static fromJSON(obj) {
|
|
2814
|
+
return Object.assign(new LoginUriView(), obj);
|
|
2815
|
+
}
|
|
2816
|
+
}
|
|
2817
|
+
|
|
2641
2818
|
;// CONCATENATED MODULE: ../../libs/common/src/models/view/loginView.ts
|
|
2642
2819
|
var loginView_decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
2643
2820
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -2652,6 +2829,7 @@ var loginView_metadata = (undefined && undefined.__metadata) || function (k, v)
|
|
|
2652
2829
|
|
|
2653
2830
|
|
|
2654
2831
|
|
|
2832
|
+
|
|
2655
2833
|
class LoginView extends ItemView {
|
|
2656
2834
|
constructor(l) {
|
|
2657
2835
|
super();
|
|
@@ -2694,6 +2872,15 @@ class LoginView extends ItemView {
|
|
|
2694
2872
|
get hasUris() {
|
|
2695
2873
|
return this.uris != null && this.uris.length > 0;
|
|
2696
2874
|
}
|
|
2875
|
+
static fromJSON(obj) {
|
|
2876
|
+
var _a;
|
|
2877
|
+
const passwordRevisionDate = obj.passwordRevisionDate == null ? null : new Date(obj.passwordRevisionDate);
|
|
2878
|
+
const uris = (_a = obj.uris) === null || _a === void 0 ? void 0 : _a.map((uri) => LoginUriView.fromJSON(uri));
|
|
2879
|
+
return Object.assign(new LoginView(), obj, {
|
|
2880
|
+
passwordRevisionDate: passwordRevisionDate,
|
|
2881
|
+
uris: uris,
|
|
2882
|
+
});
|
|
2883
|
+
}
|
|
2697
2884
|
}
|
|
2698
2885
|
loginView_decorate([
|
|
2699
2886
|
linkedFieldOption(LoginLinkedId.Username),
|
|
@@ -2704,6 +2891,24 @@ loginView_decorate([
|
|
|
2704
2891
|
loginView_metadata("design:type", String)
|
|
2705
2892
|
], LoginView.prototype, "password", void 0);
|
|
2706
2893
|
|
|
2894
|
+
;// CONCATENATED MODULE: ../../libs/common/src/models/view/passwordHistoryView.ts
|
|
2895
|
+
class PasswordHistoryView {
|
|
2896
|
+
constructor(ph) {
|
|
2897
|
+
this.password = null;
|
|
2898
|
+
this.lastUsedDate = null;
|
|
2899
|
+
if (!ph) {
|
|
2900
|
+
return;
|
|
2901
|
+
}
|
|
2902
|
+
this.lastUsedDate = ph.lastUsedDate;
|
|
2903
|
+
}
|
|
2904
|
+
static fromJSON(obj) {
|
|
2905
|
+
const lastUsedDate = obj.lastUsedDate == null ? null : new Date(obj.lastUsedDate);
|
|
2906
|
+
return Object.assign(new PasswordHistoryView(), obj, {
|
|
2907
|
+
lastUsedDate: lastUsedDate,
|
|
2908
|
+
});
|
|
2909
|
+
}
|
|
2910
|
+
}
|
|
2911
|
+
|
|
2707
2912
|
;// CONCATENATED MODULE: ../../libs/common/src/models/view/secureNoteView.ts
|
|
2708
2913
|
|
|
2709
2914
|
class SecureNoteView extends ItemView {
|
|
@@ -2718,6 +2923,9 @@ class SecureNoteView extends ItemView {
|
|
|
2718
2923
|
get subTitle() {
|
|
2719
2924
|
return null;
|
|
2720
2925
|
}
|
|
2926
|
+
static fromJSON(obj) {
|
|
2927
|
+
return Object.assign(new SecureNoteView(), obj);
|
|
2928
|
+
}
|
|
2721
2929
|
}
|
|
2722
2930
|
|
|
2723
2931
|
;// CONCATENATED MODULE: ../../libs/common/src/models/view/cipherView.ts
|
|
@@ -2727,6 +2935,9 @@ class SecureNoteView extends ItemView {
|
|
|
2727
2935
|
|
|
2728
2936
|
|
|
2729
2937
|
|
|
2938
|
+
|
|
2939
|
+
|
|
2940
|
+
|
|
2730
2941
|
class CipherView {
|
|
2731
2942
|
constructor(c) {
|
|
2732
2943
|
var _a;
|
|
@@ -2834,26 +3045,38 @@ class CipherView {
|
|
|
2834
3045
|
var _a;
|
|
2835
3046
|
return (_a = this.linkedFieldOptions.get(id)) === null || _a === void 0 ? void 0 : _a.i18nKey;
|
|
2836
3047
|
}
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
3048
|
+
static fromJSON(obj) {
|
|
3049
|
+
var _a, _b, _c;
|
|
3050
|
+
const view = new CipherView();
|
|
3051
|
+
const revisionDate = obj.revisionDate == null ? null : new Date(obj.revisionDate);
|
|
3052
|
+
const deletedDate = obj.deletedDate == null ? null : new Date(obj.deletedDate);
|
|
3053
|
+
const attachments = (_a = obj.attachments) === null || _a === void 0 ? void 0 : _a.map((a) => AttachmentView.fromJSON(a));
|
|
3054
|
+
const fields = (_b = obj.fields) === null || _b === void 0 ? void 0 : _b.map((f) => FieldView.fromJSON(f));
|
|
3055
|
+
const passwordHistory = (_c = obj.passwordHistory) === null || _c === void 0 ? void 0 : _c.map((ph) => PasswordHistoryView.fromJSON(ph));
|
|
3056
|
+
Object.assign(view, obj, {
|
|
3057
|
+
revisionDate: revisionDate,
|
|
3058
|
+
deletedDate: deletedDate,
|
|
3059
|
+
attachments: attachments,
|
|
3060
|
+
fields: fields,
|
|
3061
|
+
passwordHistory: passwordHistory,
|
|
3062
|
+
});
|
|
3063
|
+
switch (obj.type) {
|
|
3064
|
+
case CipherType.Card:
|
|
3065
|
+
view.card = CardView.fromJSON(obj.card);
|
|
3066
|
+
break;
|
|
3067
|
+
case CipherType.Identity:
|
|
3068
|
+
view.identity = IdentityView.fromJSON(obj.identity);
|
|
3069
|
+
break;
|
|
3070
|
+
case CipherType.Login:
|
|
3071
|
+
view.login = LoginView.fromJSON(obj.login);
|
|
3072
|
+
break;
|
|
3073
|
+
case CipherType.SecureNote:
|
|
3074
|
+
view.secureNote = SecureNoteView.fromJSON(obj.secureNote);
|
|
3075
|
+
break;
|
|
3076
|
+
default:
|
|
3077
|
+
break;
|
|
2851
3078
|
}
|
|
2852
|
-
|
|
2853
|
-
this.linkedId = f.linkedId;
|
|
2854
|
-
}
|
|
2855
|
-
get maskedValue() {
|
|
2856
|
-
return this.value != null ? "••••••••" : null;
|
|
3079
|
+
return view;
|
|
2857
3080
|
}
|
|
2858
3081
|
}
|
|
2859
3082
|
|
|
@@ -2971,113 +3194,6 @@ class Identity extends Domain {
|
|
|
2971
3194
|
}
|
|
2972
3195
|
}
|
|
2973
3196
|
|
|
2974
|
-
;// CONCATENATED MODULE: ../../libs/common/src/models/view/loginUriView.ts
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
const CanLaunchWhitelist = [
|
|
2978
|
-
"https://",
|
|
2979
|
-
"http://",
|
|
2980
|
-
"ssh://",
|
|
2981
|
-
"ftp://",
|
|
2982
|
-
"sftp://",
|
|
2983
|
-
"irc://",
|
|
2984
|
-
"vnc://",
|
|
2985
|
-
// https://docs.microsoft.com/en-us/windows-server/remote/remote-desktop-services/clients/remote-desktop-uri
|
|
2986
|
-
"rdp://",
|
|
2987
|
-
"ms-rd:",
|
|
2988
|
-
"chrome://",
|
|
2989
|
-
"iosapp://",
|
|
2990
|
-
"androidapp://",
|
|
2991
|
-
];
|
|
2992
|
-
class LoginUriView {
|
|
2993
|
-
constructor(u) {
|
|
2994
|
-
this.match = null;
|
|
2995
|
-
this._uri = null;
|
|
2996
|
-
this._domain = null;
|
|
2997
|
-
this._hostname = null;
|
|
2998
|
-
this._host = null;
|
|
2999
|
-
this._canLaunch = null;
|
|
3000
|
-
if (!u) {
|
|
3001
|
-
return;
|
|
3002
|
-
}
|
|
3003
|
-
this.match = u.match;
|
|
3004
|
-
}
|
|
3005
|
-
get uri() {
|
|
3006
|
-
return this._uri;
|
|
3007
|
-
}
|
|
3008
|
-
set uri(value) {
|
|
3009
|
-
this._uri = value;
|
|
3010
|
-
this._domain = null;
|
|
3011
|
-
this._canLaunch = null;
|
|
3012
|
-
}
|
|
3013
|
-
get domain() {
|
|
3014
|
-
if (this._domain == null && this.uri != null) {
|
|
3015
|
-
this._domain = Utils.getDomain(this.uri);
|
|
3016
|
-
if (this._domain === "") {
|
|
3017
|
-
this._domain = null;
|
|
3018
|
-
}
|
|
3019
|
-
}
|
|
3020
|
-
return this._domain;
|
|
3021
|
-
}
|
|
3022
|
-
get hostname() {
|
|
3023
|
-
if (this.match === UriMatchType.RegularExpression) {
|
|
3024
|
-
return null;
|
|
3025
|
-
}
|
|
3026
|
-
if (this._hostname == null && this.uri != null) {
|
|
3027
|
-
this._hostname = Utils.getHostname(this.uri);
|
|
3028
|
-
if (this._hostname === "") {
|
|
3029
|
-
this._hostname = null;
|
|
3030
|
-
}
|
|
3031
|
-
}
|
|
3032
|
-
return this._hostname;
|
|
3033
|
-
}
|
|
3034
|
-
get host() {
|
|
3035
|
-
if (this.match === UriMatchType.RegularExpression) {
|
|
3036
|
-
return null;
|
|
3037
|
-
}
|
|
3038
|
-
if (this._host == null && this.uri != null) {
|
|
3039
|
-
this._host = Utils.getHost(this.uri);
|
|
3040
|
-
if (this._host === "") {
|
|
3041
|
-
this._host = null;
|
|
3042
|
-
}
|
|
3043
|
-
}
|
|
3044
|
-
return this._host;
|
|
3045
|
-
}
|
|
3046
|
-
get hostnameOrUri() {
|
|
3047
|
-
return this.hostname != null ? this.hostname : this.uri;
|
|
3048
|
-
}
|
|
3049
|
-
get hostOrUri() {
|
|
3050
|
-
return this.host != null ? this.host : this.uri;
|
|
3051
|
-
}
|
|
3052
|
-
get isWebsite() {
|
|
3053
|
-
return (this.uri != null &&
|
|
3054
|
-
(this.uri.indexOf("http://") === 0 ||
|
|
3055
|
-
this.uri.indexOf("https://") === 0 ||
|
|
3056
|
-
(this.uri.indexOf("://") < 0 && Utils.tldEndingRegex.test(this.uri))));
|
|
3057
|
-
}
|
|
3058
|
-
get canLaunch() {
|
|
3059
|
-
if (this._canLaunch != null) {
|
|
3060
|
-
return this._canLaunch;
|
|
3061
|
-
}
|
|
3062
|
-
if (this.uri != null && this.match !== UriMatchType.RegularExpression) {
|
|
3063
|
-
const uri = this.launchUri;
|
|
3064
|
-
for (let i = 0; i < CanLaunchWhitelist.length; i++) {
|
|
3065
|
-
if (uri.indexOf(CanLaunchWhitelist[i]) === 0) {
|
|
3066
|
-
this._canLaunch = true;
|
|
3067
|
-
return this._canLaunch;
|
|
3068
|
-
}
|
|
3069
|
-
}
|
|
3070
|
-
}
|
|
3071
|
-
this._canLaunch = false;
|
|
3072
|
-
return this._canLaunch;
|
|
3073
|
-
}
|
|
3074
|
-
get launchUri() {
|
|
3075
|
-
return this.uri.indexOf("://") < 0 && Utils.tldEndingRegex.test(this.uri)
|
|
3076
|
-
? "http://" + this.uri
|
|
3077
|
-
: this.uri;
|
|
3078
|
-
}
|
|
3079
|
-
}
|
|
3080
|
-
|
|
3081
3197
|
;// CONCATENATED MODULE: ../../libs/common/src/models/domain/loginUri.ts
|
|
3082
3198
|
|
|
3083
3199
|
|
|
@@ -3180,18 +3296,6 @@ class Login extends Domain {
|
|
|
3180
3296
|
}
|
|
3181
3297
|
}
|
|
3182
3298
|
|
|
3183
|
-
;// CONCATENATED MODULE: ../../libs/common/src/models/view/passwordHistoryView.ts
|
|
3184
|
-
class PasswordHistoryView {
|
|
3185
|
-
constructor(ph) {
|
|
3186
|
-
this.password = null;
|
|
3187
|
-
this.lastUsedDate = null;
|
|
3188
|
-
if (!ph) {
|
|
3189
|
-
return;
|
|
3190
|
-
}
|
|
3191
|
-
this.lastUsedDate = ph.lastUsedDate;
|
|
3192
|
-
}
|
|
3193
|
-
}
|
|
3194
|
-
|
|
3195
3299
|
;// CONCATENATED MODULE: ../../libs/common/src/models/domain/password.ts
|
|
3196
3300
|
|
|
3197
3301
|
|
|
@@ -3441,6 +3545,75 @@ class Cipher extends Domain {
|
|
|
3441
3545
|
}
|
|
3442
3546
|
}
|
|
3443
3547
|
|
|
3548
|
+
;// CONCATENATED MODULE: ../../libs/common/src/models/domain/encArrayBuffer.ts
|
|
3549
|
+
var encArrayBuffer_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3550
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3551
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
3552
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
3553
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
3554
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
3555
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
3556
|
+
});
|
|
3557
|
+
};
|
|
3558
|
+
|
|
3559
|
+
|
|
3560
|
+
const ENC_TYPE_LENGTH = 1;
|
|
3561
|
+
const IV_LENGTH = 16;
|
|
3562
|
+
const MAC_LENGTH = 32;
|
|
3563
|
+
const MIN_DATA_LENGTH = 1;
|
|
3564
|
+
class EncArrayBuffer {
|
|
3565
|
+
constructor(buffer) {
|
|
3566
|
+
this.buffer = buffer;
|
|
3567
|
+
this.encryptionType = null;
|
|
3568
|
+
this.dataBytes = null;
|
|
3569
|
+
this.ivBytes = null;
|
|
3570
|
+
this.macBytes = null;
|
|
3571
|
+
const encBytes = new Uint8Array(buffer);
|
|
3572
|
+
const encType = encBytes[0];
|
|
3573
|
+
switch (encType) {
|
|
3574
|
+
case EncryptionType.AesCbc128_HmacSha256_B64:
|
|
3575
|
+
case EncryptionType.AesCbc256_HmacSha256_B64: {
|
|
3576
|
+
const minimumLength = ENC_TYPE_LENGTH + IV_LENGTH + MAC_LENGTH + MIN_DATA_LENGTH;
|
|
3577
|
+
if (encBytes.length < minimumLength) {
|
|
3578
|
+
this.throwDecryptionError();
|
|
3579
|
+
}
|
|
3580
|
+
this.ivBytes = encBytes.slice(ENC_TYPE_LENGTH, ENC_TYPE_LENGTH + IV_LENGTH).buffer;
|
|
3581
|
+
this.macBytes = encBytes.slice(ENC_TYPE_LENGTH + IV_LENGTH, ENC_TYPE_LENGTH + IV_LENGTH + MAC_LENGTH).buffer;
|
|
3582
|
+
this.dataBytes = encBytes.slice(ENC_TYPE_LENGTH + IV_LENGTH + MAC_LENGTH).buffer;
|
|
3583
|
+
break;
|
|
3584
|
+
}
|
|
3585
|
+
case EncryptionType.AesCbc256_B64: {
|
|
3586
|
+
const minimumLength = ENC_TYPE_LENGTH + IV_LENGTH + MIN_DATA_LENGTH;
|
|
3587
|
+
if (encBytes.length < minimumLength) {
|
|
3588
|
+
this.throwDecryptionError();
|
|
3589
|
+
}
|
|
3590
|
+
this.ivBytes = encBytes.slice(ENC_TYPE_LENGTH, ENC_TYPE_LENGTH + IV_LENGTH).buffer;
|
|
3591
|
+
this.dataBytes = encBytes.slice(ENC_TYPE_LENGTH + IV_LENGTH).buffer;
|
|
3592
|
+
break;
|
|
3593
|
+
}
|
|
3594
|
+
default:
|
|
3595
|
+
this.throwDecryptionError();
|
|
3596
|
+
}
|
|
3597
|
+
this.encryptionType = encType;
|
|
3598
|
+
}
|
|
3599
|
+
throwDecryptionError() {
|
|
3600
|
+
throw new Error("Error parsing encrypted ArrayBuffer: data is corrupted or has an invalid format.");
|
|
3601
|
+
}
|
|
3602
|
+
static fromResponse(response) {
|
|
3603
|
+
return encArrayBuffer_awaiter(this, void 0, void 0, function* () {
|
|
3604
|
+
const buffer = yield response.arrayBuffer();
|
|
3605
|
+
if (buffer == null) {
|
|
3606
|
+
throw new Error("Cannot create EncArrayBuffer from Response - Response is empty");
|
|
3607
|
+
}
|
|
3608
|
+
return new EncArrayBuffer(buffer);
|
|
3609
|
+
});
|
|
3610
|
+
}
|
|
3611
|
+
static fromB64(b64) {
|
|
3612
|
+
const buffer = Utils.fromB64ToArray(b64).buffer;
|
|
3613
|
+
return new EncArrayBuffer(buffer);
|
|
3614
|
+
}
|
|
3615
|
+
}
|
|
3616
|
+
|
|
3444
3617
|
;// CONCATENATED MODULE: ../../libs/common/src/models/domain/sortedCiphersCache.ts
|
|
3445
3618
|
const CacheTTL = 3000;
|
|
3446
3619
|
class SortedCiphersCache {
|
|
@@ -3875,6 +4048,7 @@ var cipher_service_awaiter = (undefined && undefined.__awaiter) || function (thi
|
|
|
3875
4048
|
|
|
3876
4049
|
|
|
3877
4050
|
|
|
4051
|
+
|
|
3878
4052
|
|
|
3879
4053
|
|
|
3880
4054
|
const DomainMatchBlacklist = new Map([
|
|
@@ -4771,8 +4945,8 @@ class CipherService {
|
|
|
4771
4945
|
if (attachmentResponse.status !== 200) {
|
|
4772
4946
|
throw Error("Failed to download attachment: " + attachmentResponse.status.toString());
|
|
4773
4947
|
}
|
|
4774
|
-
const
|
|
4775
|
-
const decBuf = yield this.cryptoService.decryptFromBytes(
|
|
4948
|
+
const encBuf = yield EncArrayBuffer.fromResponse(attachmentResponse);
|
|
4949
|
+
const decBuf = yield this.cryptoService.decryptFromBytes(encBuf, null);
|
|
4776
4950
|
const key = yield this.cryptoService.getOrgKey(organizationId);
|
|
4777
4951
|
const encFileName = yield this.cryptoService.encrypt(attachmentView.fileName, key);
|
|
4778
4952
|
const dataEncKey = yield this.cryptoService.makeEncKey(key);
|
|
@@ -5236,10 +5410,6 @@ class ContainerService {
|
|
|
5236
5410
|
constructor(cryptoService) {
|
|
5237
5411
|
this.cryptoService = cryptoService;
|
|
5238
5412
|
}
|
|
5239
|
-
// deprecated, use attachToGlobal instead
|
|
5240
|
-
attachToWindow(win) {
|
|
5241
|
-
this.attachToGlobal(win);
|
|
5242
|
-
}
|
|
5243
5413
|
attachToGlobal(global) {
|
|
5244
5414
|
if (!global.bitwardenContainerService) {
|
|
5245
5415
|
global.bitwardenContainerService = this;
|
|
@@ -13042,17 +13212,6 @@ const EEFLongWordList = [
|
|
|
13042
13212
|
"zoom",
|
|
13043
13213
|
];
|
|
13044
13214
|
|
|
13045
|
-
;// CONCATENATED MODULE: ../../libs/common/src/models/domain/encArrayBuffer.ts
|
|
13046
|
-
class EncArrayBuffer {
|
|
13047
|
-
constructor(buffer) {
|
|
13048
|
-
this.buffer = buffer;
|
|
13049
|
-
}
|
|
13050
|
-
}
|
|
13051
|
-
|
|
13052
|
-
;// CONCATENATED MODULE: ../../libs/common/src/models/domain/encryptedObject.ts
|
|
13053
|
-
class EncryptedObject {
|
|
13054
|
-
}
|
|
13055
|
-
|
|
13056
13215
|
;// CONCATENATED MODULE: ../../libs/common/src/models/domain/encryptedOrganizationKey.ts
|
|
13057
13216
|
var encryptedOrganizationKey_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13058
13217
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -13145,8 +13304,6 @@ var crypto_service_awaiter = (undefined && undefined.__awaiter) || function (thi
|
|
|
13145
13304
|
|
|
13146
13305
|
|
|
13147
13306
|
|
|
13148
|
-
|
|
13149
|
-
|
|
13150
13307
|
class CryptoService {
|
|
13151
13308
|
constructor(cryptoFunctionService, encryptService, platformUtilService, logService, stateService) {
|
|
13152
13309
|
this.cryptoFunctionService = cryptoFunctionService;
|
|
@@ -13423,7 +13580,6 @@ class CryptoService {
|
|
|
13423
13580
|
clearKey(clearSecretStorage = true, userId) {
|
|
13424
13581
|
return crypto_service_awaiter(this, void 0, void 0, function* () {
|
|
13425
13582
|
yield this.stateService.setCryptoMasterKey(null, { userId: userId });
|
|
13426
|
-
yield this.stateService.setLegacyEtmKey(null, { userId: userId });
|
|
13427
13583
|
if (clearSecretStorage) {
|
|
13428
13584
|
yield this.clearSecretKeyStore(userId);
|
|
13429
13585
|
}
|
|
@@ -13574,7 +13730,7 @@ class CryptoService {
|
|
|
13574
13730
|
}
|
|
13575
13731
|
makeEncKey(key) {
|
|
13576
13732
|
return crypto_service_awaiter(this, void 0, void 0, function* () {
|
|
13577
|
-
const theKey = yield this.
|
|
13733
|
+
const theKey = yield this.getKeyForUserEncryption(key);
|
|
13578
13734
|
const encKey = yield this.cryptoFunctionService.randomBytes(64);
|
|
13579
13735
|
return this.buildEncKey(theKey, encKey);
|
|
13580
13736
|
});
|
|
@@ -13588,31 +13744,23 @@ class CryptoService {
|
|
|
13588
13744
|
});
|
|
13589
13745
|
}
|
|
13590
13746
|
/**
|
|
13591
|
-
* @deprecated
|
|
13592
|
-
*
|
|
13593
|
-
* This method will be removed once all existing code has been refactored to use encryptService.
|
|
13747
|
+
* @deprecated July 25 2022: Get the key you need from CryptoService (getKeyForUserEncryption or getOrgKey)
|
|
13748
|
+
* and then call encryptService.encrypt
|
|
13594
13749
|
*/
|
|
13595
13750
|
encrypt(plainValue, key) {
|
|
13596
13751
|
return crypto_service_awaiter(this, void 0, void 0, function* () {
|
|
13597
|
-
key = yield this.
|
|
13752
|
+
key = yield this.getKeyForUserEncryption(key);
|
|
13598
13753
|
return yield this.encryptService.encrypt(plainValue, key);
|
|
13599
13754
|
});
|
|
13600
13755
|
}
|
|
13756
|
+
/**
|
|
13757
|
+
* @deprecated July 25 2022: Get the key you need from CryptoService (getKeyForUserEncryption or getOrgKey)
|
|
13758
|
+
* and then call encryptService.encryptToBytes
|
|
13759
|
+
*/
|
|
13601
13760
|
encryptToBytes(plainValue, key) {
|
|
13602
13761
|
return crypto_service_awaiter(this, void 0, void 0, function* () {
|
|
13603
|
-
|
|
13604
|
-
|
|
13605
|
-
if (encValue.mac != null) {
|
|
13606
|
-
macLen = encValue.mac.byteLength;
|
|
13607
|
-
}
|
|
13608
|
-
const encBytes = new Uint8Array(1 + encValue.iv.byteLength + macLen + encValue.data.byteLength);
|
|
13609
|
-
encBytes.set([encValue.key.encType]);
|
|
13610
|
-
encBytes.set(new Uint8Array(encValue.iv), 1);
|
|
13611
|
-
if (encValue.mac != null) {
|
|
13612
|
-
encBytes.set(new Uint8Array(encValue.mac), 1 + encValue.iv.byteLength);
|
|
13613
|
-
}
|
|
13614
|
-
encBytes.set(new Uint8Array(encValue.data), 1 + encValue.iv.byteLength + macLen);
|
|
13615
|
-
return new EncArrayBuffer(encBytes.buffer);
|
|
13762
|
+
key = yield this.getKeyForUserEncryption(key);
|
|
13763
|
+
return this.encryptService.encryptToBytes(plainValue, key);
|
|
13616
13764
|
});
|
|
13617
13765
|
}
|
|
13618
13766
|
rsaEncrypt(data, publicKey) {
|
|
@@ -13677,58 +13825,37 @@ class CryptoService {
|
|
|
13677
13825
|
return this.cryptoFunctionService.rsaDecrypt(data, privateKey, alg);
|
|
13678
13826
|
});
|
|
13679
13827
|
}
|
|
13828
|
+
/**
|
|
13829
|
+
* @deprecated July 25 2022: Get the key you need from CryptoService (getKeyForUserEncryption or getOrgKey)
|
|
13830
|
+
* and then call encryptService.decryptToBytes
|
|
13831
|
+
*/
|
|
13680
13832
|
decryptToBytes(encString, key) {
|
|
13681
13833
|
return crypto_service_awaiter(this, void 0, void 0, function* () {
|
|
13682
|
-
const
|
|
13683
|
-
|
|
13684
|
-
const mac = encString.mac ? Utils.fromB64ToArray(encString.mac).buffer : null;
|
|
13685
|
-
const decipher = yield this.aesDecryptToBytes(encString.encryptionType, data, iv, mac, key);
|
|
13686
|
-
if (decipher == null) {
|
|
13687
|
-
return null;
|
|
13688
|
-
}
|
|
13689
|
-
return decipher;
|
|
13834
|
+
const keyForEnc = yield this.getKeyForUserEncryption(key);
|
|
13835
|
+
return this.encryptService.decryptToBytes(encString, keyForEnc);
|
|
13690
13836
|
});
|
|
13691
13837
|
}
|
|
13838
|
+
/**
|
|
13839
|
+
* @deprecated July 25 2022: Get the key you need from CryptoService (getKeyForUserEncryption or getOrgKey)
|
|
13840
|
+
* and then call encryptService.decryptToUtf8
|
|
13841
|
+
*/
|
|
13692
13842
|
decryptToUtf8(encString, key) {
|
|
13693
13843
|
return crypto_service_awaiter(this, void 0, void 0, function* () {
|
|
13694
|
-
key = yield this.
|
|
13695
|
-
key = yield this.resolveLegacyKey(encString.encryptionType, key);
|
|
13844
|
+
key = yield this.getKeyForUserEncryption(key);
|
|
13696
13845
|
return yield this.encryptService.decryptToUtf8(encString, key);
|
|
13697
13846
|
});
|
|
13698
13847
|
}
|
|
13699
|
-
|
|
13848
|
+
/**
|
|
13849
|
+
* @deprecated July 25 2022: Get the key you need from CryptoService (getKeyForUserEncryption or getOrgKey)
|
|
13850
|
+
* and then call encryptService.decryptToBytes
|
|
13851
|
+
*/
|
|
13852
|
+
decryptFromBytes(encBuffer, key) {
|
|
13700
13853
|
return crypto_service_awaiter(this, void 0, void 0, function* () {
|
|
13701
|
-
if (
|
|
13702
|
-
throw new Error("
|
|
13703
|
-
}
|
|
13704
|
-
const encBytes = new Uint8Array(encBuf);
|
|
13705
|
-
const encType = encBytes[0];
|
|
13706
|
-
let ctBytes = null;
|
|
13707
|
-
let ivBytes = null;
|
|
13708
|
-
let macBytes = null;
|
|
13709
|
-
switch (encType) {
|
|
13710
|
-
case EncryptionType.AesCbc128_HmacSha256_B64:
|
|
13711
|
-
case EncryptionType.AesCbc256_HmacSha256_B64:
|
|
13712
|
-
if (encBytes.length <= 49) {
|
|
13713
|
-
// 1 + 16 + 32 + ctLength
|
|
13714
|
-
return null;
|
|
13715
|
-
}
|
|
13716
|
-
ivBytes = encBytes.slice(1, 17);
|
|
13717
|
-
macBytes = encBytes.slice(17, 49);
|
|
13718
|
-
ctBytes = encBytes.slice(49);
|
|
13719
|
-
break;
|
|
13720
|
-
case EncryptionType.AesCbc256_B64:
|
|
13721
|
-
if (encBytes.length <= 17) {
|
|
13722
|
-
// 1 + 16 + ctLength
|
|
13723
|
-
return null;
|
|
13724
|
-
}
|
|
13725
|
-
ivBytes = encBytes.slice(1, 17);
|
|
13726
|
-
ctBytes = encBytes.slice(17);
|
|
13727
|
-
break;
|
|
13728
|
-
default:
|
|
13729
|
-
return null;
|
|
13854
|
+
if (encBuffer == null) {
|
|
13855
|
+
throw new Error("No buffer provided for decryption.");
|
|
13730
13856
|
}
|
|
13731
|
-
|
|
13857
|
+
key = yield this.getKeyForUserEncryption(key);
|
|
13858
|
+
return this.encryptService.decryptToBytes(encBuffer, key);
|
|
13732
13859
|
});
|
|
13733
13860
|
}
|
|
13734
13861
|
// EFForg/OpenWireless
|
|
@@ -13778,7 +13905,7 @@ class CryptoService {
|
|
|
13778
13905
|
return true;
|
|
13779
13906
|
});
|
|
13780
13907
|
}
|
|
13781
|
-
//
|
|
13908
|
+
// ---HELPERS---
|
|
13782
13909
|
storeKey(key, userId) {
|
|
13783
13910
|
return crypto_service_awaiter(this, void 0, void 0, function* () {
|
|
13784
13911
|
if (yield this.shouldStoreKey(KeySuffixOptions.Auto, userId)) {
|
|
@@ -13814,53 +13941,7 @@ class CryptoService {
|
|
|
13814
13941
|
: yield this.stateService.getCryptoMasterKeyBiometric({ userId: userId });
|
|
13815
13942
|
});
|
|
13816
13943
|
}
|
|
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
|
-
*/
|
|
13821
|
-
aesEncrypt(data, key) {
|
|
13822
|
-
return crypto_service_awaiter(this, void 0, void 0, function* () {
|
|
13823
|
-
const obj = new EncryptedObject();
|
|
13824
|
-
obj.key = yield this.getKeyForEncryption(key);
|
|
13825
|
-
obj.iv = yield this.cryptoFunctionService.randomBytes(16);
|
|
13826
|
-
obj.data = yield this.cryptoFunctionService.aesEncrypt(data, obj.iv, obj.key.encKey);
|
|
13827
|
-
if (obj.key.macKey != null) {
|
|
13828
|
-
const macData = new Uint8Array(obj.iv.byteLength + obj.data.byteLength);
|
|
13829
|
-
macData.set(new Uint8Array(obj.iv), 0);
|
|
13830
|
-
macData.set(new Uint8Array(obj.data), obj.iv.byteLength);
|
|
13831
|
-
obj.mac = yield this.cryptoFunctionService.hmac(macData.buffer, obj.key.macKey, "sha256");
|
|
13832
|
-
}
|
|
13833
|
-
return obj;
|
|
13834
|
-
});
|
|
13835
|
-
}
|
|
13836
|
-
aesDecryptToBytes(encType, data, iv, mac, key) {
|
|
13837
|
-
return crypto_service_awaiter(this, void 0, void 0, function* () {
|
|
13838
|
-
const keyForEnc = yield this.getKeyForEncryption(key);
|
|
13839
|
-
const theKey = yield this.resolveLegacyKey(encType, keyForEnc);
|
|
13840
|
-
if (theKey.macKey != null && mac == null) {
|
|
13841
|
-
return null;
|
|
13842
|
-
}
|
|
13843
|
-
if (theKey.encType !== encType) {
|
|
13844
|
-
return null;
|
|
13845
|
-
}
|
|
13846
|
-
if (theKey.macKey != null && mac != null) {
|
|
13847
|
-
const macData = new Uint8Array(iv.byteLength + data.byteLength);
|
|
13848
|
-
macData.set(new Uint8Array(iv), 0);
|
|
13849
|
-
macData.set(new Uint8Array(data), iv.byteLength);
|
|
13850
|
-
const computedMac = yield this.cryptoFunctionService.hmac(macData.buffer, theKey.macKey, "sha256");
|
|
13851
|
-
if (computedMac === null) {
|
|
13852
|
-
return null;
|
|
13853
|
-
}
|
|
13854
|
-
const macsMatch = yield this.cryptoFunctionService.compare(mac, computedMac);
|
|
13855
|
-
if (!macsMatch) {
|
|
13856
|
-
this.logService.error("mac failed.");
|
|
13857
|
-
return null;
|
|
13858
|
-
}
|
|
13859
|
-
}
|
|
13860
|
-
return yield this.cryptoFunctionService.aesDecrypt(data, iv, theKey.encKey);
|
|
13861
|
-
});
|
|
13862
|
-
}
|
|
13863
|
-
getKeyForEncryption(key) {
|
|
13944
|
+
getKeyForUserEncryption(key) {
|
|
13864
13945
|
return crypto_service_awaiter(this, void 0, void 0, function* () {
|
|
13865
13946
|
if (key != null) {
|
|
13866
13947
|
return key;
|
|
@@ -13869,24 +13950,11 @@ class CryptoService {
|
|
|
13869
13950
|
if (encKey != null) {
|
|
13870
13951
|
return encKey;
|
|
13871
13952
|
}
|
|
13953
|
+
// Legacy support: encryption used to be done with the user key (derived from master password).
|
|
13954
|
+
// Users who have not migrated will have a null encKey and must use the user key instead.
|
|
13872
13955
|
return yield this.getKey();
|
|
13873
13956
|
});
|
|
13874
13957
|
}
|
|
13875
|
-
resolveLegacyKey(encType, key) {
|
|
13876
|
-
return crypto_service_awaiter(this, void 0, void 0, function* () {
|
|
13877
|
-
if (encType === EncryptionType.AesCbc128_HmacSha256_B64 &&
|
|
13878
|
-
key.encType === EncryptionType.AesCbc256_B64) {
|
|
13879
|
-
// Old encrypt-then-mac scheme, make a new key
|
|
13880
|
-
let legacyKey = yield this.stateService.getLegacyEtmKey();
|
|
13881
|
-
if (legacyKey == null) {
|
|
13882
|
-
legacyKey = new SymmetricCryptoKey(key.key, EncryptionType.AesCbc128_HmacSha256_B64);
|
|
13883
|
-
yield this.stateService.setLegacyEtmKey(legacyKey);
|
|
13884
|
-
}
|
|
13885
|
-
return legacyKey;
|
|
13886
|
-
}
|
|
13887
|
-
return key;
|
|
13888
|
-
});
|
|
13889
|
-
}
|
|
13890
13958
|
stretchKey(key) {
|
|
13891
13959
|
return crypto_service_awaiter(this, void 0, void 0, function* () {
|
|
13892
13960
|
const newKey = new Uint8Array(64);
|
|
@@ -13994,6 +14062,10 @@ crypto_service_decorate([
|
|
|
13994
14062
|
crypto_service_metadata("design:returntype", Promise)
|
|
13995
14063
|
], CryptoService.prototype, "getProviderKeys", null);
|
|
13996
14064
|
|
|
14065
|
+
;// CONCATENATED MODULE: ../../libs/common/src/models/domain/encryptedObject.ts
|
|
14066
|
+
class EncryptedObject {
|
|
14067
|
+
}
|
|
14068
|
+
|
|
13997
14069
|
;// CONCATENATED MODULE: ../../libs/common/src/services/encrypt.service.ts
|
|
13998
14070
|
var encrypt_service_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13999
14071
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -14007,6 +14079,9 @@ var encrypt_service_awaiter = (undefined && undefined.__awaiter) || function (th
|
|
|
14007
14079
|
|
|
14008
14080
|
|
|
14009
14081
|
|
|
14082
|
+
|
|
14083
|
+
|
|
14084
|
+
|
|
14010
14085
|
class EncryptService {
|
|
14011
14086
|
constructor(cryptoFunctionService, logService, logMacFailures) {
|
|
14012
14087
|
this.cryptoFunctionService = cryptoFunctionService;
|
|
@@ -14016,7 +14091,7 @@ class EncryptService {
|
|
|
14016
14091
|
encrypt(plainValue, key) {
|
|
14017
14092
|
return encrypt_service_awaiter(this, void 0, void 0, function* () {
|
|
14018
14093
|
if (key == null) {
|
|
14019
|
-
throw new Error("
|
|
14094
|
+
throw new Error("No encryption key provided.");
|
|
14020
14095
|
}
|
|
14021
14096
|
if (plainValue == null) {
|
|
14022
14097
|
return Promise.resolve(null);
|
|
@@ -14035,9 +14110,33 @@ class EncryptService {
|
|
|
14035
14110
|
return new EncString(encObj.key.encType, data, iv, mac);
|
|
14036
14111
|
});
|
|
14037
14112
|
}
|
|
14113
|
+
encryptToBytes(plainValue, key) {
|
|
14114
|
+
return encrypt_service_awaiter(this, void 0, void 0, function* () {
|
|
14115
|
+
if (key == null) {
|
|
14116
|
+
throw new Error("No encryption key provided.");
|
|
14117
|
+
}
|
|
14118
|
+
const encValue = yield this.aesEncrypt(plainValue, key);
|
|
14119
|
+
let macLen = 0;
|
|
14120
|
+
if (encValue.mac != null) {
|
|
14121
|
+
macLen = encValue.mac.byteLength;
|
|
14122
|
+
}
|
|
14123
|
+
const encBytes = new Uint8Array(1 + encValue.iv.byteLength + macLen + encValue.data.byteLength);
|
|
14124
|
+
encBytes.set([encValue.key.encType]);
|
|
14125
|
+
encBytes.set(new Uint8Array(encValue.iv), 1);
|
|
14126
|
+
if (encValue.mac != null) {
|
|
14127
|
+
encBytes.set(new Uint8Array(encValue.mac), 1 + encValue.iv.byteLength);
|
|
14128
|
+
}
|
|
14129
|
+
encBytes.set(new Uint8Array(encValue.data), 1 + encValue.iv.byteLength + macLen);
|
|
14130
|
+
return new EncArrayBuffer(encBytes.buffer);
|
|
14131
|
+
});
|
|
14132
|
+
}
|
|
14038
14133
|
decryptToUtf8(encString, key) {
|
|
14039
14134
|
return encrypt_service_awaiter(this, void 0, void 0, function* () {
|
|
14040
|
-
if (
|
|
14135
|
+
if (key == null) {
|
|
14136
|
+
throw new Error("No key provided for decryption.");
|
|
14137
|
+
}
|
|
14138
|
+
key = this.resolveLegacyKey(key, encString);
|
|
14139
|
+
if (key.macKey != null && (encString === null || encString === void 0 ? void 0 : encString.mac) == null) {
|
|
14041
14140
|
this.logService.error("mac required.");
|
|
14042
14141
|
return null;
|
|
14043
14142
|
}
|
|
@@ -14057,6 +14156,39 @@ class EncryptService {
|
|
|
14057
14156
|
return this.cryptoFunctionService.aesDecryptFast(fastParams);
|
|
14058
14157
|
});
|
|
14059
14158
|
}
|
|
14159
|
+
decryptToBytes(encThing, key) {
|
|
14160
|
+
return encrypt_service_awaiter(this, void 0, void 0, function* () {
|
|
14161
|
+
if (key == null) {
|
|
14162
|
+
throw new Error("No encryption key provided.");
|
|
14163
|
+
}
|
|
14164
|
+
if (encThing == null) {
|
|
14165
|
+
throw new Error("Nothing provided for decryption.");
|
|
14166
|
+
}
|
|
14167
|
+
key = this.resolveLegacyKey(key, encThing);
|
|
14168
|
+
if (key.macKey != null && encThing.macBytes == null) {
|
|
14169
|
+
return null;
|
|
14170
|
+
}
|
|
14171
|
+
if (key.encType !== encThing.encryptionType) {
|
|
14172
|
+
return null;
|
|
14173
|
+
}
|
|
14174
|
+
if (key.macKey != null && encThing.macBytes != null) {
|
|
14175
|
+
const macData = new Uint8Array(encThing.ivBytes.byteLength + encThing.dataBytes.byteLength);
|
|
14176
|
+
macData.set(new Uint8Array(encThing.ivBytes), 0);
|
|
14177
|
+
macData.set(new Uint8Array(encThing.dataBytes), encThing.ivBytes.byteLength);
|
|
14178
|
+
const computedMac = yield this.cryptoFunctionService.hmac(macData.buffer, key.macKey, "sha256");
|
|
14179
|
+
if (computedMac === null) {
|
|
14180
|
+
return null;
|
|
14181
|
+
}
|
|
14182
|
+
const macsMatch = yield this.cryptoFunctionService.compare(encThing.macBytes, computedMac);
|
|
14183
|
+
if (!macsMatch) {
|
|
14184
|
+
this.logMacFailed("mac failed.");
|
|
14185
|
+
return null;
|
|
14186
|
+
}
|
|
14187
|
+
}
|
|
14188
|
+
const result = yield this.cryptoFunctionService.aesDecrypt(encThing.dataBytes, encThing.ivBytes, key.encKey);
|
|
14189
|
+
return result !== null && result !== void 0 ? result : null;
|
|
14190
|
+
});
|
|
14191
|
+
}
|
|
14060
14192
|
aesEncrypt(data, key) {
|
|
14061
14193
|
return encrypt_service_awaiter(this, void 0, void 0, function* () {
|
|
14062
14194
|
const obj = new EncryptedObject();
|
|
@@ -14077,6 +14209,17 @@ class EncryptService {
|
|
|
14077
14209
|
this.logService.error(msg);
|
|
14078
14210
|
}
|
|
14079
14211
|
}
|
|
14212
|
+
/**
|
|
14213
|
+
* Transform into new key for the old encrypt-then-mac scheme if required, otherwise return the current key unchanged
|
|
14214
|
+
* @param encThing The encrypted object (e.g. encString or encArrayBuffer) that you want to decrypt
|
|
14215
|
+
*/
|
|
14216
|
+
resolveLegacyKey(key, encThing) {
|
|
14217
|
+
if (encThing.encryptionType === EncryptionType.AesCbc128_HmacSha256_B64 &&
|
|
14218
|
+
key.encType === EncryptionType.AesCbc256_B64) {
|
|
14219
|
+
return new SymmetricCryptoKey(key.key, EncryptionType.AesCbc128_HmacSha256_B64);
|
|
14220
|
+
}
|
|
14221
|
+
return key;
|
|
14222
|
+
}
|
|
14080
14223
|
}
|
|
14081
14224
|
|
|
14082
14225
|
;// CONCATENATED MODULE: external "rxjs"
|
|
@@ -14099,7 +14242,7 @@ class EnvironmentService {
|
|
|
14099
14242
|
this.urlsSubject = new external_rxjs_namespaceObject.Subject();
|
|
14100
14243
|
this.urls = this.urlsSubject;
|
|
14101
14244
|
this.scimUrl = null;
|
|
14102
|
-
this.stateService.activeAccount
|
|
14245
|
+
this.stateService.activeAccount$.subscribe(() => environment_service_awaiter(this, void 0, void 0, function* () {
|
|
14103
14246
|
yield this.setUrlsFromStorage();
|
|
14104
14247
|
}));
|
|
14105
14248
|
}
|
|
@@ -14846,11 +14989,11 @@ var EventType;
|
|
|
14846
14989
|
EventType[EventType["OrganizationUser_AdminResetPassword"] = 1508] = "OrganizationUser_AdminResetPassword";
|
|
14847
14990
|
EventType[EventType["OrganizationUser_ResetSsoLink"] = 1509] = "OrganizationUser_ResetSsoLink";
|
|
14848
14991
|
EventType[EventType["OrganizationUser_FirstSsoLogin"] = 1510] = "OrganizationUser_FirstSsoLogin";
|
|
14849
|
-
EventType[EventType["
|
|
14850
|
-
EventType[EventType["
|
|
14992
|
+
EventType[EventType["OrganizationUser_Revoked"] = 1511] = "OrganizationUser_Revoked";
|
|
14993
|
+
EventType[EventType["OrganizationUser_Restored"] = 1512] = "OrganizationUser_Restored";
|
|
14851
14994
|
EventType[EventType["Organization_Updated"] = 1600] = "Organization_Updated";
|
|
14852
14995
|
EventType[EventType["Organization_PurgedVault"] = 1601] = "Organization_PurgedVault";
|
|
14853
|
-
|
|
14996
|
+
EventType[EventType["Organization_ClientExportedVault"] = 1602] = "Organization_ClientExportedVault";
|
|
14854
14997
|
EventType[EventType["Organization_VaultAccessed"] = 1603] = "Organization_VaultAccessed";
|
|
14855
14998
|
EventType[EventType["Organization_EnabledSso"] = 1604] = "Organization_EnabledSso";
|
|
14856
14999
|
EventType[EventType["Organization_DisabledSso"] = 1605] = "Organization_DisabledSso";
|
|
@@ -14897,11 +15040,16 @@ class FolderView {
|
|
|
14897
15040
|
this.id = f.id;
|
|
14898
15041
|
this.revisionDate = f.revisionDate;
|
|
14899
15042
|
}
|
|
15043
|
+
static fromJSON(obj) {
|
|
15044
|
+
const revisionDate = obj.revisionDate == null ? null : new Date(obj.revisionDate);
|
|
15045
|
+
return Object.assign(new FolderView(), obj, { revisionDate });
|
|
15046
|
+
}
|
|
14900
15047
|
}
|
|
14901
15048
|
|
|
14902
15049
|
;// CONCATENATED MODULE: ../../libs/common/src/models/domain/folder.ts
|
|
14903
15050
|
|
|
14904
15051
|
|
|
15052
|
+
|
|
14905
15053
|
class Folder extends Domain {
|
|
14906
15054
|
constructor(obj) {
|
|
14907
15055
|
super();
|
|
@@ -14919,6 +15067,10 @@ class Folder extends Domain {
|
|
|
14919
15067
|
name: null,
|
|
14920
15068
|
}, null);
|
|
14921
15069
|
}
|
|
15070
|
+
static fromJSON(obj) {
|
|
15071
|
+
const revisionDate = obj.revisionDate == null ? null : new Date(obj.revisionDate);
|
|
15072
|
+
return Object.assign(new Folder(), obj, { name: EncString.fromJSON(obj.name), revisionDate });
|
|
15073
|
+
}
|
|
14922
15074
|
}
|
|
14923
15075
|
|
|
14924
15076
|
;// CONCATENATED MODULE: ../../libs/common/src/models/export/folderExport.ts
|
|
@@ -15163,31 +15315,33 @@ class ExportService {
|
|
|
15163
15315
|
const decCollections = [];
|
|
15164
15316
|
const decCiphers = [];
|
|
15165
15317
|
const promises = [];
|
|
15166
|
-
promises.push(this.apiService.
|
|
15167
|
-
const
|
|
15168
|
-
if (
|
|
15169
|
-
collections
|
|
15170
|
-
|
|
15171
|
-
|
|
15172
|
-
|
|
15173
|
-
|
|
15174
|
-
|
|
15175
|
-
|
|
15176
|
-
|
|
15177
|
-
|
|
15178
|
-
|
|
15179
|
-
|
|
15180
|
-
|
|
15181
|
-
|
|
15182
|
-
.
|
|
15183
|
-
|
|
15184
|
-
|
|
15185
|
-
|
|
15186
|
-
|
|
15187
|
-
|
|
15188
|
-
|
|
15318
|
+
promises.push(this.apiService.getOrganizationExport(organizationId).then((exportData) => {
|
|
15319
|
+
const exportPromises = [];
|
|
15320
|
+
if (exportData != null) {
|
|
15321
|
+
if (exportData.collections != null &&
|
|
15322
|
+
exportData.collections.data != null &&
|
|
15323
|
+
exportData.collections.data.length > 0) {
|
|
15324
|
+
exportData.collections.data.forEach((c) => {
|
|
15325
|
+
const collection = new Collection(new CollectionData(c));
|
|
15326
|
+
exportPromises.push(collection.decrypt().then((decCol) => {
|
|
15327
|
+
decCollections.push(decCol);
|
|
15328
|
+
}));
|
|
15329
|
+
});
|
|
15330
|
+
}
|
|
15331
|
+
if (exportData.ciphers != null &&
|
|
15332
|
+
exportData.ciphers.data != null &&
|
|
15333
|
+
exportData.ciphers.data.length > 0) {
|
|
15334
|
+
exportData.ciphers.data
|
|
15335
|
+
.filter((c) => c.deletedDate === null)
|
|
15336
|
+
.forEach((c) => {
|
|
15337
|
+
const cipher = new Cipher(new CipherData(c));
|
|
15338
|
+
exportPromises.push(cipher.decrypt().then((decCipher) => {
|
|
15339
|
+
decCiphers.push(decCipher);
|
|
15340
|
+
}));
|
|
15341
|
+
});
|
|
15342
|
+
}
|
|
15189
15343
|
}
|
|
15190
|
-
return Promise.all(
|
|
15344
|
+
return Promise.all(exportPromises);
|
|
15191
15345
|
}));
|
|
15192
15346
|
yield Promise.all(promises);
|
|
15193
15347
|
if (format === "csv") {
|
|
@@ -15772,7 +15926,7 @@ class FolderService {
|
|
|
15772
15926
|
this._folderViews = new external_rxjs_namespaceObject.BehaviorSubject([]);
|
|
15773
15927
|
this.folders$ = this._folders.asObservable();
|
|
15774
15928
|
this.folderViews$ = this._folderViews.asObservable();
|
|
15775
|
-
this.stateService.activeAccountUnlocked
|
|
15929
|
+
this.stateService.activeAccountUnlocked$.subscribe((unlocked) => folder_service_awaiter(this, void 0, void 0, function* () {
|
|
15776
15930
|
if (Utils.global.bitwardenContainerService == null) {
|
|
15777
15931
|
return;
|
|
15778
15932
|
}
|
|
@@ -15985,11 +16139,8 @@ class ImportResult {
|
|
|
15985
16139
|
}
|
|
15986
16140
|
}
|
|
15987
16141
|
|
|
15988
|
-
;// CONCATENATED MODULE: external "browser-hrtime"
|
|
15989
|
-
const external_browser_hrtime_namespaceObject = require("browser-hrtime");
|
|
15990
16142
|
;// CONCATENATED MODULE: ../../libs/common/src/services/consoleLog.service.ts
|
|
15991
16143
|
|
|
15992
|
-
|
|
15993
16144
|
class consoleLog_service_ConsoleLogService {
|
|
15994
16145
|
constructor(isDev, filter = null) {
|
|
15995
16146
|
this.isDev = isDev;
|
|
@@ -16036,17 +16187,6 @@ class consoleLog_service_ConsoleLogService {
|
|
|
16036
16187
|
break;
|
|
16037
16188
|
}
|
|
16038
16189
|
}
|
|
16039
|
-
time(label = "default") {
|
|
16040
|
-
if (!this.timersMap.has(label)) {
|
|
16041
|
-
this.timersMap.set(label, external_browser_hrtime_namespaceObject());
|
|
16042
|
-
}
|
|
16043
|
-
}
|
|
16044
|
-
timeEnd(label = "default") {
|
|
16045
|
-
const elapsed = external_browser_hrtime_namespaceObject(this.timersMap.get(label));
|
|
16046
|
-
this.timersMap.delete(label);
|
|
16047
|
-
this.write(LogLevelType.Info, `${label}: ${elapsed[0] * 1000 + elapsed[1] / 10e6}ms`);
|
|
16048
|
-
return elapsed;
|
|
16049
|
-
}
|
|
16050
16190
|
}
|
|
16051
16191
|
|
|
16052
16192
|
;// CONCATENATED MODULE: ../../libs/common/src/importers/baseImporter.ts
|
|
@@ -16307,6 +16447,11 @@ class BaseImporter {
|
|
|
16307
16447
|
if (cardNum.match(re) != null) {
|
|
16308
16448
|
return "Visa";
|
|
16309
16449
|
}
|
|
16450
|
+
// Mir
|
|
16451
|
+
re = new RegExp("^220[0-4]");
|
|
16452
|
+
if (cardNum.match(re) != null) {
|
|
16453
|
+
return "Mir";
|
|
16454
|
+
}
|
|
16310
16455
|
return null;
|
|
16311
16456
|
}
|
|
16312
16457
|
setCardExpiration(cipher, expiration) {
|
|
@@ -22013,45 +22158,12 @@ var OrganizationUserStatusType;
|
|
|
22013
22158
|
OrganizationUserStatusType[OrganizationUserStatusType["Invited"] = 0] = "Invited";
|
|
22014
22159
|
OrganizationUserStatusType[OrganizationUserStatusType["Accepted"] = 1] = "Accepted";
|
|
22015
22160
|
OrganizationUserStatusType[OrganizationUserStatusType["Confirmed"] = 2] = "Confirmed";
|
|
22016
|
-
OrganizationUserStatusType[OrganizationUserStatusType["
|
|
22161
|
+
OrganizationUserStatusType[OrganizationUserStatusType["Revoked"] = -1] = "Revoked";
|
|
22017
22162
|
})(OrganizationUserStatusType || (OrganizationUserStatusType = {}));
|
|
22018
22163
|
|
|
22019
|
-
;// CONCATENATED MODULE: ../../libs/common/src/enums/permissions.ts
|
|
22020
|
-
var Permissions;
|
|
22021
|
-
(function (Permissions) {
|
|
22022
|
-
Permissions[Permissions["AccessEventLogs"] = 0] = "AccessEventLogs";
|
|
22023
|
-
Permissions[Permissions["AccessImportExport"] = 1] = "AccessImportExport";
|
|
22024
|
-
Permissions[Permissions["AccessReports"] = 2] = "AccessReports";
|
|
22025
|
-
/**
|
|
22026
|
-
* @deprecated Sep 29 2021: This permission has been split out to `createNewCollections`, `editAnyCollection`, and
|
|
22027
|
-
* `deleteAnyCollection`. It exists here for backwards compatibility with Server versions <= 1.43.0
|
|
22028
|
-
*/
|
|
22029
|
-
Permissions[Permissions["ManageAllCollections"] = 3] = "ManageAllCollections";
|
|
22030
|
-
/**
|
|
22031
|
-
* @deprecated Sep 29 2021: This permission has been split out to `editAssignedCollections` and
|
|
22032
|
-
* `deleteAssignedCollections`. It exists here for backwards compatibility with Server versions <= 1.43.0
|
|
22033
|
-
*/
|
|
22034
|
-
Permissions[Permissions["ManageAssignedCollections"] = 4] = "ManageAssignedCollections";
|
|
22035
|
-
Permissions[Permissions["ManageGroups"] = 5] = "ManageGroups";
|
|
22036
|
-
Permissions[Permissions["ManageOrganization"] = 6] = "ManageOrganization";
|
|
22037
|
-
Permissions[Permissions["ManagePolicies"] = 7] = "ManagePolicies";
|
|
22038
|
-
Permissions[Permissions["ManageProvider"] = 8] = "ManageProvider";
|
|
22039
|
-
Permissions[Permissions["ManageUsers"] = 9] = "ManageUsers";
|
|
22040
|
-
Permissions[Permissions["ManageUsersPassword"] = 10] = "ManageUsersPassword";
|
|
22041
|
-
Permissions[Permissions["CreateNewCollections"] = 11] = "CreateNewCollections";
|
|
22042
|
-
Permissions[Permissions["EditAnyCollection"] = 12] = "EditAnyCollection";
|
|
22043
|
-
Permissions[Permissions["DeleteAnyCollection"] = 13] = "DeleteAnyCollection";
|
|
22044
|
-
Permissions[Permissions["EditAssignedCollections"] = 14] = "EditAssignedCollections";
|
|
22045
|
-
Permissions[Permissions["DeleteAssignedCollections"] = 15] = "DeleteAssignedCollections";
|
|
22046
|
-
Permissions[Permissions["ManageSso"] = 16] = "ManageSso";
|
|
22047
|
-
Permissions[Permissions["ManageBilling"] = 17] = "ManageBilling";
|
|
22048
|
-
Permissions[Permissions["ManageScim"] = 18] = "ManageScim";
|
|
22049
|
-
})(Permissions || (Permissions = {}));
|
|
22050
|
-
|
|
22051
22164
|
;// CONCATENATED MODULE: ../../libs/common/src/models/domain/organization.ts
|
|
22052
22165
|
|
|
22053
22166
|
|
|
22054
|
-
|
|
22055
22167
|
class Organization {
|
|
22056
22168
|
constructor(obj) {
|
|
22057
22169
|
if (obj == null) {
|
|
@@ -22114,7 +22226,7 @@ class Organization {
|
|
|
22114
22226
|
return this.type === OrganizationUserType.Owner || this.isProviderUser;
|
|
22115
22227
|
}
|
|
22116
22228
|
get canAccessEventLogs() {
|
|
22117
|
-
return this.isAdmin || this.permissions.accessEventLogs;
|
|
22229
|
+
return (this.isAdmin || this.permissions.accessEventLogs) && this.useEvents;
|
|
22118
22230
|
}
|
|
22119
22231
|
get canAccessImportExport() {
|
|
22120
22232
|
return this.isAdmin || this.permissions.accessImportExport;
|
|
@@ -22153,16 +22265,16 @@ class Organization {
|
|
|
22153
22265
|
return this.canDeleteAssignedCollections || this.canEditAssignedCollections;
|
|
22154
22266
|
}
|
|
22155
22267
|
get canManageGroups() {
|
|
22156
|
-
return this.isAdmin || this.permissions.manageGroups;
|
|
22268
|
+
return (this.isAdmin || this.permissions.manageGroups) && this.useGroups;
|
|
22157
22269
|
}
|
|
22158
22270
|
get canManageSso() {
|
|
22159
|
-
return this.isAdmin || this.permissions.manageSso;
|
|
22271
|
+
return (this.isAdmin || this.permissions.manageSso) && this.useSso;
|
|
22160
22272
|
}
|
|
22161
22273
|
get canManageScim() {
|
|
22162
|
-
return this.isAdmin || this.permissions.manageScim;
|
|
22274
|
+
return (this.isAdmin || this.permissions.manageScim) && this.useScim;
|
|
22163
22275
|
}
|
|
22164
22276
|
get canManagePolicies() {
|
|
22165
|
-
return this.isAdmin || this.permissions.managePolicies;
|
|
22277
|
+
return (this.isAdmin || this.permissions.managePolicies) && this.usePolicies;
|
|
22166
22278
|
}
|
|
22167
22279
|
get canManageUsers() {
|
|
22168
22280
|
return this.isAdmin || this.permissions.manageUsers;
|
|
@@ -22173,27 +22285,6 @@ class Organization {
|
|
|
22173
22285
|
get isExemptFromPolicies() {
|
|
22174
22286
|
return this.canManagePolicies;
|
|
22175
22287
|
}
|
|
22176
|
-
hasAnyPermission(permissions) {
|
|
22177
|
-
const specifiedPermissions = (permissions.includes(Permissions.AccessEventLogs) && this.canAccessEventLogs) ||
|
|
22178
|
-
(permissions.includes(Permissions.AccessImportExport) && this.canAccessImportExport) ||
|
|
22179
|
-
(permissions.includes(Permissions.AccessReports) && this.canAccessReports) ||
|
|
22180
|
-
(permissions.includes(Permissions.CreateNewCollections) && this.canCreateNewCollections) ||
|
|
22181
|
-
(permissions.includes(Permissions.EditAnyCollection) && this.canEditAnyCollection) ||
|
|
22182
|
-
(permissions.includes(Permissions.DeleteAnyCollection) && this.canDeleteAnyCollection) ||
|
|
22183
|
-
(permissions.includes(Permissions.EditAssignedCollections) &&
|
|
22184
|
-
this.canEditAssignedCollections) ||
|
|
22185
|
-
(permissions.includes(Permissions.DeleteAssignedCollections) &&
|
|
22186
|
-
this.canDeleteAssignedCollections) ||
|
|
22187
|
-
(permissions.includes(Permissions.ManageGroups) && this.canManageGroups) ||
|
|
22188
|
-
(permissions.includes(Permissions.ManageOrganization) && this.isOwner) ||
|
|
22189
|
-
(permissions.includes(Permissions.ManagePolicies) && this.canManagePolicies) ||
|
|
22190
|
-
(permissions.includes(Permissions.ManageUsers) && this.canManageUsers) ||
|
|
22191
|
-
(permissions.includes(Permissions.ManageUsersPassword) && this.canManageUsersPassword) ||
|
|
22192
|
-
(permissions.includes(Permissions.ManageSso) && this.canManageSso) ||
|
|
22193
|
-
(permissions.includes(Permissions.ManageScim) && this.canManageScim) ||
|
|
22194
|
-
(permissions.includes(Permissions.ManageBilling) && this.canManageBilling);
|
|
22195
|
-
return specifiedPermissions && (this.enabled || this.isOwner);
|
|
22196
|
-
}
|
|
22197
22288
|
get canManageBilling() {
|
|
22198
22289
|
return this.isOwner && (this.isProviderUser || !this.hasProvider);
|
|
22199
22290
|
}
|
|
@@ -22883,7 +22974,7 @@ class ResetPasswordPolicyOptions extends Domain {
|
|
|
22883
22974
|
}
|
|
22884
22975
|
}
|
|
22885
22976
|
|
|
22886
|
-
;// CONCATENATED MODULE: ../../libs/common/src/services/policy.service.ts
|
|
22977
|
+
;// CONCATENATED MODULE: ../../libs/common/src/services/policy/policy.service.ts
|
|
22887
22978
|
var policy_service_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
22888
22979
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
22889
22980
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -22901,15 +22992,9 @@ var policy_service_awaiter = (undefined && undefined.__awaiter) || function (thi
|
|
|
22901
22992
|
|
|
22902
22993
|
|
|
22903
22994
|
class PolicyService {
|
|
22904
|
-
constructor(stateService, organizationService
|
|
22995
|
+
constructor(stateService, organizationService) {
|
|
22905
22996
|
this.stateService = stateService;
|
|
22906
22997
|
this.organizationService = organizationService;
|
|
22907
|
-
this.apiService = apiService;
|
|
22908
|
-
}
|
|
22909
|
-
clearCache() {
|
|
22910
|
-
return policy_service_awaiter(this, void 0, void 0, function* () {
|
|
22911
|
-
yield this.stateService.setDecryptedPolicies(null);
|
|
22912
|
-
});
|
|
22913
22998
|
}
|
|
22914
22999
|
getAll(type, userId) {
|
|
22915
23000
|
return policy_service_awaiter(this, void 0, void 0, function* () {
|
|
@@ -22936,41 +23021,6 @@ class PolicyService {
|
|
|
22936
23021
|
}
|
|
22937
23022
|
});
|
|
22938
23023
|
}
|
|
22939
|
-
getPolicyForOrganization(policyType, organizationId) {
|
|
22940
|
-
return policy_service_awaiter(this, void 0, void 0, function* () {
|
|
22941
|
-
const org = yield this.organizationService.get(organizationId);
|
|
22942
|
-
if (org === null || org === void 0 ? void 0 : org.isProviderUser) {
|
|
22943
|
-
const orgPolicies = yield this.apiService.getPolicies(organizationId);
|
|
22944
|
-
const policy = orgPolicies.data.find((p) => p.organizationId === organizationId);
|
|
22945
|
-
if (policy == null) {
|
|
22946
|
-
return null;
|
|
22947
|
-
}
|
|
22948
|
-
return new Policy(new PolicyData(policy));
|
|
22949
|
-
}
|
|
22950
|
-
const policies = yield this.getAll(policyType);
|
|
22951
|
-
return policies.find((p) => p.organizationId === organizationId);
|
|
22952
|
-
});
|
|
22953
|
-
}
|
|
22954
|
-
replace(policies) {
|
|
22955
|
-
return policy_service_awaiter(this, void 0, void 0, function* () {
|
|
22956
|
-
yield this.stateService.setDecryptedPolicies(null);
|
|
22957
|
-
yield this.stateService.setEncryptedPolicies(policies);
|
|
22958
|
-
});
|
|
22959
|
-
}
|
|
22960
|
-
clear(userId) {
|
|
22961
|
-
return policy_service_awaiter(this, void 0, void 0, function* () {
|
|
22962
|
-
yield this.stateService.setDecryptedPolicies(null, { userId: userId });
|
|
22963
|
-
yield this.stateService.setEncryptedPolicies(null, { userId: userId });
|
|
22964
|
-
});
|
|
22965
|
-
}
|
|
22966
|
-
getMasterPasswordPoliciesForInvitedUsers(orgId) {
|
|
22967
|
-
return policy_service_awaiter(this, void 0, void 0, function* () {
|
|
22968
|
-
const userId = yield this.stateService.getUserId();
|
|
22969
|
-
const response = yield this.apiService.getPoliciesByInvitedUser(orgId, userId);
|
|
22970
|
-
const policies = yield this.mapPoliciesFromToken(response);
|
|
22971
|
-
return this.getMasterPasswordPolicyOptions(policies);
|
|
22972
|
-
});
|
|
22973
|
-
}
|
|
22974
23024
|
getMasterPasswordPolicyOptions(policies) {
|
|
22975
23025
|
return policy_service_awaiter(this, void 0, void 0, function* () {
|
|
22976
23026
|
let enforcedOptions = null;
|
|
@@ -23077,6 +23127,29 @@ class PolicyService {
|
|
|
23077
23127
|
policySet.has(o.id));
|
|
23078
23128
|
});
|
|
23079
23129
|
}
|
|
23130
|
+
upsert(policy) {
|
|
23131
|
+
return policy_service_awaiter(this, void 0, void 0, function* () {
|
|
23132
|
+
let policies = yield this.stateService.getEncryptedPolicies();
|
|
23133
|
+
if (policies == null) {
|
|
23134
|
+
policies = {};
|
|
23135
|
+
}
|
|
23136
|
+
policies[policy.id] = policy;
|
|
23137
|
+
yield this.stateService.setDecryptedPolicies(null);
|
|
23138
|
+
yield this.stateService.setEncryptedPolicies(policies);
|
|
23139
|
+
});
|
|
23140
|
+
}
|
|
23141
|
+
replace(policies) {
|
|
23142
|
+
return policy_service_awaiter(this, void 0, void 0, function* () {
|
|
23143
|
+
yield this.stateService.setDecryptedPolicies(null);
|
|
23144
|
+
yield this.stateService.setEncryptedPolicies(policies);
|
|
23145
|
+
});
|
|
23146
|
+
}
|
|
23147
|
+
clear(userId) {
|
|
23148
|
+
return policy_service_awaiter(this, void 0, void 0, function* () {
|
|
23149
|
+
yield this.stateService.setDecryptedPolicies(null, { userId: userId });
|
|
23150
|
+
yield this.stateService.setEncryptedPolicies(null, { userId: userId });
|
|
23151
|
+
});
|
|
23152
|
+
}
|
|
23080
23153
|
isExcemptFromPolicies(organization, policyType) {
|
|
23081
23154
|
if (policyType === PolicyType.MaximumVaultTimeout) {
|
|
23082
23155
|
return organization.type === OrganizationUserType.Owner;
|
|
@@ -23091,7 +23164,7 @@ var ProviderUserStatusType;
|
|
|
23091
23164
|
ProviderUserStatusType[ProviderUserStatusType["Invited"] = 0] = "Invited";
|
|
23092
23165
|
ProviderUserStatusType[ProviderUserStatusType["Accepted"] = 1] = "Accepted";
|
|
23093
23166
|
ProviderUserStatusType[ProviderUserStatusType["Confirmed"] = 2] = "Confirmed";
|
|
23094
|
-
ProviderUserStatusType[ProviderUserStatusType["
|
|
23167
|
+
ProviderUserStatusType[ProviderUserStatusType["Revoked"] = -1] = "Revoked";
|
|
23095
23168
|
})(ProviderUserStatusType || (ProviderUserStatusType = {}));
|
|
23096
23169
|
|
|
23097
23170
|
;// CONCATENATED MODULE: ../../libs/common/src/enums/providerUserType.ts
|
|
@@ -23217,8 +23290,13 @@ class SearchService {
|
|
|
23217
23290
|
this.searchableMinLength = this.defaultSearchableMinLength;
|
|
23218
23291
|
}
|
|
23219
23292
|
});
|
|
23220
|
-
//register
|
|
23221
|
-
|
|
23293
|
+
// Currently have to ensure this is only done a single time. Lunr allows you to register a function
|
|
23294
|
+
// multiple times but they will add a warning message to the console. The way they do that breaks when ran on a service worker.
|
|
23295
|
+
if (!SearchService.registeredPipeline) {
|
|
23296
|
+
SearchService.registeredPipeline = true;
|
|
23297
|
+
//register lunr pipeline function
|
|
23298
|
+
external_lunr_namespaceObject.Pipeline.registerFunction(this.normalizeAccentsPipelineFunction, "normalizeAccents");
|
|
23299
|
+
}
|
|
23222
23300
|
}
|
|
23223
23301
|
clearIndex() {
|
|
23224
23302
|
this.indexedEntityId = null;
|
|
@@ -23236,7 +23314,6 @@ class SearchService {
|
|
|
23236
23314
|
if (this.indexing) {
|
|
23237
23315
|
return;
|
|
23238
23316
|
}
|
|
23239
|
-
this.logService.time("search indexing");
|
|
23240
23317
|
this.indexing = true;
|
|
23241
23318
|
this.indexedEntityId = indexedEntityId;
|
|
23242
23319
|
this.index = null;
|
|
@@ -23274,7 +23351,7 @@ class SearchService {
|
|
|
23274
23351
|
ciphers.forEach((c) => builder.add(c));
|
|
23275
23352
|
this.index = builder.build();
|
|
23276
23353
|
this.indexing = false;
|
|
23277
|
-
this.logService.
|
|
23354
|
+
this.logService.info("Finished search indexing");
|
|
23278
23355
|
});
|
|
23279
23356
|
}
|
|
23280
23357
|
searchCiphers(query, filter = null, ciphers = null) {
|
|
@@ -23360,7 +23437,7 @@ class SearchService {
|
|
|
23360
23437
|
}
|
|
23361
23438
|
if (c.login &&
|
|
23362
23439
|
c.login.hasUris &&
|
|
23363
|
-
c.login.uris.some((loginUri) => loginUri.uri.toLowerCase().indexOf(query) > -1)) {
|
|
23440
|
+
c.login.uris.some((loginUri) => { var _a; return ((_a = loginUri === null || loginUri === void 0 ? void 0 : loginUri.uri) === null || _a === void 0 ? void 0 : _a.toLowerCase().indexOf(query)) > -1; })) {
|
|
23364
23441
|
return true;
|
|
23365
23442
|
}
|
|
23366
23443
|
return false;
|
|
@@ -23481,6 +23558,7 @@ class SearchService {
|
|
|
23481
23558
|
return query === null || query === void 0 ? void 0 : query.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
|
|
23482
23559
|
}
|
|
23483
23560
|
}
|
|
23561
|
+
SearchService.registeredPipeline = false;
|
|
23484
23562
|
|
|
23485
23563
|
;// CONCATENATED MODULE: ../../libs/common/src/enums/sendType.ts
|
|
23486
23564
|
var SendType;
|
|
@@ -24290,23 +24368,25 @@ class StateService {
|
|
|
24290
24368
|
this.stateFactory = stateFactory;
|
|
24291
24369
|
this.useAccountCache = useAccountCache;
|
|
24292
24370
|
this.accounts = new external_rxjs_namespaceObject.BehaviorSubject({});
|
|
24293
|
-
this.
|
|
24294
|
-
this.
|
|
24371
|
+
this.activeAccountSubject = new external_rxjs_namespaceObject.BehaviorSubject(null);
|
|
24372
|
+
this.activeAccount$ = this.activeAccountSubject.asObservable();
|
|
24373
|
+
this.activeAccountUnlockedSubject = new external_rxjs_namespaceObject.BehaviorSubject(false);
|
|
24374
|
+
this.activeAccountUnlocked$ = this.activeAccountUnlockedSubject.asObservable();
|
|
24295
24375
|
this.hasBeenInited = false;
|
|
24296
24376
|
this.isRecoveredSession = false;
|
|
24297
24377
|
this.accountDiskCache = new Map();
|
|
24298
24378
|
// If the account gets changed, verify the new account is unlocked
|
|
24299
|
-
this.
|
|
24300
|
-
if (userId == null && this.
|
|
24379
|
+
this.activeAccountSubject.subscribe((userId) => state_service_awaiter(this, void 0, void 0, function* () {
|
|
24380
|
+
if (userId == null && this.activeAccountUnlockedSubject.getValue() == false) {
|
|
24301
24381
|
return;
|
|
24302
24382
|
}
|
|
24303
24383
|
else if (userId == null) {
|
|
24304
|
-
this.
|
|
24384
|
+
this.activeAccountUnlockedSubject.next(false);
|
|
24305
24385
|
}
|
|
24306
24386
|
// FIXME: This should be refactored into AuthService or a similar service,
|
|
24307
24387
|
// as checking for the existance of the crypto key is a low level
|
|
24308
24388
|
// implementation detail.
|
|
24309
|
-
this.
|
|
24389
|
+
this.activeAccountUnlockedSubject.next((yield this.getCryptoMasterKey()) != null);
|
|
24310
24390
|
}));
|
|
24311
24391
|
}
|
|
24312
24392
|
init() {
|
|
@@ -24348,7 +24428,7 @@ class StateService {
|
|
|
24348
24428
|
state.activeUserId = storedActiveUser;
|
|
24349
24429
|
}
|
|
24350
24430
|
yield this.pushAccounts();
|
|
24351
|
-
this.
|
|
24431
|
+
this.activeAccountSubject.next(state.activeUserId);
|
|
24352
24432
|
return state;
|
|
24353
24433
|
}));
|
|
24354
24434
|
});
|
|
@@ -24378,7 +24458,7 @@ class StateService {
|
|
|
24378
24458
|
yield this.scaffoldNewAccountStorage(account);
|
|
24379
24459
|
yield this.setLastActive(new Date().getTime(), { userId: account.profile.userId });
|
|
24380
24460
|
yield this.setActiveUser(account.profile.userId);
|
|
24381
|
-
this.
|
|
24461
|
+
this.activeAccountSubject.next(account.profile.userId);
|
|
24382
24462
|
});
|
|
24383
24463
|
}
|
|
24384
24464
|
setActiveUser(userId) {
|
|
@@ -24387,7 +24467,7 @@ class StateService {
|
|
|
24387
24467
|
yield this.updateState((state) => state_service_awaiter(this, void 0, void 0, function* () {
|
|
24388
24468
|
state.activeUserId = userId;
|
|
24389
24469
|
yield this.storageService.save(keys.activeUserId, userId);
|
|
24390
|
-
this.
|
|
24470
|
+
this.activeAccountSubject.next(state.activeUserId);
|
|
24391
24471
|
return state;
|
|
24392
24472
|
}));
|
|
24393
24473
|
yield this.pushAccounts();
|
|
@@ -24529,19 +24609,6 @@ class StateService {
|
|
|
24529
24609
|
yield this.saveGlobals(globals, this.reconcileOptions(options, yield this.defaultOnDiskOptions()));
|
|
24530
24610
|
});
|
|
24531
24611
|
}
|
|
24532
|
-
getBiometricLocked(options) {
|
|
24533
|
-
var _a, _b, _c;
|
|
24534
|
-
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
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);
|
|
24536
|
-
});
|
|
24537
|
-
}
|
|
24538
|
-
setBiometricLocked(value, options) {
|
|
24539
|
-
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
24540
|
-
const account = yield this.getAccount(this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
24541
|
-
account.settings.biometricLocked = value;
|
|
24542
|
-
yield this.saveAccount(account, this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
24543
|
-
});
|
|
24544
|
-
}
|
|
24545
24612
|
getBiometricText(options) {
|
|
24546
24613
|
var _a;
|
|
24547
24614
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
@@ -24670,11 +24737,11 @@ class StateService {
|
|
|
24670
24737
|
const account = yield this.getAccount(this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
24671
24738
|
account.keys.cryptoMasterKey = value;
|
|
24672
24739
|
yield this.saveAccount(account, this.reconcileOptions(options, yield this.defaultInMemoryOptions()));
|
|
24673
|
-
if (options.userId == this.
|
|
24740
|
+
if (options.userId == this.activeAccountSubject.getValue()) {
|
|
24674
24741
|
const nextValue = value != null;
|
|
24675
24742
|
// Avoid emitting if we are already unlocked
|
|
24676
|
-
if (this.
|
|
24677
|
-
this.
|
|
24743
|
+
if (this.activeAccountUnlockedSubject.getValue() != nextValue) {
|
|
24744
|
+
this.activeAccountUnlockedSubject.next(nextValue);
|
|
24678
24745
|
}
|
|
24679
24746
|
}
|
|
24680
24747
|
});
|
|
@@ -25543,19 +25610,6 @@ class StateService {
|
|
|
25543
25610
|
yield this.saveAccount(account, this.reconcileOptions(options, yield this.defaultOnDiskMemoryOptions()));
|
|
25544
25611
|
});
|
|
25545
25612
|
}
|
|
25546
|
-
getLegacyEtmKey(options) {
|
|
25547
|
-
var _a, _b;
|
|
25548
|
-
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
25549
|
-
return (_b = (_a = (yield this.getAccount(this.reconcileOptions(options, yield this.defaultOnDiskOptions())))) === null || _a === void 0 ? void 0 : _a.keys) === null || _b === void 0 ? void 0 : _b.legacyEtmKey;
|
|
25550
|
-
});
|
|
25551
|
-
}
|
|
25552
|
-
setLegacyEtmKey(value, options) {
|
|
25553
|
-
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
25554
|
-
const account = yield this.getAccount(this.reconcileOptions(options, yield this.defaultOnDiskOptions()));
|
|
25555
|
-
account.keys.legacyEtmKey = value;
|
|
25556
|
-
yield this.saveAccount(account, this.reconcileOptions(options, yield this.defaultOnDiskOptions()));
|
|
25557
|
-
});
|
|
25558
|
-
}
|
|
25559
25613
|
getLocalData(options) {
|
|
25560
25614
|
var _a, _b;
|
|
25561
25615
|
return state_service_awaiter(this, void 0, void 0, function* () {
|
|
@@ -26409,13 +26463,13 @@ class StateService {
|
|
|
26409
26463
|
}
|
|
26410
26464
|
}
|
|
26411
26465
|
state_service_decorate([
|
|
26412
|
-
withPrototype(SymmetricCryptoKey, SymmetricCryptoKey.
|
|
26466
|
+
withPrototype(SymmetricCryptoKey, SymmetricCryptoKey.fromJSON),
|
|
26413
26467
|
state_service_metadata("design:type", Function),
|
|
26414
26468
|
state_service_metadata("design:paramtypes", [Object]),
|
|
26415
26469
|
state_service_metadata("design:returntype", Promise)
|
|
26416
26470
|
], StateService.prototype, "getCryptoMasterKey", null);
|
|
26417
26471
|
state_service_decorate([
|
|
26418
|
-
withPrototypeForArrayMembers(CipherView),
|
|
26472
|
+
withPrototypeForArrayMembers(CipherView, CipherView.fromJSON),
|
|
26419
26473
|
state_service_metadata("design:type", Function),
|
|
26420
26474
|
state_service_metadata("design:paramtypes", [Object]),
|
|
26421
26475
|
state_service_metadata("design:returntype", Promise)
|
|
@@ -26427,13 +26481,13 @@ state_service_decorate([
|
|
|
26427
26481
|
state_service_metadata("design:returntype", Promise)
|
|
26428
26482
|
], StateService.prototype, "getDecryptedCollections", null);
|
|
26429
26483
|
state_service_decorate([
|
|
26430
|
-
withPrototype(SymmetricCryptoKey, SymmetricCryptoKey.
|
|
26484
|
+
withPrototype(SymmetricCryptoKey, SymmetricCryptoKey.fromJSON),
|
|
26431
26485
|
state_service_metadata("design:type", Function),
|
|
26432
26486
|
state_service_metadata("design:paramtypes", [Object]),
|
|
26433
26487
|
state_service_metadata("design:returntype", Promise)
|
|
26434
26488
|
], StateService.prototype, "getDecryptedCryptoSymmetricKey", null);
|
|
26435
26489
|
state_service_decorate([
|
|
26436
|
-
withPrototypeForMap(SymmetricCryptoKey, SymmetricCryptoKey.
|
|
26490
|
+
withPrototypeForMap(SymmetricCryptoKey, SymmetricCryptoKey.fromJSON),
|
|
26437
26491
|
state_service_metadata("design:type", Function),
|
|
26438
26492
|
state_service_metadata("design:paramtypes", [Object]),
|
|
26439
26493
|
state_service_metadata("design:returntype", Promise)
|
|
@@ -26457,7 +26511,7 @@ state_service_decorate([
|
|
|
26457
26511
|
state_service_metadata("design:returntype", Promise)
|
|
26458
26512
|
], StateService.prototype, "getDecryptedPolicies", null);
|
|
26459
26513
|
state_service_decorate([
|
|
26460
|
-
withPrototypeForMap(SymmetricCryptoKey, SymmetricCryptoKey.
|
|
26514
|
+
withPrototypeForMap(SymmetricCryptoKey, SymmetricCryptoKey.fromJSON),
|
|
26461
26515
|
state_service_metadata("design:type", Function),
|
|
26462
26516
|
state_service_metadata("design:paramtypes", [Object]),
|
|
26463
26517
|
state_service_metadata("design:returntype", Promise)
|
|
@@ -26516,12 +26570,6 @@ state_service_decorate([
|
|
|
26516
26570
|
state_service_metadata("design:paramtypes", [Object]),
|
|
26517
26571
|
state_service_metadata("design:returntype", Promise)
|
|
26518
26572
|
], 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
26573
|
state_service_decorate([
|
|
26526
26574
|
withPrototypeForObjectValues(ProviderData),
|
|
26527
26575
|
state_service_metadata("design:type", Function),
|
|
@@ -26984,6 +27032,15 @@ class StateMigrationService {
|
|
|
26984
27032
|
yield this.setCurrentStateVersion(StateVersion.Five);
|
|
26985
27033
|
break;
|
|
26986
27034
|
}
|
|
27035
|
+
case StateVersion.Five: {
|
|
27036
|
+
const authenticatedAccounts = yield this.getAuthenticatedAccounts();
|
|
27037
|
+
for (const account of authenticatedAccounts) {
|
|
27038
|
+
const migratedAccount = yield this.migrateAccountFrom5To6(account);
|
|
27039
|
+
yield this.set(account.profile.userId, migratedAccount);
|
|
27040
|
+
}
|
|
27041
|
+
yield this.setCurrentStateVersion(StateVersion.Six);
|
|
27042
|
+
break;
|
|
27043
|
+
}
|
|
26987
27044
|
}
|
|
26988
27045
|
currentStateVersion += 1;
|
|
26989
27046
|
}
|
|
@@ -27054,7 +27111,6 @@ class StateMigrationService {
|
|
|
27054
27111
|
const accountSettings = {
|
|
27055
27112
|
autoConfirmFingerPrints: (_y = (yield this.get(v1Keys.autoConfirmFingerprints))) !== null && _y !== void 0 ? _y : defaultAccount.settings.autoConfirmFingerPrints,
|
|
27056
27113
|
autoFillOnPageLoadDefault: (_z = (yield this.get(v1Keys.autoFillOnPageLoadDefault))) !== null && _z !== void 0 ? _z : defaultAccount.settings.autoFillOnPageLoadDefault,
|
|
27057
|
-
biometricLocked: null,
|
|
27058
27114
|
biometricUnlock: (_0 = (yield this.get(v1Keys.biometricUnlock))) !== null && _0 !== void 0 ? _0 : defaultAccount.settings.biometricUnlock,
|
|
27059
27115
|
clearClipboard: (_1 = (yield this.get(v1Keys.clearClipboard))) !== null && _1 !== void 0 ? _1 : defaultAccount.settings.clearClipboard,
|
|
27060
27116
|
defaultUriMatch: (_2 = (yield this.get(v1Keys.defaultUriMatch))) !== null && _2 !== void 0 ? _2 : defaultAccount.settings.defaultUriMatch,
|
|
@@ -27253,6 +27309,13 @@ class StateMigrationService {
|
|
|
27253
27309
|
return account;
|
|
27254
27310
|
});
|
|
27255
27311
|
}
|
|
27312
|
+
migrateAccountFrom5To6(account) {
|
|
27313
|
+
var _a;
|
|
27314
|
+
return stateMigration_service_awaiter(this, void 0, void 0, function* () {
|
|
27315
|
+
(_a = account.keys) === null || _a === void 0 ? true : delete _a.legacyEtmKey;
|
|
27316
|
+
return account;
|
|
27317
|
+
});
|
|
27318
|
+
}
|
|
27256
27319
|
get options() {
|
|
27257
27320
|
return { htmlStorageLocation: HtmlStorageLocation.Local };
|
|
27258
27321
|
}
|
|
@@ -28031,6 +28094,30 @@ class TwoFactorService {
|
|
|
28031
28094
|
}
|
|
28032
28095
|
}
|
|
28033
28096
|
|
|
28097
|
+
;// CONCATENATED MODULE: ../../libs/common/src/services/userVerification/userVerification-api.service.ts
|
|
28098
|
+
var userVerification_api_service_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
28099
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
28100
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28101
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
28102
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
28103
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
28104
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28105
|
+
});
|
|
28106
|
+
};
|
|
28107
|
+
class UserVerificationApiService {
|
|
28108
|
+
constructor(apiService) {
|
|
28109
|
+
this.apiService = apiService;
|
|
28110
|
+
}
|
|
28111
|
+
postAccountVerifyOTP(request) {
|
|
28112
|
+
return this.apiService.send("POST", "/accounts/verify-otp", request, true, false);
|
|
28113
|
+
}
|
|
28114
|
+
postAccountRequestOTP() {
|
|
28115
|
+
return userVerification_api_service_awaiter(this, void 0, void 0, function* () {
|
|
28116
|
+
return this.apiService.send("POST", "/accounts/request-otp", null, true, false);
|
|
28117
|
+
});
|
|
28118
|
+
}
|
|
28119
|
+
}
|
|
28120
|
+
|
|
28034
28121
|
;// CONCATENATED MODULE: ../../libs/common/src/enums/verificationType.ts
|
|
28035
28122
|
var VerificationType;
|
|
28036
28123
|
(function (VerificationType) {
|
|
@@ -28049,7 +28136,7 @@ class VerifyOTPRequest {
|
|
|
28049
28136
|
class SecretVerificationRequest {
|
|
28050
28137
|
}
|
|
28051
28138
|
|
|
28052
|
-
;// CONCATENATED MODULE: ../../libs/common/src/services/userVerification.service.ts
|
|
28139
|
+
;// CONCATENATED MODULE: ../../libs/common/src/services/userVerification/userVerification.service.ts
|
|
28053
28140
|
var userVerification_service_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
28054
28141
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
28055
28142
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -28067,10 +28154,10 @@ var userVerification_service_awaiter = (undefined && undefined.__awaiter) || fun
|
|
|
28067
28154
|
* Use it to verify the input collected by UserVerificationComponent.
|
|
28068
28155
|
*/
|
|
28069
28156
|
class UserVerificationService {
|
|
28070
|
-
constructor(cryptoService, i18nService,
|
|
28157
|
+
constructor(cryptoService, i18nService, userVerificationApiService) {
|
|
28071
28158
|
this.cryptoService = cryptoService;
|
|
28072
28159
|
this.i18nService = i18nService;
|
|
28073
|
-
this.
|
|
28160
|
+
this.userVerificationApiService = userVerificationApiService;
|
|
28074
28161
|
}
|
|
28075
28162
|
/**
|
|
28076
28163
|
* Create a new request model to be used for server-side verification
|
|
@@ -28104,7 +28191,7 @@ class UserVerificationService {
|
|
|
28104
28191
|
if (verification.type === VerificationType.OTP) {
|
|
28105
28192
|
const request = new VerifyOTPRequest(verification.secret);
|
|
28106
28193
|
try {
|
|
28107
|
-
yield this.
|
|
28194
|
+
yield this.userVerificationApiService.postAccountVerifyOTP(request);
|
|
28108
28195
|
}
|
|
28109
28196
|
catch (e) {
|
|
28110
28197
|
throw new Error(this.i18nService.t("invalidVerificationCode"));
|
|
@@ -28121,7 +28208,7 @@ class UserVerificationService {
|
|
|
28121
28208
|
}
|
|
28122
28209
|
requestOTP() {
|
|
28123
28210
|
return userVerification_service_awaiter(this, void 0, void 0, function* () {
|
|
28124
|
-
yield this.
|
|
28211
|
+
yield this.userVerificationApiService.postAccountRequestOTP();
|
|
28125
28212
|
});
|
|
28126
28213
|
}
|
|
28127
28214
|
validateInput(verification) {
|
|
@@ -28209,7 +28296,6 @@ class VaultTimeoutService {
|
|
|
28209
28296
|
yield this.folderService.clearCache();
|
|
28210
28297
|
}
|
|
28211
28298
|
yield this.stateService.setEverBeenUnlocked(true, { userId: userId });
|
|
28212
|
-
yield this.stateService.setBiometricLocked(true, { userId: userId });
|
|
28213
28299
|
yield this.stateService.setCryptoMasterKeyAuto(null, { userId: userId });
|
|
28214
28300
|
yield this.cryptoService.clearKey(false, userId);
|
|
28215
28301
|
yield this.cryptoService.clearOrgKeys(true, userId);
|
|
@@ -29073,6 +29159,16 @@ class OrganizationConnectionResponse extends BaseResponse {
|
|
|
29073
29159
|
}
|
|
29074
29160
|
}
|
|
29075
29161
|
|
|
29162
|
+
;// CONCATENATED MODULE: ../../libs/common/src/models/response/organizationExportResponse.ts
|
|
29163
|
+
|
|
29164
|
+
class OrganizationExportResponse extends BaseResponse {
|
|
29165
|
+
constructor(response) {
|
|
29166
|
+
super(response);
|
|
29167
|
+
this.collections = this.getResponseProperty("Collections");
|
|
29168
|
+
this.ciphers = this.getResponseProperty("Ciphers");
|
|
29169
|
+
}
|
|
29170
|
+
}
|
|
29171
|
+
|
|
29076
29172
|
;// CONCATENATED MODULE: ../../libs/common/src/models/response/keysResponse.ts
|
|
29077
29173
|
|
|
29078
29174
|
class KeysResponse extends BaseResponse {
|
|
@@ -29528,6 +29624,9 @@ class ProviderOrganizationResponse extends BaseResponse {
|
|
|
29528
29624
|
this.settings = this.getResponseProperty("Settings");
|
|
29529
29625
|
this.creationDate = this.getResponseProperty("CreationDate");
|
|
29530
29626
|
this.revisionDate = this.getResponseProperty("RevisionDate");
|
|
29627
|
+
this.userCount = this.getResponseProperty("UserCount");
|
|
29628
|
+
this.seats = this.getResponseProperty("Seats");
|
|
29629
|
+
this.plan = this.getResponseProperty("Plan");
|
|
29531
29630
|
}
|
|
29532
29631
|
}
|
|
29533
29632
|
class ProviderOrganizationOrganizationDetailsResponse extends ProviderOrganizationResponse {
|
|
@@ -29939,6 +30038,7 @@ var api_service_awaiter = (undefined && undefined.__awaiter) || function (thisAr
|
|
|
29939
30038
|
|
|
29940
30039
|
|
|
29941
30040
|
|
|
30041
|
+
|
|
29942
30042
|
|
|
29943
30043
|
|
|
29944
30044
|
class ApiService {
|
|
@@ -30076,9 +30176,6 @@ class ApiService {
|
|
|
30076
30176
|
postSecurityStamp(request) {
|
|
30077
30177
|
return this.send("POST", "/accounts/security-stamp", request, true, false);
|
|
30078
30178
|
}
|
|
30079
|
-
deleteAccount(request) {
|
|
30080
|
-
return this.send("DELETE", "/accounts", request, true, false);
|
|
30081
|
-
}
|
|
30082
30179
|
getAccountRevisionDate() {
|
|
30083
30180
|
return api_service_awaiter(this, void 0, void 0, function* () {
|
|
30084
30181
|
const r = yield this.send("GET", "/accounts/revision-date", null, true, true);
|
|
@@ -30171,12 +30268,6 @@ class ApiService {
|
|
|
30171
30268
|
putUpdateTempPassword(request) {
|
|
30172
30269
|
return this.send("PUT", "/accounts/update-temp-password", request, true, false);
|
|
30173
30270
|
}
|
|
30174
|
-
postAccountRequestOTP() {
|
|
30175
|
-
return this.send("POST", "/accounts/request-otp", null, true, false);
|
|
30176
|
-
}
|
|
30177
|
-
postAccountVerifyOTP(request) {
|
|
30178
|
-
return this.send("POST", "/accounts/verify-otp", request, true, false);
|
|
30179
|
-
}
|
|
30180
30271
|
postConvertToKeyConnector() {
|
|
30181
30272
|
return this.send("POST", "/accounts/convert-to-key-connector", null, true, false);
|
|
30182
30273
|
}
|
|
@@ -30543,45 +30634,6 @@ class ApiService {
|
|
|
30543
30634
|
deleteGroupUser(organizationId, id, organizationUserId) {
|
|
30544
30635
|
return this.send("DELETE", "/organizations/" + organizationId + "/groups/" + id + "/user/" + organizationUserId, null, true, false);
|
|
30545
30636
|
}
|
|
30546
|
-
// Policy APIs
|
|
30547
|
-
getPolicy(organizationId, type) {
|
|
30548
|
-
return api_service_awaiter(this, void 0, void 0, function* () {
|
|
30549
|
-
const r = yield this.send("GET", "/organizations/" + organizationId + "/policies/" + type, null, true, true);
|
|
30550
|
-
return new PolicyResponse(r);
|
|
30551
|
-
});
|
|
30552
|
-
}
|
|
30553
|
-
getPolicies(organizationId) {
|
|
30554
|
-
return api_service_awaiter(this, void 0, void 0, function* () {
|
|
30555
|
-
const r = yield this.send("GET", "/organizations/" + organizationId + "/policies", null, true, true);
|
|
30556
|
-
return new ListResponse(r, PolicyResponse);
|
|
30557
|
-
});
|
|
30558
|
-
}
|
|
30559
|
-
getPoliciesByToken(organizationId, token, email, organizationUserId) {
|
|
30560
|
-
return api_service_awaiter(this, void 0, void 0, function* () {
|
|
30561
|
-
const r = yield this.send("GET", "/organizations/" +
|
|
30562
|
-
organizationId +
|
|
30563
|
-
"/policies/token?" +
|
|
30564
|
-
"token=" +
|
|
30565
|
-
encodeURIComponent(token) +
|
|
30566
|
-
"&email=" +
|
|
30567
|
-
encodeURIComponent(email) +
|
|
30568
|
-
"&organizationUserId=" +
|
|
30569
|
-
organizationUserId, null, false, true);
|
|
30570
|
-
return new ListResponse(r, PolicyResponse);
|
|
30571
|
-
});
|
|
30572
|
-
}
|
|
30573
|
-
getPoliciesByInvitedUser(organizationId, userId) {
|
|
30574
|
-
return api_service_awaiter(this, void 0, void 0, function* () {
|
|
30575
|
-
const r = yield this.send("GET", "/organizations/" + organizationId + "/policies/invited-user?" + "userId=" + userId, null, false, true);
|
|
30576
|
-
return new ListResponse(r, PolicyResponse);
|
|
30577
|
-
});
|
|
30578
|
-
}
|
|
30579
|
-
putPolicy(organizationId, type, request) {
|
|
30580
|
-
return api_service_awaiter(this, void 0, void 0, function* () {
|
|
30581
|
-
const r = yield this.send("PUT", "/organizations/" + organizationId + "/policies/" + type, request, true, true);
|
|
30582
|
-
return new PolicyResponse(r);
|
|
30583
|
-
});
|
|
30584
|
-
}
|
|
30585
30637
|
// Organization User APIs
|
|
30586
30638
|
getOrganizationUser(organizationId, id) {
|
|
30587
30639
|
return api_service_awaiter(this, void 0, void 0, function* () {
|
|
@@ -30664,28 +30716,28 @@ class ApiService {
|
|
|
30664
30716
|
return new ListResponse(r, OrganizationUserBulkResponse);
|
|
30665
30717
|
});
|
|
30666
30718
|
}
|
|
30667
|
-
|
|
30668
|
-
return this.send("PUT", "/organizations/" + organizationId + "/users/" + id + "/
|
|
30719
|
+
revokeOrganizationUser(organizationId, id) {
|
|
30720
|
+
return this.send("PUT", "/organizations/" + organizationId + "/users/" + id + "/revoke", null, true, false);
|
|
30669
30721
|
}
|
|
30670
|
-
|
|
30722
|
+
revokeManyOrganizationUsers(organizationId, request) {
|
|
30671
30723
|
return api_service_awaiter(this, void 0, void 0, function* () {
|
|
30672
|
-
const r = yield this.send("PUT", "/organizations/" + organizationId + "/users/
|
|
30724
|
+
const r = yield this.send("PUT", "/organizations/" + organizationId + "/users/revoke", request, true, true);
|
|
30673
30725
|
return new ListResponse(r, OrganizationUserBulkResponse);
|
|
30674
30726
|
});
|
|
30675
30727
|
}
|
|
30676
|
-
|
|
30677
|
-
return this.send("PUT", "/organizations/" + organizationId + "/users/" + id + "/
|
|
30728
|
+
restoreOrganizationUser(organizationId, id) {
|
|
30729
|
+
return this.send("PUT", "/organizations/" + organizationId + "/users/" + id + "/restore", null, true, false);
|
|
30678
30730
|
}
|
|
30679
|
-
|
|
30731
|
+
restoreManyOrganizationUsers(organizationId, request) {
|
|
30680
30732
|
return api_service_awaiter(this, void 0, void 0, function* () {
|
|
30681
|
-
const r = yield this.send("PUT", "/organizations/" + organizationId + "/users/
|
|
30733
|
+
const r = yield this.send("PUT", "/organizations/" + organizationId + "/users/restore", request, true, true);
|
|
30682
30734
|
return new ListResponse(r, OrganizationUserBulkResponse);
|
|
30683
30735
|
});
|
|
30684
30736
|
}
|
|
30685
30737
|
// Plan APIs
|
|
30686
30738
|
getPlans() {
|
|
30687
30739
|
return api_service_awaiter(this, void 0, void 0, function* () {
|
|
30688
|
-
const r = yield this.send("GET", "/plans/", null,
|
|
30740
|
+
const r = yield this.send("GET", "/plans/", null, false, true);
|
|
30689
30741
|
return new ListResponse(r, PlanResponse);
|
|
30690
30742
|
});
|
|
30691
30743
|
}
|
|
@@ -31350,6 +31402,12 @@ class ApiService {
|
|
|
31350
31402
|
}
|
|
31351
31403
|
});
|
|
31352
31404
|
}
|
|
31405
|
+
getOrganizationExport(organizationId) {
|
|
31406
|
+
return api_service_awaiter(this, void 0, void 0, function* () {
|
|
31407
|
+
const r = yield this.send("GET", "/organizations/" + organizationId + "/export", null, true, true);
|
|
31408
|
+
return new OrganizationExportResponse(r);
|
|
31409
|
+
});
|
|
31410
|
+
}
|
|
31353
31411
|
// Helpers
|
|
31354
31412
|
getActiveBearerToken() {
|
|
31355
31413
|
return api_service_awaiter(this, void 0, void 0, function* () {
|
|
@@ -32650,7 +32708,7 @@ class CliUtils {
|
|
|
32650
32708
|
return this.flags[flag] == null || this.flags[flag];
|
|
32651
32709
|
}
|
|
32652
32710
|
static get flags() {
|
|
32653
|
-
const envFlags = {
|
|
32711
|
+
const envFlags = {};
|
|
32654
32712
|
if (typeof envFlags === "string") {
|
|
32655
32713
|
return JSON.parse(envFlags);
|
|
32656
32714
|
}
|
|
@@ -34316,6 +34374,7 @@ var download_command_awaiter = (undefined && undefined.__awaiter) || function (t
|
|
|
34316
34374
|
|
|
34317
34375
|
|
|
34318
34376
|
|
|
34377
|
+
|
|
34319
34378
|
class DownloadCommand {
|
|
34320
34379
|
constructor(cryptoService) {
|
|
34321
34380
|
this.cryptoService = cryptoService;
|
|
@@ -34327,8 +34386,8 @@ class DownloadCommand {
|
|
|
34327
34386
|
return Response.error("A " + response.status + " error occurred while downloading the attachment.");
|
|
34328
34387
|
}
|
|
34329
34388
|
try {
|
|
34330
|
-
const
|
|
34331
|
-
const decBuf = yield this.cryptoService.decryptFromBytes(
|
|
34389
|
+
const encBuf = yield EncArrayBuffer.fromResponse(response);
|
|
34390
|
+
const decBuf = yield this.cryptoService.decryptFromBytes(encBuf, key);
|
|
34332
34391
|
if (process.env.BW_SERVE === "true") {
|
|
34333
34392
|
const res = new FileResponse(Buffer.from(decBuf), fileName);
|
|
34334
34393
|
return Response.success(res);
|
|
@@ -35935,6 +35994,7 @@ var serve_command_awaiter = (undefined && undefined.__awaiter) || function (this
|
|
|
35935
35994
|
|
|
35936
35995
|
|
|
35937
35996
|
|
|
35997
|
+
|
|
35938
35998
|
|
|
35939
35999
|
|
|
35940
36000
|
class ServeCommand {
|
|
@@ -35962,13 +36022,27 @@ class ServeCommand {
|
|
|
35962
36022
|
}
|
|
35963
36023
|
run(options) {
|
|
35964
36024
|
return serve_command_awaiter(this, void 0, void 0, function* () {
|
|
36025
|
+
const protectOrigin = !options.disableOriginProtection;
|
|
35965
36026
|
const port = options.port || 8087;
|
|
35966
36027
|
const hostname = options.hostname || "localhost";
|
|
36028
|
+
this.main.logService.info(`Starting server on ${hostname}:${port} with ${protectOrigin ? "origin protection" : "no origin protection"}`);
|
|
35967
36029
|
const server = new external_koa_namespaceObject();
|
|
35968
36030
|
const router = new router_namespaceObject();
|
|
35969
36031
|
process.env.BW_SERVE = "true";
|
|
35970
36032
|
process.env.BW_NOINTERACTION = "true";
|
|
35971
|
-
server
|
|
36033
|
+
server
|
|
36034
|
+
.use((ctx, next) => serve_command_awaiter(this, void 0, void 0, function* () {
|
|
36035
|
+
if (protectOrigin && ctx.headers.origin != undefined) {
|
|
36036
|
+
ctx.status = 403;
|
|
36037
|
+
this.main.logService.warning(`Blocking request from "${Utils.isNullOrEmpty(ctx.headers.origin)
|
|
36038
|
+
? "(Origin header value missing)"
|
|
36039
|
+
: ctx.headers.origin}"`);
|
|
36040
|
+
return;
|
|
36041
|
+
}
|
|
36042
|
+
yield next();
|
|
36043
|
+
}))
|
|
36044
|
+
.use(external_koa_bodyparser_namespaceObject())
|
|
36045
|
+
.use(external_koa_json_namespaceObject({ pretty: false, param: "pretty" }));
|
|
35972
36046
|
router.get("/generate", (ctx, next) => serve_command_awaiter(this, void 0, void 0, function* () {
|
|
35973
36047
|
const response = yield this.generateCommand.run(ctx.request.query);
|
|
35974
36048
|
this.processResponse(ctx.response, response);
|
|
@@ -36389,7 +36463,7 @@ class Program extends BaseProgram {
|
|
|
36389
36463
|
writeLn("", true);
|
|
36390
36464
|
})
|
|
36391
36465
|
.action((cmd) => program_awaiter(this, void 0, void 0, function* () {
|
|
36392
|
-
yield this.
|
|
36466
|
+
yield this.exitIfNotAuthed();
|
|
36393
36467
|
const command = new SyncCommand(this.main.syncService);
|
|
36394
36468
|
const response = yield command.run(cmd);
|
|
36395
36469
|
this.processResponse(response);
|
|
@@ -36540,31 +36614,30 @@ class Program extends BaseProgram {
|
|
|
36540
36614
|
const response = yield command.run();
|
|
36541
36615
|
this.processResponse(response);
|
|
36542
36616
|
}));
|
|
36543
|
-
|
|
36544
|
-
|
|
36545
|
-
|
|
36546
|
-
|
|
36547
|
-
|
|
36548
|
-
|
|
36549
|
-
|
|
36550
|
-
|
|
36551
|
-
|
|
36552
|
-
|
|
36553
|
-
|
|
36554
|
-
|
|
36555
|
-
|
|
36556
|
-
|
|
36557
|
-
|
|
36558
|
-
|
|
36559
|
-
|
|
36560
|
-
|
|
36561
|
-
|
|
36562
|
-
|
|
36563
|
-
|
|
36564
|
-
|
|
36565
|
-
|
|
36566
|
-
|
|
36567
|
-
}
|
|
36617
|
+
external_commander_namespaceObject.command("serve")
|
|
36618
|
+
.description("Start a RESTful API webserver.")
|
|
36619
|
+
.option("--hostname <hostname>", "The hostname to bind your API webserver to.")
|
|
36620
|
+
.option("--port <port>", "The port to run your API webserver on.")
|
|
36621
|
+
.option("--disable-origin-protection", "If set, allows requests with origin header. Not recommended!")
|
|
36622
|
+
.on("--help", () => {
|
|
36623
|
+
writeLn("\n Notes:");
|
|
36624
|
+
writeLn("");
|
|
36625
|
+
writeLn(" Default hostname is `localhost`.");
|
|
36626
|
+
writeLn(" Use hostname `all` for no hostname binding.");
|
|
36627
|
+
writeLn(" Default port is `8087`.");
|
|
36628
|
+
writeLn("");
|
|
36629
|
+
writeLn(" Examples:");
|
|
36630
|
+
writeLn("");
|
|
36631
|
+
writeLn(" bw serve");
|
|
36632
|
+
writeLn(" bw serve --port 8080");
|
|
36633
|
+
writeLn(" bw serve --hostname bwapi.mydomain.com --port 80");
|
|
36634
|
+
writeLn("", true);
|
|
36635
|
+
})
|
|
36636
|
+
.action((cmd) => program_awaiter(this, void 0, void 0, function* () {
|
|
36637
|
+
yield this.exitIfNotAuthed();
|
|
36638
|
+
const command = new ServeCommand(this.main);
|
|
36639
|
+
yield command.run(cmd);
|
|
36640
|
+
}));
|
|
36568
36641
|
});
|
|
36569
36642
|
}
|
|
36570
36643
|
processResponse(response, exitImmediately = false) {
|
|
@@ -37165,6 +37238,7 @@ class i18n_service_I18nService {
|
|
|
37165
37238
|
["eo", "Esperanto"],
|
|
37166
37239
|
["es", "español"],
|
|
37167
37240
|
["et", "eesti"],
|
|
37241
|
+
["eu", "euskara"],
|
|
37168
37242
|
["fa", "فارسی"],
|
|
37169
37243
|
["fi", "suomi"],
|
|
37170
37244
|
["fil", "Wikang Filipino"],
|
|
@@ -37538,6 +37612,7 @@ var nodeEnvSecureStorage_service_awaiter = (undefined && undefined.__awaiter) ||
|
|
|
37538
37612
|
};
|
|
37539
37613
|
|
|
37540
37614
|
|
|
37615
|
+
|
|
37541
37616
|
class NodeEnvSecureStorageService {
|
|
37542
37617
|
constructor(storageService, logService, cryptoService) {
|
|
37543
37618
|
this.storageService = storageService;
|
|
@@ -37594,7 +37669,8 @@ class NodeEnvSecureStorageService {
|
|
|
37594
37669
|
if (sessionKey == null) {
|
|
37595
37670
|
return null;
|
|
37596
37671
|
}
|
|
37597
|
-
const
|
|
37672
|
+
const encBuf = EncArrayBuffer.fromB64(encValue);
|
|
37673
|
+
const decValue = yield this.cryptoService().decryptFromBytes(encBuf, sessionKey);
|
|
37598
37674
|
if (decValue == null) {
|
|
37599
37675
|
this.logService.info("Failed to decrypt.");
|
|
37600
37676
|
return null;
|
|
@@ -38301,6 +38377,7 @@ var bw_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argum
|
|
|
38301
38377
|
|
|
38302
38378
|
|
|
38303
38379
|
|
|
38380
|
+
|
|
38304
38381
|
|
|
38305
38382
|
|
|
38306
38383
|
// Polyfills
|
|
@@ -38361,7 +38438,7 @@ class Main {
|
|
|
38361
38438
|
this.searchService = new SearchService(this.cipherService, this.logService, this.i18nService);
|
|
38362
38439
|
this.providerService = new ProviderService(this.stateService);
|
|
38363
38440
|
this.organizationService = new OrganizationService(this.stateService);
|
|
38364
|
-
this.policyService = new PolicyService(this.stateService, this.organizationService
|
|
38441
|
+
this.policyService = new PolicyService(this.stateService, this.organizationService);
|
|
38365
38442
|
this.sendService = new SendService(this.cryptoService, this.apiService, this.fileUploadService, this.i18nService, this.cryptoFunctionService, this.stateService);
|
|
38366
38443
|
this.keyConnectorService = new KeyConnectorService(this.stateService, this.cryptoService, this.apiService, this.tokenService, this.logService, this.organizationService, this.cryptoFunctionService, (expired) => bw_awaiter(this, void 0, void 0, function* () { return yield this.logout(); }));
|
|
38367
38444
|
this.twoFactorService = new TwoFactorService(this.i18nService, this.platformUtilsService);
|
|
@@ -38377,7 +38454,8 @@ class Main {
|
|
|
38377
38454
|
this.program = new Program(this);
|
|
38378
38455
|
this.vaultProgram = new VaultProgram(this);
|
|
38379
38456
|
this.sendProgram = new SendProgram(this);
|
|
38380
|
-
this.
|
|
38457
|
+
this.userVerificationApiService = new UserVerificationApiService(this.apiService);
|
|
38458
|
+
this.userVerificationService = new UserVerificationService(this.cryptoService, this.i18nService, this.userVerificationApiService);
|
|
38381
38459
|
}
|
|
38382
38460
|
run() {
|
|
38383
38461
|
return bw_awaiter(this, void 0, void 0, function* () {
|
|
@@ -38415,7 +38493,7 @@ class Main {
|
|
|
38415
38493
|
return bw_awaiter(this, void 0, void 0, function* () {
|
|
38416
38494
|
yield this.storageService.init();
|
|
38417
38495
|
yield this.stateService.init();
|
|
38418
|
-
this.containerService.
|
|
38496
|
+
this.containerService.attachToGlobal(global);
|
|
38419
38497
|
yield this.environmentService.setUrlsFromStorage();
|
|
38420
38498
|
const locale = yield this.stateService.getLocale();
|
|
38421
38499
|
yield this.i18nService.init(locale);
|