1 | #!/usr/bin/env node
|
2 | (function(modules) {
|
3 |
|
4 | var installedModules = {};
|
5 |
|
6 |
|
7 | function __webpack_require__(moduleId) {
|
8 |
|
9 |
|
10 | if(installedModules[moduleId]) {
|
11 | return installedModules[moduleId].exports;
|
12 | }
|
13 |
|
14 | var module = installedModules[moduleId] = {
|
15 | i: moduleId,
|
16 | l: false,
|
17 | exports: {}
|
18 | };
|
19 |
|
20 |
|
21 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
22 |
|
23 |
|
24 | module.l = true;
|
25 |
|
26 |
|
27 | return module.exports;
|
28 | }
|
29 |
|
30 |
|
31 |
|
32 | __webpack_require__.m = modules;
|
33 |
|
34 |
|
35 | __webpack_require__.c = installedModules;
|
36 |
|
37 |
|
38 | __webpack_require__.d = function(exports, name, getter) {
|
39 | if(!__webpack_require__.o(exports, name)) {
|
40 | Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
41 | }
|
42 | };
|
43 |
|
44 |
|
45 | __webpack_require__.r = function(exports) {
|
46 | if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
47 | Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
48 | }
|
49 | Object.defineProperty(exports, '__esModule', { value: true });
|
50 | };
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 | __webpack_require__.t = function(value, mode) {
|
58 | if(mode & 1) value = __webpack_require__(value);
|
59 | if(mode & 8) return value;
|
60 | if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
61 | var ns = Object.create(null);
|
62 | __webpack_require__.r(ns);
|
63 | Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
64 | if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
65 | return ns;
|
66 | };
|
67 |
|
68 |
|
69 | __webpack_require__.n = function(module) {
|
70 | var getter = module && module.__esModule ?
|
71 | function getDefault() { return module['default']; } :
|
72 | function getModuleExports() { return module; };
|
73 | __webpack_require__.d(getter, 'a', getter);
|
74 | return getter;
|
75 | };
|
76 |
|
77 |
|
78 | __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
79 |
|
80 |
|
81 | __webpack_require__.p = "";
|
82 |
|
83 |
|
84 |
|
85 | return __webpack_require__(__webpack_require__.s = 21);
|
86 | })
|
87 |
|
88 | ([
|
89 |
|
90 | (function(module, exports) {
|
91 |
|
92 | module.exports = require("commander");
|
93 |
|
94 | }),
|
95 |
|
96 | (function(module, exports) {
|
97 |
|
98 | module.exports = require("path");
|
99 |
|
100 | }),
|
101 |
|
102 | (function(module, exports) {
|
103 |
|
104 | module.exports = require("node-forge");
|
105 |
|
106 | }),
|
107 |
|
108 | (function(module, exports) {
|
109 |
|
110 | module.exports = require("fs");
|
111 |
|
112 | }),
|
113 |
|
114 | (function(module, exports) {
|
115 |
|
116 | module.exports = require("node-fetch");
|
117 |
|
118 | }),
|
119 |
|
120 | (function(module, exports) {
|
121 |
|
122 | module.exports = require("inquirer");
|
123 |
|
124 | }),
|
125 |
|
126 | (function(module, exports) {
|
127 |
|
128 | module.exports = require("crypto");
|
129 |
|
130 | }),
|
131 |
|
132 | (function(module, exports) {
|
133 |
|
134 | module.exports = require("tldjs");
|
135 |
|
136 | }),
|
137 |
|
138 | (function(module, exports) {
|
139 |
|
140 | module.exports = require("papaparse");
|
141 |
|
142 | }),
|
143 |
|
144 | (function(module, exports) {
|
145 |
|
146 | module.exports = require("lunr");
|
147 |
|
148 | }),
|
149 |
|
150 | (function(module, exports) {
|
151 |
|
152 | module.exports = require("chalk");
|
153 |
|
154 | }),
|
155 |
|
156 | (function(module, exports) {
|
157 |
|
158 | module.exports = require("lowdb");
|
159 |
|
160 | }),
|
161 |
|
162 | (function(module, exports) {
|
163 |
|
164 | module.exports = require("jsdom");
|
165 |
|
166 | }),
|
167 |
|
168 | (function(module, exports) {
|
169 |
|
170 | module.exports = require("big-integer");
|
171 |
|
172 | }),
|
173 |
|
174 | (function(module, exports) {
|
175 |
|
176 | module.exports = require("lowdb/adapters/FileSync");
|
177 |
|
178 | }),
|
179 |
|
180 | (function(module, exports) {
|
181 |
|
182 | module.exports = require("readline");
|
183 |
|
184 | }),
|
185 |
|
186 | (function(module, exports) {
|
187 |
|
188 | module.exports = require("form-data");
|
189 |
|
190 | }),
|
191 |
|
192 | (function(module, exports) {
|
193 |
|
194 | module.exports = require("https-proxy-agent");
|
195 |
|
196 | }),
|
197 |
|
198 | (function(module, exports) {
|
199 |
|
200 | module.exports = require("zxcvbn");
|
201 |
|
202 | }),
|
203 |
|
204 | (function(module, exports) {
|
205 |
|
206 | module.exports = require("url");
|
207 |
|
208 | }),
|
209 |
|
210 | (function(module) {
|
211 |
|
212 | module.exports = {"name":"@bitwarden/cli","description":"A secure and free password manager for all of your devices.","version":"1.10.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","scripts":{"sub:init":"git submodule update --init --recursive","sub:update":"git submodule update --remote","sub:pull":"git submodule foreach git pull origin master","clean":"rimraf dist/**/*","symlink:win":"rmdir /S /Q ./jslib && cmd /c mklink /J .\\jslib ..\\jslib","symlink:mac":"npm run symlink:lin","symlink:lin":"rm -rf ./jslib && ln -s ../jslib ./jslib","build":"webpack","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","package:mac":"pkg . --targets macos-x64 --output ./dist/macos/bw","package:lin":"pkg . --targets linux-x64 --output ./dist/linux/bw","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","lint":"tslint src/**/*.ts spec/**/*.ts || true","lint:fix":"tslint src/**/*.ts spec/**/*.ts --fix"},"bin":{"bw":"./build/bw.js"},"pkg":{"assets":"./build/**/*"},"devDependencies":{"@types/commander":"^2.12.2","@types/form-data":"^2.2.1","@types/inquirer":"^0.0.43","@types/jsdom":"^12.2.1","@types/lowdb":"^1.0.5","@types/lunr":"^2.3.3","@types/node":"^10.9.4","@types/node-fetch":"^2.1.2","@types/node-forge":"^0.7.5","@types/papaparse":"^4.5.3","@types/tldjs":"^2.3.0","@types/zxcvbn":"4.4.0","clean-webpack-plugin":"^0.1.19","copy-webpack-plugin":"^4.5.2","cross-env":"^5.2.0","pkg":"4.3.4","ts-loader":"^5.3.3","tslint":"^5.12.1","tslint-loader":"^3.5.4","typescript":"3.2.4","webpack":"^4.29.0","webpack-cli":"^3.2.1","webpack-node-externals":"^1.7.2"},"dependencies":{"big-integer":"1.6.36","chalk":"2.4.1","commander":"2.18.0","form-data":"2.3.2","https-proxy-agent":"4.0.0","inquirer":"6.2.0","jsdom":"13.2.0","lowdb":"1.0.0","lunr":"2.3.3","node-fetch":"2.2.0","node-forge":"0.7.6","papaparse":"4.6.0","tldjs":"2.3.1","zxcvbn":"4.4.2"}};
|
213 |
|
214 | }),
|
215 |
|
216 | (function(module, __webpack_exports__, __webpack_require__) {
|
217 |
|
218 | "use strict";
|
219 | __webpack_require__.r(__webpack_exports__);
|
220 |
|
221 |
|
222 | var external_fs_ = __webpack_require__(3);
|
223 |
|
224 |
|
225 | var external_jsdom_ = __webpack_require__(12);
|
226 |
|
227 |
|
228 | var external_path_ = __webpack_require__(1);
|
229 |
|
230 |
|
231 | var TwoFactorProviderType;
|
232 | (function (TwoFactorProviderType) {
|
233 | TwoFactorProviderType[TwoFactorProviderType["Authenticator"] = 0] = "Authenticator";
|
234 | TwoFactorProviderType[TwoFactorProviderType["Email"] = 1] = "Email";
|
235 | TwoFactorProviderType[TwoFactorProviderType["Duo"] = 2] = "Duo";
|
236 | TwoFactorProviderType[TwoFactorProviderType["Yubikey"] = 3] = "Yubikey";
|
237 | TwoFactorProviderType[TwoFactorProviderType["U2f"] = 4] = "U2f";
|
238 | TwoFactorProviderType[TwoFactorProviderType["Remember"] = 5] = "Remember";
|
239 | TwoFactorProviderType[TwoFactorProviderType["OrganizationDuo"] = 6] = "OrganizationDuo";
|
240 | })(TwoFactorProviderType || (TwoFactorProviderType = {}));
|
241 |
|
242 |
|
243 | class AuthResult {
|
244 | constructor() {
|
245 | this.twoFactor = false;
|
246 | this.twoFactorProviders = null;
|
247 | }
|
248 | }
|
249 |
|
250 |
|
251 | class DeviceRequest {
|
252 | constructor(appId, platformUtilsService) {
|
253 | this.type = platformUtilsService.getDevice();
|
254 | this.name = platformUtilsService.getDeviceString();
|
255 | this.identifier = appId;
|
256 | this.pushToken = null;
|
257 | }
|
258 | }
|
259 |
|
260 |
|
261 | class KeysRequest {
|
262 | constructor(publicKey, encryptedPrivateKey) {
|
263 | this.publicKey = publicKey;
|
264 | this.encryptedPrivateKey = encryptedPrivateKey;
|
265 | }
|
266 | }
|
267 |
|
268 |
|
269 | class PreloginRequest {
|
270 | constructor(email) {
|
271 | this.email = email;
|
272 | }
|
273 | }
|
274 |
|
275 |
|
276 | class TokenRequest {
|
277 | constructor(email, masterPasswordHash, provider, token, remember, device) {
|
278 | this.email = email;
|
279 | this.masterPasswordHash = masterPasswordHash;
|
280 | this.token = token;
|
281 | this.provider = provider;
|
282 | this.remember = remember;
|
283 | this.device = device != null ? device : null;
|
284 | }
|
285 | toIdentityToken(clientId) {
|
286 | const obj = {
|
287 | grant_type: 'password',
|
288 | username: this.email,
|
289 | password: this.masterPasswordHash,
|
290 | scope: 'api offline_access',
|
291 | client_id: clientId,
|
292 | };
|
293 | if (this.device) {
|
294 | obj.deviceType = this.device.type;
|
295 | obj.deviceIdentifier = this.device.identifier;
|
296 | obj.deviceName = this.device.name;
|
297 |
|
298 |
|
299 | }
|
300 | if (this.token && this.provider != null) {
|
301 | obj.twoFactorToken = this.token;
|
302 | obj.twoFactorProvider = this.provider;
|
303 | obj.twoFactorRemember = this.remember ? '1' : '0';
|
304 | }
|
305 | return obj;
|
306 | }
|
307 | }
|
308 |
|
309 |
|
310 | var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
311 | return new (P || (P = Promise))(function (resolve, reject) {
|
312 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
313 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
314 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
315 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
316 | });
|
317 | };
|
318 |
|
319 |
|
320 |
|
321 |
|
322 |
|
323 |
|
324 | const TwoFactorProviders = {
|
325 | [TwoFactorProviderType.Authenticator]: {
|
326 | type: TwoFactorProviderType.Authenticator,
|
327 | name: null,
|
328 | description: null,
|
329 | priority: 1,
|
330 | sort: 1,
|
331 | premium: false,
|
332 | },
|
333 | [TwoFactorProviderType.Yubikey]: {
|
334 | type: TwoFactorProviderType.Yubikey,
|
335 | name: null,
|
336 | description: null,
|
337 | priority: 3,
|
338 | sort: 2,
|
339 | premium: true,
|
340 | },
|
341 | [TwoFactorProviderType.Duo]: {
|
342 | type: TwoFactorProviderType.Duo,
|
343 | name: 'Duo',
|
344 | description: null,
|
345 | priority: 2,
|
346 | sort: 3,
|
347 | premium: true,
|
348 | },
|
349 | [TwoFactorProviderType.OrganizationDuo]: {
|
350 | type: TwoFactorProviderType.OrganizationDuo,
|
351 | name: 'Duo (Organization)',
|
352 | description: null,
|
353 | priority: 10,
|
354 | sort: 4,
|
355 | premium: false,
|
356 | },
|
357 | [TwoFactorProviderType.U2f]: {
|
358 | type: TwoFactorProviderType.U2f,
|
359 | name: null,
|
360 | description: null,
|
361 | priority: 4,
|
362 | sort: 5,
|
363 | premium: true,
|
364 | },
|
365 | [TwoFactorProviderType.Email]: {
|
366 | type: TwoFactorProviderType.Email,
|
367 | name: null,
|
368 | description: null,
|
369 | priority: 0,
|
370 | sort: 6,
|
371 | premium: false,
|
372 | },
|
373 | };
|
374 | class auth_service_AuthService {
|
375 | constructor(cryptoService, apiService, userService, tokenService, appIdService, i18nService, platformUtilsService, messagingService, setCryptoKeys = true) {
|
376 | this.cryptoService = cryptoService;
|
377 | this.apiService = apiService;
|
378 | this.userService = userService;
|
379 | this.tokenService = tokenService;
|
380 | this.appIdService = appIdService;
|
381 | this.i18nService = i18nService;
|
382 | this.platformUtilsService = platformUtilsService;
|
383 | this.messagingService = messagingService;
|
384 | this.setCryptoKeys = setCryptoKeys;
|
385 | this.selectedTwoFactorProviderType = null;
|
386 | }
|
387 | init() {
|
388 | TwoFactorProviders[TwoFactorProviderType.Email].name = this.i18nService.t('emailTitle');
|
389 | TwoFactorProviders[TwoFactorProviderType.Email].description = this.i18nService.t('emailDesc');
|
390 | TwoFactorProviders[TwoFactorProviderType.Authenticator].name = this.i18nService.t('authenticatorAppTitle');
|
391 | TwoFactorProviders[TwoFactorProviderType.Authenticator].description =
|
392 | this.i18nService.t('authenticatorAppDesc');
|
393 | TwoFactorProviders[TwoFactorProviderType.Duo].description = this.i18nService.t('duoDesc');
|
394 | TwoFactorProviders[TwoFactorProviderType.OrganizationDuo].name =
|
395 | 'Duo (' + this.i18nService.t('organization') + ')';
|
396 | TwoFactorProviders[TwoFactorProviderType.OrganizationDuo].description =
|
397 | this.i18nService.t('duoOrganizationDesc');
|
398 | TwoFactorProviders[TwoFactorProviderType.U2f].name = this.i18nService.t('u2fTitle');
|
399 | TwoFactorProviders[TwoFactorProviderType.U2f].description = this.i18nService.t('u2fDesc');
|
400 | TwoFactorProviders[TwoFactorProviderType.Yubikey].name = this.i18nService.t('yubiKeyTitle');
|
401 | TwoFactorProviders[TwoFactorProviderType.Yubikey].description = this.i18nService.t('yubiKeyDesc');
|
402 | }
|
403 | logIn(email, masterPassword) {
|
404 | return __awaiter(this, void 0, void 0, function* () {
|
405 | this.selectedTwoFactorProviderType = null;
|
406 | const key = yield this.makePreloginKey(masterPassword, email);
|
407 | const hashedPassword = yield this.cryptoService.hashPassword(masterPassword, key);
|
408 | return yield this.logInHelper(email, hashedPassword, key);
|
409 | });
|
410 | }
|
411 | logInTwoFactor(twoFactorProvider, twoFactorToken, remember) {
|
412 | return __awaiter(this, void 0, void 0, function* () {
|
413 | return yield this.logInHelper(this.email, this.masterPasswordHash, this.key, twoFactorProvider, twoFactorToken, remember);
|
414 | });
|
415 | }
|
416 | logInComplete(email, masterPassword, twoFactorProvider, twoFactorToken, remember) {
|
417 | return __awaiter(this, void 0, void 0, function* () {
|
418 | this.selectedTwoFactorProviderType = null;
|
419 | const key = yield this.makePreloginKey(masterPassword, email);
|
420 | const hashedPassword = yield this.cryptoService.hashPassword(masterPassword, key);
|
421 | return yield this.logInHelper(email, hashedPassword, key, twoFactorProvider, twoFactorToken, remember);
|
422 | });
|
423 | }
|
424 | logOut(callback) {
|
425 | callback();
|
426 | this.messagingService.send('loggedOut');
|
427 | }
|
428 | getSupportedTwoFactorProviders(win) {
|
429 | const providers = [];
|
430 | if (this.twoFactorProvidersData == null) {
|
431 | return providers;
|
432 | }
|
433 | if (this.twoFactorProvidersData.has(TwoFactorProviderType.OrganizationDuo) &&
|
434 | this.platformUtilsService.supportsDuo()) {
|
435 | providers.push(TwoFactorProviders[TwoFactorProviderType.OrganizationDuo]);
|
436 | }
|
437 | if (this.twoFactorProvidersData.has(TwoFactorProviderType.Authenticator)) {
|
438 | providers.push(TwoFactorProviders[TwoFactorProviderType.Authenticator]);
|
439 | }
|
440 | if (this.twoFactorProvidersData.has(TwoFactorProviderType.Yubikey)) {
|
441 | providers.push(TwoFactorProviders[TwoFactorProviderType.Yubikey]);
|
442 | }
|
443 | if (this.twoFactorProvidersData.has(TwoFactorProviderType.Duo) && this.platformUtilsService.supportsDuo()) {
|
444 | providers.push(TwoFactorProviders[TwoFactorProviderType.Duo]);
|
445 | }
|
446 | if (this.twoFactorProvidersData.has(TwoFactorProviderType.U2f) && this.platformUtilsService.supportsU2f(win)) {
|
447 | providers.push(TwoFactorProviders[TwoFactorProviderType.U2f]);
|
448 | }
|
449 | if (this.twoFactorProvidersData.has(TwoFactorProviderType.Email)) {
|
450 | providers.push(TwoFactorProviders[TwoFactorProviderType.Email]);
|
451 | }
|
452 | return providers;
|
453 | }
|
454 | getDefaultTwoFactorProvider(u2fSupported) {
|
455 | if (this.twoFactorProvidersData == null) {
|
456 | return null;
|
457 | }
|
458 | if (this.selectedTwoFactorProviderType != null &&
|
459 | this.twoFactorProvidersData.has(this.selectedTwoFactorProviderType)) {
|
460 | return this.selectedTwoFactorProviderType;
|
461 | }
|
462 | let providerType = null;
|
463 | let providerPriority = -1;
|
464 | this.twoFactorProvidersData.forEach((value, type) => {
|
465 | const provider = TwoFactorProviders[type];
|
466 | if (provider != null && provider.priority > providerPriority) {
|
467 | if (type === TwoFactorProviderType.U2f && !u2fSupported) {
|
468 | return;
|
469 | }
|
470 | providerType = type;
|
471 | providerPriority = provider.priority;
|
472 | }
|
473 | });
|
474 | return providerType;
|
475 | }
|
476 | makePreloginKey(masterPassword, email) {
|
477 | return __awaiter(this, void 0, void 0, function* () {
|
478 | email = email.trim().toLowerCase();
|
479 | this.kdf = null;
|
480 | this.kdfIterations = null;
|
481 | try {
|
482 | const preloginResponse = yield this.apiService.postPrelogin(new PreloginRequest(email));
|
483 | if (preloginResponse != null) {
|
484 | this.kdf = preloginResponse.kdf;
|
485 | this.kdfIterations = preloginResponse.kdfIterations;
|
486 | }
|
487 | }
|
488 | catch (e) {
|
489 | if (e == null || e.statusCode !== 404) {
|
490 | throw e;
|
491 | }
|
492 | }
|
493 | return this.cryptoService.makeKey(masterPassword, email, this.kdf, this.kdfIterations);
|
494 | });
|
495 | }
|
496 | logInHelper(email, hashedPassword, key, twoFactorProvider, twoFactorToken, remember) {
|
497 | return __awaiter(this, void 0, void 0, function* () {
|
498 | const storedTwoFactorToken = yield this.tokenService.getTwoFactorToken(email);
|
499 | const appId = yield this.appIdService.getAppId();
|
500 | const deviceRequest = new DeviceRequest(appId, this.platformUtilsService);
|
501 | let request;
|
502 | if (twoFactorToken != null && twoFactorProvider != null) {
|
503 | request = new TokenRequest(email, hashedPassword, twoFactorProvider, twoFactorToken, remember, deviceRequest);
|
504 | }
|
505 | else if (storedTwoFactorToken != null) {
|
506 | request = new TokenRequest(email, hashedPassword, TwoFactorProviderType.Remember, storedTwoFactorToken, false, deviceRequest);
|
507 | }
|
508 | else {
|
509 | request = new TokenRequest(email, hashedPassword, null, null, false, deviceRequest);
|
510 | }
|
511 | const response = yield this.apiService.postIdentityToken(request);
|
512 | this.clearState();
|
513 | const result = new AuthResult();
|
514 | result.twoFactor = !response.accessToken;
|
515 | if (result.twoFactor) {
|
516 |
|
517 | const twoFactorResponse = response;
|
518 | this.email = email;
|
519 | this.masterPasswordHash = hashedPassword;
|
520 | this.key = this.setCryptoKeys ? key : null;
|
521 | this.twoFactorProvidersData = twoFactorResponse.twoFactorProviders2;
|
522 | result.twoFactorProviders = twoFactorResponse.twoFactorProviders2;
|
523 | return result;
|
524 | }
|
525 | const tokenResponse = response;
|
526 | if (tokenResponse.twoFactorToken != null) {
|
527 | yield this.tokenService.setTwoFactorToken(tokenResponse.twoFactorToken, email);
|
528 | }
|
529 | yield this.tokenService.setTokens(tokenResponse.accessToken, tokenResponse.refreshToken);
|
530 | yield this.userService.setInformation(this.tokenService.getUserId(), this.tokenService.getEmail(), this.kdf, this.kdfIterations);
|
531 | if (this.setCryptoKeys) {
|
532 | yield this.cryptoService.setKey(key);
|
533 | yield this.cryptoService.setKeyHash(hashedPassword);
|
534 | yield this.cryptoService.setEncKey(tokenResponse.key);
|
535 |
|
536 | if (tokenResponse.privateKey == null) {
|
537 | try {
|
538 | const keyPair = yield this.cryptoService.makeKeyPair();
|
539 | yield this.apiService.postAccountKeys(new KeysRequest(keyPair[0], keyPair[1].encryptedString));
|
540 | tokenResponse.privateKey = keyPair[1].encryptedString;
|
541 | }
|
542 | catch (e) {
|
543 |
|
544 | console.error(e);
|
545 | }
|
546 | }
|
547 | yield this.cryptoService.setEncPrivateKey(tokenResponse.privateKey);
|
548 | }
|
549 | this.messagingService.send('loggedIn');
|
550 | return result;
|
551 | });
|
552 | }
|
553 | clearState() {
|
554 | this.email = null;
|
555 | this.masterPasswordHash = null;
|
556 | this.twoFactorProvidersData = null;
|
557 | this.selectedTwoFactorProviderType = null;
|
558 | }
|
559 | }
|
560 |
|
561 |
|
562 | var i18n_service_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
563 | return new (P || (P = Promise))(function (resolve, reject) {
|
564 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
565 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
566 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
567 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
568 | });
|
569 | };
|
570 | class i18n_service_I18nService {
|
571 | constructor(systemLanguage, localesDirectory, getLocalesJson) {
|
572 | this.systemLanguage = systemLanguage;
|
573 | this.localesDirectory = localesDirectory;
|
574 | this.getLocalesJson = getLocalesJson;
|
575 |
|
576 | this.supportedTranslationLocales = ['en'];
|
577 | this.localeNames = new Map([
|
578 | ['af', 'Afrikaans'],
|
579 | ['bg', 'български'],
|
580 | ['ca', 'català'],
|
581 | ['cs', 'čeština'],
|
582 | ['da', 'dansk'],
|
583 | ['de', 'Deutsch'],
|
584 | ['el', 'Ελληνικά'],
|
585 | ['en', 'English'],
|
586 | ['en-GB', 'English (British)'],
|
587 | ['eo', 'Esperanto'],
|
588 | ['es', 'español'],
|
589 | ['et', 'eesti'],
|
590 | ['fa', 'فارسی'],
|
591 | ['fi', 'suomi'],
|
592 | ['fr', 'français'],
|
593 | ['he', 'עברית'],
|
594 | ['hi', 'हिन्दी'],
|
595 | ['hr', 'hrvatski'],
|
596 | ['hu', 'magyar'],
|
597 | ['id', 'Bahasa Indonesia'],
|
598 | ['it', 'italiano'],
|
599 | ['ja', '日本語'],
|
600 | ['ko', '한국어'],
|
601 | ['nb', 'norsk (bokmål)'],
|
602 | ['nl', 'Nederlands'],
|
603 | ['pl', 'polski'],
|
604 | ['pt-BR', 'português do Brasil'],
|
605 | ['pt-PT', 'português'],
|
606 | ['ro', 'română'],
|
607 | ['ru', 'русский'],
|
608 | ['sk', 'slovenčina'],
|
609 | ['sv', 'svenska'],
|
610 | ['th', 'ไทย'],
|
611 | ['tr', 'Türkçe'],
|
612 | ['uk', 'українська'],
|
613 | ['vi', 'Tiếng Việt'],
|
614 | ['zh-CN', '中文(中国大陆)'],
|
615 | ['zh-TW', '中文(台灣)'],
|
616 | ]);
|
617 | this.defaultMessages = {};
|
618 | this.localeMessages = {};
|
619 | this.systemLanguage = systemLanguage.replace('_', '-');
|
620 | }
|
621 | init(locale) {
|
622 | return i18n_service_awaiter(this, void 0, void 0, function* () {
|
623 | if (this.inited) {
|
624 | throw new Error('i18n already initialized.');
|
625 | }
|
626 | if (this.supportedTranslationLocales == null || this.supportedTranslationLocales.length === 0) {
|
627 | throw new Error('supportedTranslationLocales not set.');
|
628 | }
|
629 | this.inited = true;
|
630 | this.locale = this.translationLocale = locale != null ? locale : this.systemLanguage;
|
631 | try {
|
632 | this.collator = new Intl.Collator(this.locale, { numeric: true, sensitivity: 'base' });
|
633 | }
|
634 | catch (_a) {
|
635 | this.collator = null;
|
636 | }
|
637 | if (this.supportedTranslationLocales.indexOf(this.translationLocale) === -1) {
|
638 | this.translationLocale = this.translationLocale.slice(0, 2);
|
639 | if (this.supportedTranslationLocales.indexOf(this.translationLocale) === -1) {
|
640 | this.translationLocale = this.supportedTranslationLocales[0];
|
641 | }
|
642 | }
|
643 | if (this.localesDirectory != null) {
|
644 | yield this.loadMessages(this.translationLocale, this.localeMessages);
|
645 | if (this.translationLocale !== this.supportedTranslationLocales[0]) {
|
646 | yield this.loadMessages(this.supportedTranslationLocales[0], this.defaultMessages);
|
647 | }
|
648 | }
|
649 | });
|
650 | }
|
651 | t(id, p1, p2, p3) {
|
652 | return this.translate(id, p1, p2, p3);
|
653 | }
|
654 | translate(id, p1, p2, p3) {
|
655 | let result;
|
656 | if (this.localeMessages.hasOwnProperty(id) && this.localeMessages[id]) {
|
657 | result = this.localeMessages[id];
|
658 | }
|
659 | else if (this.defaultMessages.hasOwnProperty(id) && this.defaultMessages[id]) {
|
660 | result = this.defaultMessages[id];
|
661 | }
|
662 | else {
|
663 | result = '';
|
664 | }
|
665 | if (result !== '') {
|
666 | if (p1 != null) {
|
667 | result = result.split('__$1__').join(p1);
|
668 | }
|
669 | if (p2 != null) {
|
670 | result = result.split('__$2__').join(p2);
|
671 | }
|
672 | if (p3 != null) {
|
673 | result = result.split('__$3__').join(p3);
|
674 | }
|
675 | }
|
676 | return result;
|
677 | }
|
678 | loadMessages(locale, messagesObj) {
|
679 | return i18n_service_awaiter(this, void 0, void 0, function* () {
|
680 | const formattedLocale = locale.replace('-', '_');
|
681 | const locales = yield this.getLocalesJson(formattedLocale);
|
682 | for (const prop in locales) {
|
683 | if (!locales.hasOwnProperty(prop)) {
|
684 | continue;
|
685 | }
|
686 | messagesObj[prop] = locales[prop].message;
|
687 | if (locales[prop].placeholders) {
|
688 | for (const placeProp in locales[prop].placeholders) {
|
689 | if (!locales[prop].placeholders.hasOwnProperty(placeProp) ||
|
690 | !locales[prop].placeholders[placeProp].content) {
|
691 | continue;
|
692 | }
|
693 | const replaceToken = '\\$' + placeProp.toUpperCase() + '\\$';
|
694 | let replaceContent = locales[prop].placeholders[placeProp].content;
|
695 | if (replaceContent === '$1' || replaceContent === '$2' || replaceContent === '$3') {
|
696 | replaceContent = '__$' + replaceContent + '__';
|
697 | }
|
698 | messagesObj[prop] = messagesObj[prop].replace(new RegExp(replaceToken, 'g'), replaceContent);
|
699 | }
|
700 | }
|
701 | }
|
702 | });
|
703 | }
|
704 | }
|
705 |
|
706 |
|
707 |
|
708 |
|
709 |
|
710 | class services_i18n_service_I18nService extends i18n_service_I18nService {
|
711 | constructor(systemLanguage, localesDirectory) {
|
712 | super(systemLanguage, localesDirectory, (formattedLocale) => {
|
713 | const filePath = external_path_["join"](__dirname, this.localesDirectory + '/' + formattedLocale + '/messages.json');
|
714 | const localesJson = external_fs_["readFileSync"](filePath, 'utf8');
|
715 | const locales = JSON.parse(localesJson.replace(/^\uFEFF/, ''));
|
716 | return Promise.resolve(locales);
|
717 | });
|
718 | this.supportedTranslationLocales = [
|
719 | 'en',
|
720 | ];
|
721 | }
|
722 | }
|
723 |
|
724 |
|
725 | class AttachmentData {
|
726 | constructor(response) {
|
727 | if (response == null) {
|
728 | return;
|
729 | }
|
730 | this.id = response.id;
|
731 | this.url = response.url;
|
732 | this.fileName = response.fileName;
|
733 | this.key = response.key;
|
734 | this.size = response.size;
|
735 | this.sizeName = response.sizeName;
|
736 | }
|
737 | }
|
738 |
|
739 |
|
740 | class AttachmentView {
|
741 | constructor(a) {
|
742 | this.id = null;
|
743 | this.url = null;
|
744 | this.size = null;
|
745 | this.sizeName = null;
|
746 | this.fileName = null;
|
747 | this.key = null;
|
748 | if (!a) {
|
749 | return;
|
750 | }
|
751 | this.id = a.id;
|
752 | this.url = a.url;
|
753 | this.size = a.size;
|
754 | this.sizeName = a.sizeName;
|
755 | }
|
756 | get fileSize() {
|
757 | try {
|
758 | if (this.size != null) {
|
759 | return parseInt(this.size, null);
|
760 | }
|
761 | }
|
762 | catch (_a) { }
|
763 | return 0;
|
764 | }
|
765 | }
|
766 |
|
767 |
|
768 | var EncryptionType;
|
769 | (function (EncryptionType) {
|
770 | EncryptionType[EncryptionType["AesCbc256_B64"] = 0] = "AesCbc256_B64";
|
771 | EncryptionType[EncryptionType["AesCbc128_HmacSha256_B64"] = 1] = "AesCbc128_HmacSha256_B64";
|
772 | EncryptionType[EncryptionType["AesCbc256_HmacSha256_B64"] = 2] = "AesCbc256_HmacSha256_B64";
|
773 | EncryptionType[EncryptionType["Rsa2048_OaepSha256_B64"] = 3] = "Rsa2048_OaepSha256_B64";
|
774 | EncryptionType[EncryptionType["Rsa2048_OaepSha1_B64"] = 4] = "Rsa2048_OaepSha1_B64";
|
775 | EncryptionType[EncryptionType["Rsa2048_OaepSha256_HmacSha256_B64"] = 5] = "Rsa2048_OaepSha256_HmacSha256_B64";
|
776 | EncryptionType[EncryptionType["Rsa2048_OaepSha1_HmacSha256_B64"] = 6] = "Rsa2048_OaepSha1_HmacSha256_B64";
|
777 | })(EncryptionType || (EncryptionType = {}));
|
778 |
|
779 |
|
780 | var external_tldjs_ = __webpack_require__(7);
|
781 |
|
782 |
|
783 |
|
784 |
|
785 | const nodeURL = typeof window === 'undefined' ? __webpack_require__(19) : null;
|
786 | class utils_Utils {
|
787 | static init() {
|
788 | if (utils_Utils.inited) {
|
789 | return;
|
790 | }
|
791 | utils_Utils.inited = true;
|
792 | utils_Utils.isNode = typeof process !== 'undefined' && process.release != null &&
|
793 | process.release.name === 'node';
|
794 | utils_Utils.isBrowser = typeof window !== 'undefined';
|
795 | utils_Utils.isNativeScript = !utils_Utils.isNode && !utils_Utils.isBrowser;
|
796 | utils_Utils.isMobileBrowser = utils_Utils.isBrowser && this.isMobile(window);
|
797 | utils_Utils.isAppleMobileBrowser = utils_Utils.isBrowser && this.isAppleMobile(window);
|
798 | utils_Utils.global = utils_Utils.isNativeScript ? global : (utils_Utils.isNode && !utils_Utils.isBrowser ? global : window);
|
799 | }
|
800 | static fromB64ToArray(str) {
|
801 | if (utils_Utils.isNode || utils_Utils.isNativeScript) {
|
802 | return new Uint8Array(Buffer.from(str, 'base64'));
|
803 | }
|
804 | else {
|
805 | const binaryString = window.atob(str);
|
806 | const bytes = new Uint8Array(binaryString.length);
|
807 | for (let i = 0; i < binaryString.length; i++) {
|
808 | bytes[i] = binaryString.charCodeAt(i);
|
809 | }
|
810 | return bytes;
|
811 | }
|
812 | }
|
813 | static fromHexToArray(str) {
|
814 | if (utils_Utils.isNode || utils_Utils.isNativeScript) {
|
815 | return new Uint8Array(Buffer.from(str, 'hex'));
|
816 | }
|
817 | else {
|
818 | const bytes = new Uint8Array(str.length / 2);
|
819 | for (let i = 0; i < str.length; i += 2) {
|
820 | bytes[i / 2] = parseInt(str.substr(i, 2), 16);
|
821 | }
|
822 | return bytes;
|
823 | }
|
824 | }
|
825 | static fromUtf8ToArray(str) {
|
826 | if (utils_Utils.isNode || utils_Utils.isNativeScript) {
|
827 | return new Uint8Array(Buffer.from(str, 'utf8'));
|
828 | }
|
829 | else {
|
830 | const strUtf8 = unescape(encodeURIComponent(str));
|
831 | const arr = new Uint8Array(strUtf8.length);
|
832 | for (let i = 0; i < strUtf8.length; i++) {
|
833 | arr[i] = strUtf8.charCodeAt(i);
|
834 | }
|
835 | return arr;
|
836 | }
|
837 | }
|
838 | static fromByteStringToArray(str) {
|
839 | const arr = new Uint8Array(str.length);
|
840 | for (let i = 0; i < str.length; i++) {
|
841 | arr[i] = str.charCodeAt(i);
|
842 | }
|
843 | return arr;
|
844 | }
|
845 | static fromBufferToB64(buffer) {
|
846 | if (utils_Utils.isNode || utils_Utils.isNativeScript) {
|
847 | return Buffer.from(buffer).toString('base64');
|
848 | }
|
849 | else {
|
850 | let binary = '';
|
851 | const bytes = new Uint8Array(buffer);
|
852 | for (let i = 0; i < bytes.byteLength; i++) {
|
853 | binary += String.fromCharCode(bytes[i]);
|
854 | }
|
855 | return window.btoa(binary);
|
856 | }
|
857 | }
|
858 | static fromBufferToUtf8(buffer) {
|
859 | if (utils_Utils.isNode || utils_Utils.isNativeScript) {
|
860 | return Buffer.from(buffer).toString('utf8');
|
861 | }
|
862 | else {
|
863 | const bytes = new Uint8Array(buffer);
|
864 | const encodedString = String.fromCharCode.apply(null, bytes);
|
865 | return decodeURIComponent(escape(encodedString));
|
866 | }
|
867 | }
|
868 | static fromBufferToByteString(buffer) {
|
869 | return String.fromCharCode.apply(null, new Uint8Array(buffer));
|
870 | }
|
871 |
|
872 | static fromBufferToHex(buffer) {
|
873 | if (utils_Utils.isNode || utils_Utils.isNativeScript) {
|
874 | return Buffer.from(buffer).toString('hex');
|
875 | }
|
876 | else {
|
877 | const bytes = new Uint8Array(buffer);
|
878 | return Array.prototype.map.call(bytes, (x) => ('00' + x.toString(16)).slice(-2)).join('');
|
879 | }
|
880 | }
|
881 | static fromUrlB64ToUtf8(b64Str) {
|
882 | let output = b64Str.replace(/-/g, '+').replace(/_/g, '/');
|
883 | switch (output.length % 4) {
|
884 | case 0:
|
885 | break;
|
886 | case 2:
|
887 | output += '==';
|
888 | break;
|
889 | case 3:
|
890 | output += '=';
|
891 | break;
|
892 | default:
|
893 | throw new Error('Illegal base64url string!');
|
894 | }
|
895 | return utils_Utils.fromB64ToUtf8(output);
|
896 | }
|
897 | static fromB64ToUtf8(b64Str) {
|
898 | if (utils_Utils.isNode || utils_Utils.isNativeScript) {
|
899 | return Buffer.from(b64Str, 'base64').toString('utf8');
|
900 | }
|
901 | else {
|
902 | return decodeURIComponent(escape(window.atob(b64Str)));
|
903 | }
|
904 | }
|
905 |
|
906 | static newGuid() {
|
907 | return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
908 |
|
909 | const r = Math.random() * 16 | 0;
|
910 |
|
911 | const v = c === 'x' ? r : (r & 0x3 | 0x8);
|
912 | return v.toString(16);
|
913 | });
|
914 | }
|
915 | static isGuid(id) {
|
916 | return RegExp(/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/, 'i').test(id);
|
917 | }
|
918 | static getHostname(uriString) {
|
919 | const url = utils_Utils.getUrl(uriString);
|
920 | try {
|
921 | return url != null ? url.hostname : null;
|
922 | }
|
923 | catch (_a) {
|
924 | return null;
|
925 | }
|
926 | }
|
927 | static getHost(uriString) {
|
928 | const url = utils_Utils.getUrl(uriString);
|
929 | try {
|
930 | return url != null ? url.host : null;
|
931 | }
|
932 | catch (_a) {
|
933 | return null;
|
934 | }
|
935 | }
|
936 | static getDomain(uriString) {
|
937 | if (uriString == null) {
|
938 | return null;
|
939 | }
|
940 | uriString = uriString.trim();
|
941 | if (uriString === '') {
|
942 | return null;
|
943 | }
|
944 | if (uriString.startsWith('data:')) {
|
945 | return null;
|
946 | }
|
947 | let httpUrl = uriString.startsWith('http://') || uriString.startsWith('https://');
|
948 | if (!httpUrl && uriString.indexOf('://') < 0 && utils_Utils.tldEndingRegex.test(uriString)) {
|
949 | uriString = 'http://' + uriString;
|
950 | httpUrl = true;
|
951 | }
|
952 | if (httpUrl) {
|
953 | try {
|
954 | const url = utils_Utils.getUrlObject(uriString);
|
955 | if (url.hostname === 'localhost' || utils_Utils.validIpAddress(url.hostname)) {
|
956 | return url.hostname;
|
957 | }
|
958 | const urlDomain = external_tldjs_ != null && external_tldjs_["getDomain"] != null ? external_tldjs_["getDomain"](url.hostname) : null;
|
959 | return urlDomain != null ? urlDomain : url.hostname;
|
960 | }
|
961 | catch (e) { }
|
962 | }
|
963 | const domain = external_tldjs_ != null && external_tldjs_["getDomain"] != null ? external_tldjs_["getDomain"](uriString) : null;
|
964 | if (domain != null) {
|
965 | return domain;
|
966 | }
|
967 | return null;
|
968 | }
|
969 | static getQueryParams(uriString) {
|
970 | const url = utils_Utils.getUrl(uriString);
|
971 | if (url == null || url.search == null || url.search === '') {
|
972 | return null;
|
973 | }
|
974 | const map = new Map();
|
975 | const pairs = (url.search[0] === '?' ? url.search.substr(1) : url.search).split('&');
|
976 | pairs.forEach((pair) => {
|
977 | const parts = pair.split('=');
|
978 | if (parts.length < 1) {
|
979 | return;
|
980 | }
|
981 | map.set(decodeURIComponent(parts[0]).toLowerCase(), parts[1] == null ? '' : decodeURIComponent(parts[1]));
|
982 | });
|
983 | return map;
|
984 | }
|
985 | static getSortFunction(i18nService, prop) {
|
986 | return (a, b) => {
|
987 | if (a[prop] == null && b[prop] != null) {
|
988 | return -1;
|
989 | }
|
990 | if (a[prop] != null && b[prop] == null) {
|
991 | return 1;
|
992 | }
|
993 | if (a[prop] == null && b[prop] == null) {
|
994 | return 0;
|
995 | }
|
996 | return i18nService.collator ? i18nService.collator.compare(a[prop], b[prop]) :
|
997 | a[prop].localeCompare(b[prop]);
|
998 | };
|
999 | }
|
1000 | static isNullOrWhitespace(str) {
|
1001 | return str == null || typeof str !== 'string' || str.trim() === '';
|
1002 | }
|
1003 | static validIpAddress(ipString) {
|
1004 |
|
1005 | const ipRegex = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
|
1006 | return ipRegex.test(ipString);
|
1007 | }
|
1008 | static isMobile(win) {
|
1009 | let mobile = false;
|
1010 | ((a) => {
|
1011 |
|
1012 | if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) {
|
1013 | mobile = true;
|
1014 | }
|
1015 | })(win.navigator.userAgent || win.navigator.vendor || win.opera);
|
1016 | return mobile || win.navigator.userAgent.match(/iPad/i) != null;
|
1017 | }
|
1018 | static isAppleMobile(win) {
|
1019 | return win.navigator.userAgent.match(/iPhone/i) != null || win.navigator.userAgent.match(/iPad/i) != null;
|
1020 | }
|
1021 | static getUrl(uriString) {
|
1022 | if (uriString == null) {
|
1023 | return null;
|
1024 | }
|
1025 | uriString = uriString.trim();
|
1026 | if (uriString === '') {
|
1027 | return null;
|
1028 | }
|
1029 | let url = utils_Utils.getUrlObject(uriString);
|
1030 | if (url == null) {
|
1031 | const hasHttpProtocol = uriString.indexOf('http://') === 0 || uriString.indexOf('https://') === 0;
|
1032 | if (!hasHttpProtocol && uriString.indexOf('.') > -1) {
|
1033 | url = utils_Utils.getUrlObject('http://' + uriString);
|
1034 | }
|
1035 | }
|
1036 | return url;
|
1037 | }
|
1038 | static getUrlObject(uriString) {
|
1039 | try {
|
1040 | if (nodeURL != null) {
|
1041 | return nodeURL.URL ? new nodeURL.URL(uriString) : nodeURL.parse(uriString);
|
1042 | }
|
1043 | else if (typeof URL === 'function') {
|
1044 | return new URL(uriString);
|
1045 | }
|
1046 | else if (window != null) {
|
1047 | const hasProtocol = uriString.indexOf('://') > -1;
|
1048 | if (!hasProtocol && uriString.indexOf('.') > -1) {
|
1049 | uriString = 'http://' + uriString;
|
1050 | }
|
1051 | else if (!hasProtocol) {
|
1052 | return null;
|
1053 | }
|
1054 | const anchor = window.document.createElement('a');
|
1055 | anchor.href = uriString;
|
1056 | return anchor;
|
1057 | }
|
1058 | }
|
1059 | catch (e) { }
|
1060 | return null;
|
1061 | }
|
1062 | }
|
1063 | utils_Utils.inited = false;
|
1064 | utils_Utils.isNativeScript = false;
|
1065 | utils_Utils.isNode = false;
|
1066 | utils_Utils.isBrowser = true;
|
1067 | utils_Utils.isMobileBrowser = false;
|
1068 | utils_Utils.isAppleMobileBrowser = false;
|
1069 | utils_Utils.global = null;
|
1070 | utils_Utils.tldEndingRegex = /.*\.(com|net|org|edu|uk|gov|ca|de|jp|fr|au|ru|ch|io|es|us|co|xyz|info|ly|mil)$/;
|
1071 | utils_Utils.init();
|
1072 |
|
1073 |
|
1074 | var cipherString_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
1075 | return new (P || (P = Promise))(function (resolve, reject) {
|
1076 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
1077 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
1078 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
1079 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
1080 | });
|
1081 | };
|
1082 |
|
1083 |
|
1084 | class cipherString_CipherString {
|
1085 | constructor(encryptedStringOrType, data, iv, mac) {
|
1086 | if (data != null) {
|
1087 |
|
1088 | const encType = encryptedStringOrType;
|
1089 | if (iv != null) {
|
1090 | this.encryptedString = encType + '.' + iv + '|' + data;
|
1091 | }
|
1092 | else {
|
1093 | this.encryptedString = encType + '.' + data;
|
1094 | }
|
1095 |
|
1096 | if (mac != null) {
|
1097 | this.encryptedString += ('|' + mac);
|
1098 | }
|
1099 | this.encryptionType = encType;
|
1100 | this.data = data;
|
1101 | this.iv = iv;
|
1102 | this.mac = mac;
|
1103 | return;
|
1104 | }
|
1105 | this.encryptedString = encryptedStringOrType;
|
1106 | if (!this.encryptedString) {
|
1107 | return;
|
1108 | }
|
1109 | const headerPieces = this.encryptedString.split('.');
|
1110 | let encPieces = null;
|
1111 | if (headerPieces.length === 2) {
|
1112 | try {
|
1113 | this.encryptionType = parseInt(headerPieces[0], null);
|
1114 | encPieces = headerPieces[1].split('|');
|
1115 | }
|
1116 | catch (e) {
|
1117 | return;
|
1118 | }
|
1119 | }
|
1120 | else {
|
1121 | encPieces = this.encryptedString.split('|');
|
1122 | this.encryptionType = encPieces.length === 3 ? EncryptionType.AesCbc128_HmacSha256_B64 :
|
1123 | EncryptionType.AesCbc256_B64;
|
1124 | }
|
1125 | switch (this.encryptionType) {
|
1126 | case EncryptionType.AesCbc128_HmacSha256_B64:
|
1127 | case EncryptionType.AesCbc256_HmacSha256_B64:
|
1128 | if (encPieces.length !== 3) {
|
1129 | return;
|
1130 | }
|
1131 | this.iv = encPieces[0];
|
1132 | this.data = encPieces[1];
|
1133 | this.mac = encPieces[2];
|
1134 | break;
|
1135 | case EncryptionType.AesCbc256_B64:
|
1136 | if (encPieces.length !== 2) {
|
1137 | return;
|
1138 | }
|
1139 | this.iv = encPieces[0];
|
1140 | this.data = encPieces[1];
|
1141 | break;
|
1142 | case EncryptionType.Rsa2048_OaepSha256_B64:
|
1143 | case EncryptionType.Rsa2048_OaepSha1_B64:
|
1144 | if (encPieces.length !== 1) {
|
1145 | return;
|
1146 | }
|
1147 | this.data = encPieces[0];
|
1148 | break;
|
1149 | default:
|
1150 | return;
|
1151 | }
|
1152 | }
|
1153 | decrypt(orgId) {
|
1154 | return cipherString_awaiter(this, void 0, void 0, function* () {
|
1155 | if (this.decryptedValue != null) {
|
1156 | return this.decryptedValue;
|
1157 | }
|
1158 | let cryptoService;
|
1159 | const containerService = utils_Utils.global.bitwardenContainerService;
|
1160 | if (containerService) {
|
1161 | cryptoService = containerService.getCryptoService();
|
1162 | }
|
1163 | else {
|
1164 | throw new Error('global bitwardenContainerService not initialized.');
|
1165 | }
|
1166 | try {
|
1167 | const orgKey = yield cryptoService.getOrgKey(orgId);
|
1168 | this.decryptedValue = yield cryptoService.decryptToUtf8(this, orgKey);
|
1169 | }
|
1170 | catch (e) {
|
1171 | this.decryptedValue = '[error: cannot decrypt]';
|
1172 | }
|
1173 | return this.decryptedValue;
|
1174 | });
|
1175 | }
|
1176 | }
|
1177 |
|
1178 |
|
1179 | var domainBase_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
1180 | return new (P || (P = Promise))(function (resolve, reject) {
|
1181 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
1182 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
1183 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
1184 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
1185 | });
|
1186 | };
|
1187 |
|
1188 | class domainBase_Domain {
|
1189 | buildDomainModel(domain, dataObj, map, alreadyEncrypted, notEncList = []) {
|
1190 | for (const prop in map) {
|
1191 | if (!map.hasOwnProperty(prop)) {
|
1192 | continue;
|
1193 | }
|
1194 | const objProp = dataObj[(map[prop] || prop)];
|
1195 | if (alreadyEncrypted === true || notEncList.indexOf(prop) > -1) {
|
1196 | domain[prop] = objProp ? objProp : null;
|
1197 | }
|
1198 | else {
|
1199 | domain[prop] = objProp ? new cipherString_CipherString(objProp) : null;
|
1200 | }
|
1201 | }
|
1202 | }
|
1203 | buildDataModel(domain, dataObj, map, notCipherStringList = []) {
|
1204 | for (const prop in map) {
|
1205 | if (!map.hasOwnProperty(prop)) {
|
1206 | continue;
|
1207 | }
|
1208 | const objProp = domain[(map[prop] || prop)];
|
1209 | if (notCipherStringList.indexOf(prop) > -1) {
|
1210 | dataObj[prop] = objProp != null ? objProp : null;
|
1211 | }
|
1212 | else {
|
1213 | dataObj[prop] = objProp != null ? objProp.encryptedString : null;
|
1214 | }
|
1215 | }
|
1216 | }
|
1217 | decryptObj(viewModel, map, orgId) {
|
1218 | return domainBase_awaiter(this, void 0, void 0, function* () {
|
1219 | const promises = [];
|
1220 | const self = this;
|
1221 | for (const prop in map) {
|
1222 | if (!map.hasOwnProperty(prop)) {
|
1223 | continue;
|
1224 | }
|
1225 |
|
1226 | (function (theProp) {
|
1227 | const p = Promise.resolve().then(() => {
|
1228 | const mapProp = map[theProp] || theProp;
|
1229 | if (self[mapProp]) {
|
1230 | return self[mapProp].decrypt(orgId);
|
1231 | }
|
1232 | return null;
|
1233 | }).then((val) => {
|
1234 | viewModel[theProp] = val;
|
1235 | });
|
1236 | promises.push(p);
|
1237 | })(prop);
|
1238 | }
|
1239 | yield Promise.all(promises);
|
1240 | return viewModel;
|
1241 | });
|
1242 | }
|
1243 | }
|
1244 |
|
1245 |
|
1246 |
|
1247 |
|
1248 | class symmetricCryptoKey_SymmetricCryptoKey {
|
1249 | constructor(key, encType) {
|
1250 | if (key == null) {
|
1251 | throw new Error('Must provide key');
|
1252 | }
|
1253 | if (encType == null) {
|
1254 | if (key.byteLength === 32) {
|
1255 | encType = EncryptionType.AesCbc256_B64;
|
1256 | }
|
1257 | else if (key.byteLength === 64) {
|
1258 | encType = EncryptionType.AesCbc256_HmacSha256_B64;
|
1259 | }
|
1260 | else {
|
1261 | throw new Error('Unable to determine encType.');
|
1262 | }
|
1263 | }
|
1264 | this.key = key;
|
1265 | this.encType = encType;
|
1266 | if (encType === EncryptionType.AesCbc256_B64 && key.byteLength === 32) {
|
1267 | this.encKey = key;
|
1268 | this.macKey = null;
|
1269 | }
|
1270 | else if (encType === EncryptionType.AesCbc128_HmacSha256_B64 && key.byteLength === 32) {
|
1271 | this.encKey = key.slice(0, 16);
|
1272 | this.macKey = key.slice(16, 32);
|
1273 | }
|
1274 | else if (encType === EncryptionType.AesCbc256_HmacSha256_B64 && key.byteLength === 64) {
|
1275 | this.encKey = key.slice(0, 32);
|
1276 | this.macKey = key.slice(32, 64);
|
1277 | }
|
1278 | else {
|
1279 | throw new Error('Unsupported encType/key length.');
|
1280 | }
|
1281 | if (this.key != null) {
|
1282 | this.keyB64 = utils_Utils.fromBufferToB64(this.key);
|
1283 | }
|
1284 | if (this.encKey != null) {
|
1285 | this.encKeyB64 = utils_Utils.fromBufferToB64(this.encKey);
|
1286 | }
|
1287 | if (this.macKey != null) {
|
1288 | this.macKeyB64 = utils_Utils.fromBufferToB64(this.macKey);
|
1289 | }
|
1290 | }
|
1291 | }
|
1292 |
|
1293 |
|
1294 | var attachment_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
1295 | return new (P || (P = Promise))(function (resolve, reject) {
|
1296 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
1297 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
1298 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
1299 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
1300 | });
|
1301 | };
|
1302 |
|
1303 |
|
1304 |
|
1305 |
|
1306 |
|
1307 | class attachment_Attachment extends domainBase_Domain {
|
1308 | constructor(obj, alreadyEncrypted = false) {
|
1309 | super();
|
1310 | if (obj == null) {
|
1311 | return;
|
1312 | }
|
1313 | this.size = obj.size;
|
1314 | this.buildDomainModel(this, obj, {
|
1315 | id: null,
|
1316 | url: null,
|
1317 | sizeName: null,
|
1318 | fileName: null,
|
1319 | key: null,
|
1320 | }, alreadyEncrypted, ['id', 'url', 'sizeName']);
|
1321 | }
|
1322 | decrypt(orgId) {
|
1323 | return attachment_awaiter(this, void 0, void 0, function* () {
|
1324 | const view = yield this.decryptObj(new AttachmentView(this), {
|
1325 | fileName: null,
|
1326 | }, orgId);
|
1327 | if (this.key != null) {
|
1328 | let cryptoService;
|
1329 | const containerService = utils_Utils.global.bitwardenContainerService;
|
1330 | if (containerService) {
|
1331 | cryptoService = containerService.getCryptoService();
|
1332 | }
|
1333 | else {
|
1334 | throw new Error('global bitwardenContainerService not initialized.');
|
1335 | }
|
1336 | try {
|
1337 | const orgKey = yield cryptoService.getOrgKey(orgId);
|
1338 | const decValue = yield cryptoService.decryptToBytes(this.key, orgKey);
|
1339 | view.key = new symmetricCryptoKey_SymmetricCryptoKey(decValue);
|
1340 | }
|
1341 | catch (e) {
|
1342 |
|
1343 | }
|
1344 | }
|
1345 | return view;
|
1346 | });
|
1347 | }
|
1348 | toAttachmentData() {
|
1349 | const a = new AttachmentData();
|
1350 | a.size = this.size;
|
1351 | this.buildDataModel(this, a, {
|
1352 | id: null,
|
1353 | url: null,
|
1354 | sizeName: null,
|
1355 | fileName: null,
|
1356 | key: null,
|
1357 | }, ['id', 'url', 'sizeName']);
|
1358 | return a;
|
1359 | }
|
1360 | }
|
1361 |
|
1362 |
|
1363 | class CardData {
|
1364 | constructor(data) {
|
1365 | if (data == null) {
|
1366 | return;
|
1367 | }
|
1368 | this.cardholderName = data.cardholderName;
|
1369 | this.brand = data.brand;
|
1370 | this.number = data.number;
|
1371 | this.expMonth = data.expMonth;
|
1372 | this.expYear = data.expYear;
|
1373 | this.code = data.code;
|
1374 | }
|
1375 | }
|
1376 |
|
1377 |
|
1378 | class CardView {
|
1379 |
|
1380 | constructor(c) {
|
1381 | this.cardholderName = null;
|
1382 | this.expMonth = null;
|
1383 | this.expYear = null;
|
1384 | this.code = null;
|
1385 |
|
1386 | this._brand = null;
|
1387 | this._number = null;
|
1388 | this._subTitle = null;
|
1389 |
|
1390 | }
|
1391 | get maskedCode() {
|
1392 | return this.code != null ? '•'.repeat(this.code.length) : null;
|
1393 | }
|
1394 | get brand() {
|
1395 | return this._brand;
|
1396 | }
|
1397 | set brand(value) {
|
1398 | this._brand = value;
|
1399 | this._subTitle = null;
|
1400 | }
|
1401 | get number() {
|
1402 | return this._number;
|
1403 | }
|
1404 | set number(value) {
|
1405 | this._number = value;
|
1406 | this._subTitle = null;
|
1407 | }
|
1408 | get subTitle() {
|
1409 | if (this._subTitle == null) {
|
1410 | this._subTitle = this.brand;
|
1411 | if (this.number != null && this.number.length >= 4) {
|
1412 | if (this._subTitle != null && this._subTitle !== '') {
|
1413 | this._subTitle += ', ';
|
1414 | }
|
1415 | else {
|
1416 | this._subTitle = '';
|
1417 | }
|
1418 |
|
1419 | const count = this.number.length >= 5 && this.number.match(new RegExp('^3[47]')) != null ? 5 : 4;
|
1420 | this._subTitle += ('*' + this.number.substr(this.number.length - count));
|
1421 | }
|
1422 | }
|
1423 | return this._subTitle;
|
1424 | }
|
1425 | get expiration() {
|
1426 | if (!this.expMonth && !this.expYear) {
|
1427 | return null;
|
1428 | }
|
1429 | let exp = this.expMonth != null ? ('0' + this.expMonth).slice(-2) : '__';
|
1430 | exp += (' / ' + (this.expYear != null ? this.formatYear(this.expYear) : '____'));
|
1431 | return exp;
|
1432 | }
|
1433 | formatYear(year) {
|
1434 | return year.length === 2 ? '20' + year : year;
|
1435 | }
|
1436 | }
|
1437 |
|
1438 |
|
1439 |
|
1440 |
|
1441 |
|
1442 | class card_Card extends domainBase_Domain {
|
1443 | constructor(obj, alreadyEncrypted = false) {
|
1444 | super();
|
1445 | if (obj == null) {
|
1446 | return;
|
1447 | }
|
1448 | this.buildDomainModel(this, obj, {
|
1449 | cardholderName: null,
|
1450 | brand: null,
|
1451 | number: null,
|
1452 | expMonth: null,
|
1453 | expYear: null,
|
1454 | code: null,
|
1455 | }, alreadyEncrypted, []);
|
1456 | }
|
1457 | decrypt(orgId) {
|
1458 | return this.decryptObj(new CardView(this), {
|
1459 | cardholderName: null,
|
1460 | brand: null,
|
1461 | number: null,
|
1462 | expMonth: null,
|
1463 | expYear: null,
|
1464 | code: null,
|
1465 | }, orgId);
|
1466 | }
|
1467 | toCardData() {
|
1468 | const c = new CardData();
|
1469 | this.buildDataModel(this, c, {
|
1470 | cardholderName: null,
|
1471 | brand: null,
|
1472 | number: null,
|
1473 | expMonth: null,
|
1474 | expYear: null,
|
1475 | code: null,
|
1476 | });
|
1477 | return c;
|
1478 | }
|
1479 | }
|
1480 |
|
1481 |
|
1482 | var CipherType;
|
1483 | (function (CipherType) {
|
1484 | CipherType[CipherType["Login"] = 1] = "Login";
|
1485 | CipherType[CipherType["SecureNote"] = 2] = "SecureNote";
|
1486 | CipherType[CipherType["Card"] = 3] = "Card";
|
1487 | CipherType[CipherType["Identity"] = 4] = "Identity";
|
1488 | })(CipherType || (CipherType = {}));
|
1489 |
|
1490 |
|
1491 | class FieldData {
|
1492 | constructor(response) {
|
1493 | if (response == null) {
|
1494 | return;
|
1495 | }
|
1496 | this.type = response.type;
|
1497 | this.name = response.name;
|
1498 | this.value = response.value;
|
1499 | }
|
1500 | }
|
1501 |
|
1502 |
|
1503 | class IdentityData {
|
1504 | constructor(data) {
|
1505 | if (data == null) {
|
1506 | return;
|
1507 | }
|
1508 | this.title = data.title;
|
1509 | this.firstName = data.firstName;
|
1510 | this.middleName = data.middleName;
|
1511 | this.lastName = data.lastName;
|
1512 | this.address1 = data.address1;
|
1513 | this.address2 = data.address2;
|
1514 | this.address3 = data.address3;
|
1515 | this.city = data.city;
|
1516 | this.state = data.state;
|
1517 | this.postalCode = data.postalCode;
|
1518 | this.country = data.country;
|
1519 | this.company = data.company;
|
1520 | this.email = data.email;
|
1521 | this.phone = data.phone;
|
1522 | this.ssn = data.ssn;
|
1523 | this.username = data.username;
|
1524 | this.passportNumber = data.passportNumber;
|
1525 | this.licenseNumber = data.licenseNumber;
|
1526 | }
|
1527 | }
|
1528 |
|
1529 |
|
1530 | class LoginUriData {
|
1531 | constructor(data) {
|
1532 | this.match = null;
|
1533 | if (data == null) {
|
1534 | return;
|
1535 | }
|
1536 | this.uri = data.uri;
|
1537 | this.match = data.match;
|
1538 | }
|
1539 | }
|
1540 |
|
1541 |
|
1542 |
|
1543 | class loginData_LoginData {
|
1544 | constructor(data) {
|
1545 | if (data == null) {
|
1546 | return;
|
1547 | }
|
1548 | this.username = data.username;
|
1549 | this.password = data.password;
|
1550 | this.passwordRevisionDate = data.passwordRevisionDate;
|
1551 | this.totp = data.totp;
|
1552 | if (data.uris) {
|
1553 | this.uris = data.uris.map((u) => new LoginUriData(u));
|
1554 | }
|
1555 | }
|
1556 | }
|
1557 |
|
1558 |
|
1559 | class PasswordHistoryData {
|
1560 | constructor(response) {
|
1561 | if (response == null) {
|
1562 | return;
|
1563 | }
|
1564 | this.password = response.password;
|
1565 | this.lastUsedDate = response.lastUsedDate;
|
1566 | }
|
1567 | }
|
1568 |
|
1569 |
|
1570 | class SecureNoteData {
|
1571 | constructor(data) {
|
1572 | if (data == null) {
|
1573 | return;
|
1574 | }
|
1575 | this.type = data.type;
|
1576 | }
|
1577 | }
|
1578 |
|
1579 |
|
1580 |
|
1581 |
|
1582 |
|
1583 |
|
1584 |
|
1585 |
|
1586 |
|
1587 |
|
1588 | class cipherData_CipherData {
|
1589 | constructor(response, userId, collectionIds) {
|
1590 | if (response == null) {
|
1591 | return;
|
1592 | }
|
1593 | this.id = response.id;
|
1594 | this.organizationId = response.organizationId;
|
1595 | this.folderId = response.folderId;
|
1596 | this.userId = userId;
|
1597 | this.edit = response.edit;
|
1598 | this.organizationUseTotp = response.organizationUseTotp;
|
1599 | this.favorite = response.favorite;
|
1600 | this.revisionDate = response.revisionDate;
|
1601 | this.type = response.type;
|
1602 | this.name = response.name;
|
1603 | this.notes = response.notes;
|
1604 | this.collectionIds = collectionIds != null ? collectionIds : response.collectionIds;
|
1605 | this.deletedDate = response.deletedDate;
|
1606 | switch (this.type) {
|
1607 | case CipherType.Login:
|
1608 | this.login = new loginData_LoginData(response.login);
|
1609 | break;
|
1610 | case CipherType.SecureNote:
|
1611 | this.secureNote = new SecureNoteData(response.secureNote);
|
1612 | break;
|
1613 | case CipherType.Card:
|
1614 | this.card = new CardData(response.card);
|
1615 | break;
|
1616 | case CipherType.Identity:
|
1617 | this.identity = new IdentityData(response.identity);
|
1618 | break;
|
1619 | default:
|
1620 | break;
|
1621 | }
|
1622 | if (response.fields != null) {
|
1623 | this.fields = response.fields.map((f) => new FieldData(f));
|
1624 | }
|
1625 | if (response.attachments != null) {
|
1626 | this.attachments = response.attachments.map((a) => new AttachmentData(a));
|
1627 | }
|
1628 | if (response.passwordHistory != null) {
|
1629 | this.passwordHistory = response.passwordHistory.map((ph) => new PasswordHistoryData(ph));
|
1630 | }
|
1631 | }
|
1632 | }
|
1633 |
|
1634 |
|
1635 |
|
1636 | class identityView_IdentityView {
|
1637 |
|
1638 | constructor(i) {
|
1639 | this.title = null;
|
1640 | this.middleName = null;
|
1641 | this.address1 = null;
|
1642 | this.address2 = null;
|
1643 | this.address3 = null;
|
1644 | this.city = null;
|
1645 | this.state = null;
|
1646 | this.postalCode = null;
|
1647 | this.country = null;
|
1648 | this.company = null;
|
1649 | this.email = null;
|
1650 | this.phone = null;
|
1651 | this.ssn = null;
|
1652 | this.username = null;
|
1653 | this.passportNumber = null;
|
1654 | this.licenseNumber = null;
|
1655 |
|
1656 | this._firstName = null;
|
1657 | this._lastName = null;
|
1658 | this._subTitle = null;
|
1659 |
|
1660 | }
|
1661 | get firstName() {
|
1662 | return this._firstName;
|
1663 | }
|
1664 | set firstName(value) {
|
1665 | this._firstName = value;
|
1666 | this._subTitle = null;
|
1667 | }
|
1668 | get lastName() {
|
1669 | return this._lastName;
|
1670 | }
|
1671 | set lastName(value) {
|
1672 | this._lastName = value;
|
1673 | this._subTitle = null;
|
1674 | }
|
1675 | get subTitle() {
|
1676 | if (this._subTitle == null && (this.firstName != null || this.lastName != null)) {
|
1677 | this._subTitle = '';
|
1678 | if (this.firstName != null) {
|
1679 | this._subTitle = this.firstName;
|
1680 | }
|
1681 | if (this.lastName != null) {
|
1682 | if (this._subTitle !== '') {
|
1683 | this._subTitle += ' ';
|
1684 | }
|
1685 | this._subTitle += this.lastName;
|
1686 | }
|
1687 | }
|
1688 | return this._subTitle;
|
1689 | }
|
1690 | get fullName() {
|
1691 | if (this.title != null || this.firstName != null || this.middleName != null || this.lastName != null) {
|
1692 | let name = '';
|
1693 | if (this.title != null) {
|
1694 | name += (this.title + ' ');
|
1695 | }
|
1696 | if (this.firstName != null) {
|
1697 | name += (this.firstName + ' ');
|
1698 | }
|
1699 | if (this.middleName != null) {
|
1700 | name += (this.middleName + ' ');
|
1701 | }
|
1702 | if (this.lastName != null) {
|
1703 | name += this.lastName;
|
1704 | }
|
1705 | return name.trim();
|
1706 | }
|
1707 | return null;
|
1708 | }
|
1709 | get fullAddress() {
|
1710 | let address = this.address1;
|
1711 | if (!utils_Utils.isNullOrWhitespace(this.address2)) {
|
1712 | if (!utils_Utils.isNullOrWhitespace(address)) {
|
1713 | address += ', ';
|
1714 | }
|
1715 | address += this.address2;
|
1716 | }
|
1717 | if (!utils_Utils.isNullOrWhitespace(this.address3)) {
|
1718 | if (!utils_Utils.isNullOrWhitespace(address)) {
|
1719 | address += ', ';
|
1720 | }
|
1721 | address += this.address3;
|
1722 | }
|
1723 | return address;
|
1724 | }
|
1725 | get fullAddressPart2() {
|
1726 | if (this.city == null && this.state == null && this.postalCode == null) {
|
1727 | return null;
|
1728 | }
|
1729 | const city = this.city || '-';
|
1730 | const state = this.state;
|
1731 | const postalCode = this.postalCode || '-';
|
1732 | let addressPart2 = city;
|
1733 | if (!utils_Utils.isNullOrWhitespace(state)) {
|
1734 | addressPart2 += ', ' + state;
|
1735 | }
|
1736 | addressPart2 += ', ' + postalCode;
|
1737 | return addressPart2;
|
1738 | }
|
1739 | }
|
1740 |
|
1741 |
|
1742 | class LoginView {
|
1743 | constructor(l) {
|
1744 | this.username = null;
|
1745 | this.password = null;
|
1746 | this.passwordRevisionDate = null;
|
1747 | this.totp = null;
|
1748 | this.uris = null;
|
1749 | if (!l) {
|
1750 | return;
|
1751 | }
|
1752 | this.passwordRevisionDate = l.passwordRevisionDate;
|
1753 | }
|
1754 | get uri() {
|
1755 | return this.hasUris ? this.uris[0].uri : null;
|
1756 | }
|
1757 | get maskedPassword() {
|
1758 | return this.password != null ? '••••••••' : null;
|
1759 | }
|
1760 | get subTitle() {
|
1761 | return this.username;
|
1762 | }
|
1763 | get canLaunch() {
|
1764 | return this.hasUris && this.uris.some((u) => u.canLaunch);
|
1765 | }
|
1766 | get launchUri() {
|
1767 | if (this.hasUris) {
|
1768 | const uri = this.uris.find((u) => u.canLaunch);
|
1769 | if (uri != null) {
|
1770 | return uri.launchUri;
|
1771 | }
|
1772 | }
|
1773 | return null;
|
1774 | }
|
1775 | get hasUris() {
|
1776 | return this.uris != null && this.uris.length > 0;
|
1777 | }
|
1778 | }
|
1779 |
|
1780 |
|
1781 | class SecureNoteView {
|
1782 | constructor(n) {
|
1783 | this.type = null;
|
1784 | if (!n) {
|
1785 | return;
|
1786 | }
|
1787 | this.type = n.type;
|
1788 | }
|
1789 | get subTitle() {
|
1790 | return null;
|
1791 | }
|
1792 | }
|
1793 |
|
1794 |
|
1795 |
|
1796 |
|
1797 |
|
1798 |
|
1799 |
|
1800 | class cipherView_CipherView {
|
1801 | constructor(c) {
|
1802 | this.id = null;
|
1803 | this.organizationId = null;
|
1804 | this.folderId = null;
|
1805 | this.name = null;
|
1806 | this.notes = null;
|
1807 | this.type = null;
|
1808 | this.favorite = false;
|
1809 | this.organizationUseTotp = false;
|
1810 | this.edit = false;
|
1811 | this.login = new LoginView();
|
1812 | this.identity = new identityView_IdentityView();
|
1813 | this.card = new CardView();
|
1814 | this.secureNote = new SecureNoteView();
|
1815 | this.attachments = null;
|
1816 | this.fields = null;
|
1817 | this.passwordHistory = null;
|
1818 | this.collectionIds = null;
|
1819 | this.revisionDate = null;
|
1820 | this.deletedDate = null;
|
1821 | if (!c) {
|
1822 | return;
|
1823 | }
|
1824 | this.id = c.id;
|
1825 | this.organizationId = c.organizationId;
|
1826 | this.folderId = c.folderId;
|
1827 | this.favorite = c.favorite;
|
1828 | this.organizationUseTotp = c.organizationUseTotp;
|
1829 | this.edit = c.edit;
|
1830 | this.type = c.type;
|
1831 | this.localData = c.localData;
|
1832 | this.collectionIds = c.collectionIds;
|
1833 | this.revisionDate = c.revisionDate;
|
1834 | this.deletedDate = c.deletedDate;
|
1835 | }
|
1836 | get subTitle() {
|
1837 | switch (this.type) {
|
1838 | case CipherType.Login:
|
1839 | return this.login.subTitle;
|
1840 | case CipherType.SecureNote:
|
1841 | return this.secureNote.subTitle;
|
1842 | case CipherType.Card:
|
1843 | return this.card.subTitle;
|
1844 | case CipherType.Identity:
|
1845 | return this.identity.subTitle;
|
1846 | default:
|
1847 | break;
|
1848 | }
|
1849 | return null;
|
1850 | }
|
1851 | get hasPasswordHistory() {
|
1852 | return this.passwordHistory && this.passwordHistory.length > 0;
|
1853 | }
|
1854 | get hasAttachments() {
|
1855 | return this.attachments && this.attachments.length > 0;
|
1856 | }
|
1857 | get hasOldAttachments() {
|
1858 | if (this.hasAttachments) {
|
1859 | for (let i = 0; i < this.attachments.length; i++) {
|
1860 | if (this.attachments[i].key == null) {
|
1861 | return true;
|
1862 | }
|
1863 | }
|
1864 | }
|
1865 | return false;
|
1866 | }
|
1867 | get hasFields() {
|
1868 | return this.fields && this.fields.length > 0;
|
1869 | }
|
1870 | get passwordRevisionDisplayDate() {
|
1871 | if (this.type !== CipherType.Login || this.login == null) {
|
1872 | return null;
|
1873 | }
|
1874 | else if (this.login.password == null || this.login.password === '') {
|
1875 | return null;
|
1876 | }
|
1877 | return this.login.passwordRevisionDate;
|
1878 | }
|
1879 | get isDeleted() {
|
1880 | return this.deletedDate != null;
|
1881 | }
|
1882 | }
|
1883 |
|
1884 |
|
1885 | class FieldView {
|
1886 | constructor(f) {
|
1887 | this.name = null;
|
1888 | this.value = null;
|
1889 | this.type = null;
|
1890 | if (!f) {
|
1891 | return;
|
1892 | }
|
1893 | this.type = f.type;
|
1894 | }
|
1895 | get maskedValue() {
|
1896 | return this.value != null ? '••••••••' : null;
|
1897 | }
|
1898 | }
|
1899 |
|
1900 |
|
1901 |
|
1902 |
|
1903 |
|
1904 | class field_Field extends domainBase_Domain {
|
1905 | constructor(obj, alreadyEncrypted = false) {
|
1906 | super();
|
1907 | if (obj == null) {
|
1908 | return;
|
1909 | }
|
1910 | this.type = obj.type;
|
1911 | this.buildDomainModel(this, obj, {
|
1912 | name: null,
|
1913 | value: null,
|
1914 | }, alreadyEncrypted, []);
|
1915 | }
|
1916 | decrypt(orgId) {
|
1917 | return this.decryptObj(new FieldView(this), {
|
1918 | name: null,
|
1919 | value: null,
|
1920 | }, orgId);
|
1921 | }
|
1922 | toFieldData() {
|
1923 | const f = new FieldData();
|
1924 | this.buildDataModel(this, f, {
|
1925 | name: null,
|
1926 | value: null,
|
1927 | type: null,
|
1928 | }, ['type']);
|
1929 | return f;
|
1930 | }
|
1931 | }
|
1932 |
|
1933 |
|
1934 |
|
1935 |
|
1936 |
|
1937 | class identity_Identity extends domainBase_Domain {
|
1938 | constructor(obj, alreadyEncrypted = false) {
|
1939 | super();
|
1940 | if (obj == null) {
|
1941 | return;
|
1942 | }
|
1943 | this.buildDomainModel(this, obj, {
|
1944 | title: null,
|
1945 | firstName: null,
|
1946 | middleName: null,
|
1947 | lastName: null,
|
1948 | address1: null,
|
1949 | address2: null,
|
1950 | address3: null,
|
1951 | city: null,
|
1952 | state: null,
|
1953 | postalCode: null,
|
1954 | country: null,
|
1955 | company: null,
|
1956 | email: null,
|
1957 | phone: null,
|
1958 | ssn: null,
|
1959 | username: null,
|
1960 | passportNumber: null,
|
1961 | licenseNumber: null,
|
1962 | }, alreadyEncrypted, []);
|
1963 | }
|
1964 | decrypt(orgId) {
|
1965 | return this.decryptObj(new identityView_IdentityView(this), {
|
1966 | title: null,
|
1967 | firstName: null,
|
1968 | middleName: null,
|
1969 | lastName: null,
|
1970 | address1: null,
|
1971 | address2: null,
|
1972 | address3: null,
|
1973 | city: null,
|
1974 | state: null,
|
1975 | postalCode: null,
|
1976 | country: null,
|
1977 | company: null,
|
1978 | email: null,
|
1979 | phone: null,
|
1980 | ssn: null,
|
1981 | username: null,
|
1982 | passportNumber: null,
|
1983 | licenseNumber: null,
|
1984 | }, orgId);
|
1985 | }
|
1986 | toIdentityData() {
|
1987 | const i = new IdentityData();
|
1988 | this.buildDataModel(this, i, {
|
1989 | title: null,
|
1990 | firstName: null,
|
1991 | middleName: null,
|
1992 | lastName: null,
|
1993 | address1: null,
|
1994 | address2: null,
|
1995 | address3: null,
|
1996 | city: null,
|
1997 | state: null,
|
1998 | postalCode: null,
|
1999 | country: null,
|
2000 | company: null,
|
2001 | email: null,
|
2002 | phone: null,
|
2003 | ssn: null,
|
2004 | username: null,
|
2005 | passportNumber: null,
|
2006 | licenseNumber: null,
|
2007 | });
|
2008 | return i;
|
2009 | }
|
2010 | }
|
2011 |
|
2012 |
|
2013 | var UriMatchType;
|
2014 | (function (UriMatchType) {
|
2015 | UriMatchType[UriMatchType["Domain"] = 0] = "Domain";
|
2016 | UriMatchType[UriMatchType["Host"] = 1] = "Host";
|
2017 | UriMatchType[UriMatchType["StartsWith"] = 2] = "StartsWith";
|
2018 | UriMatchType[UriMatchType["Exact"] = 3] = "Exact";
|
2019 | UriMatchType[UriMatchType["RegularExpression"] = 4] = "RegularExpression";
|
2020 | UriMatchType[UriMatchType["Never"] = 5] = "Never";
|
2021 | })(UriMatchType || (UriMatchType = {}));
|
2022 |
|
2023 |
|
2024 |
|
2025 |
|
2026 | const CanLaunchWhitelist = [
|
2027 | 'https://',
|
2028 | 'http://',
|
2029 | 'ssh://',
|
2030 | 'ftp://',
|
2031 | 'sftp://',
|
2032 | 'irc://',
|
2033 | 'vnc://',
|
2034 | 'chrome://',
|
2035 | 'iosapp://',
|
2036 | 'androidapp://',
|
2037 | ];
|
2038 | class loginUriView_LoginUriView {
|
2039 |
|
2040 | constructor(u) {
|
2041 | this.match = null;
|
2042 |
|
2043 | this._uri = null;
|
2044 | this._domain = null;
|
2045 | this._hostname = null;
|
2046 | this._canLaunch = null;
|
2047 | if (!u) {
|
2048 | return;
|
2049 | }
|
2050 | this.match = u.match;
|
2051 | }
|
2052 | get uri() {
|
2053 | return this._uri;
|
2054 | }
|
2055 | set uri(value) {
|
2056 | this._uri = value;
|
2057 | this._domain = null;
|
2058 | this._canLaunch = null;
|
2059 | }
|
2060 | get domain() {
|
2061 | if (this._domain == null && this.uri != null) {
|
2062 | this._domain = utils_Utils.getDomain(this.uri);
|
2063 | if (this._domain === '') {
|
2064 | this._domain = null;
|
2065 | }
|
2066 | }
|
2067 | return this._domain;
|
2068 | }
|
2069 | get hostname() {
|
2070 | if (this._hostname == null && this.uri != null) {
|
2071 | this._hostname = utils_Utils.getHostname(this.uri);
|
2072 | if (this._hostname === '') {
|
2073 | this._hostname = null;
|
2074 | }
|
2075 | }
|
2076 | return this._hostname;
|
2077 | }
|
2078 | get hostnameOrUri() {
|
2079 | return this.hostname != null ? this.hostname : this.uri;
|
2080 | }
|
2081 | get isWebsite() {
|
2082 | return this.uri != null && (this.uri.indexOf('http://') === 0 || this.uri.indexOf('https://') === 0 ||
|
2083 | (this.uri.indexOf('://') < 0 && utils_Utils.tldEndingRegex.test(this.uri)));
|
2084 | }
|
2085 | get canLaunch() {
|
2086 | if (this._canLaunch != null) {
|
2087 | return this._canLaunch;
|
2088 | }
|
2089 | if (this.uri != null && this.match !== UriMatchType.RegularExpression) {
|
2090 | const uri = this.launchUri;
|
2091 | for (let i = 0; i < CanLaunchWhitelist.length; i++) {
|
2092 | if (uri.indexOf(CanLaunchWhitelist[i]) === 0) {
|
2093 | this._canLaunch = true;
|
2094 | return this._canLaunch;
|
2095 | }
|
2096 | }
|
2097 | }
|
2098 | this._canLaunch = false;
|
2099 | return this._canLaunch;
|
2100 | }
|
2101 | get launchUri() {
|
2102 | return this.uri.indexOf('://') < 0 && utils_Utils.tldEndingRegex.test(this.uri) ? ('http://' + this.uri) : this.uri;
|
2103 | }
|
2104 | }
|
2105 |
|
2106 |
|
2107 |
|
2108 |
|
2109 |
|
2110 | class loginUri_LoginUri extends domainBase_Domain {
|
2111 | constructor(obj, alreadyEncrypted = false) {
|
2112 | super();
|
2113 | if (obj == null) {
|
2114 | return;
|
2115 | }
|
2116 | this.match = obj.match;
|
2117 | this.buildDomainModel(this, obj, {
|
2118 | uri: null,
|
2119 | }, alreadyEncrypted, []);
|
2120 | }
|
2121 | decrypt(orgId) {
|
2122 | return this.decryptObj(new loginUriView_LoginUriView(this), {
|
2123 | uri: null,
|
2124 | }, orgId);
|
2125 | }
|
2126 | toLoginUriData() {
|
2127 | const u = new LoginUriData();
|
2128 | this.buildDataModel(this, u, {
|
2129 | uri: null,
|
2130 | }, ['match']);
|
2131 | return u;
|
2132 | }
|
2133 | }
|
2134 |
|
2135 |
|
2136 | var login_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2137 | return new (P || (P = Promise))(function (resolve, reject) {
|
2138 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
2139 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
2140 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
2141 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
2142 | });
|
2143 | };
|
2144 |
|
2145 |
|
2146 |
|
2147 |
|
2148 | class login_Login extends domainBase_Domain {
|
2149 | constructor(obj, alreadyEncrypted = false) {
|
2150 | super();
|
2151 | if (obj == null) {
|
2152 | return;
|
2153 | }
|
2154 | this.passwordRevisionDate = obj.passwordRevisionDate != null ? new Date(obj.passwordRevisionDate) : null;
|
2155 | this.buildDomainModel(this, obj, {
|
2156 | username: null,
|
2157 | password: null,
|
2158 | totp: null,
|
2159 | }, alreadyEncrypted, []);
|
2160 | if (obj.uris) {
|
2161 | this.uris = [];
|
2162 | obj.uris.forEach((u) => {
|
2163 | this.uris.push(new loginUri_LoginUri(u, alreadyEncrypted));
|
2164 | });
|
2165 | }
|
2166 | }
|
2167 | decrypt(orgId) {
|
2168 | return login_awaiter(this, void 0, void 0, function* () {
|
2169 | const view = yield this.decryptObj(new LoginView(this), {
|
2170 | username: null,
|
2171 | password: null,
|
2172 | totp: null,
|
2173 | }, orgId);
|
2174 | if (this.uris != null) {
|
2175 | view.uris = [];
|
2176 | for (let i = 0; i < this.uris.length; i++) {
|
2177 | const uri = yield this.uris[i].decrypt(orgId);
|
2178 | view.uris.push(uri);
|
2179 | }
|
2180 | }
|
2181 | return view;
|
2182 | });
|
2183 | }
|
2184 | toLoginData() {
|
2185 | const l = new loginData_LoginData();
|
2186 | l.passwordRevisionDate = this.passwordRevisionDate != null ? this.passwordRevisionDate.toISOString() : null;
|
2187 | this.buildDataModel(this, l, {
|
2188 | username: null,
|
2189 | password: null,
|
2190 | totp: null,
|
2191 | });
|
2192 | if (this.uris != null && this.uris.length > 0) {
|
2193 | l.uris = [];
|
2194 | this.uris.forEach((u) => {
|
2195 | l.uris.push(u.toLoginUriData());
|
2196 | });
|
2197 | }
|
2198 | return l;
|
2199 | }
|
2200 | }
|
2201 |
|
2202 |
|
2203 | class PasswordHistoryView {
|
2204 | constructor(ph) {
|
2205 | this.password = null;
|
2206 | this.lastUsedDate = null;
|
2207 | if (!ph) {
|
2208 | return;
|
2209 | }
|
2210 | this.lastUsedDate = ph.lastUsedDate;
|
2211 | }
|
2212 | }
|
2213 |
|
2214 |
|
2215 |
|
2216 |
|
2217 |
|
2218 | class password_Password extends domainBase_Domain {
|
2219 | constructor(obj, alreadyEncrypted = false) {
|
2220 | super();
|
2221 | if (obj == null) {
|
2222 | return;
|
2223 | }
|
2224 | this.buildDomainModel(this, obj, {
|
2225 | password: null,
|
2226 | }, alreadyEncrypted);
|
2227 | this.lastUsedDate = new Date(obj.lastUsedDate);
|
2228 | }
|
2229 | decrypt(orgId) {
|
2230 | return this.decryptObj(new PasswordHistoryView(this), {
|
2231 | password: null,
|
2232 | }, orgId);
|
2233 | }
|
2234 | toPasswordHistoryData() {
|
2235 | const ph = new PasswordHistoryData();
|
2236 | ph.lastUsedDate = this.lastUsedDate.toISOString();
|
2237 | this.buildDataModel(this, ph, {
|
2238 | password: null,
|
2239 | });
|
2240 | return ph;
|
2241 | }
|
2242 | }
|
2243 |
|
2244 |
|
2245 |
|
2246 |
|
2247 |
|
2248 | class secureNote_SecureNote extends domainBase_Domain {
|
2249 | constructor(obj, alreadyEncrypted = false) {
|
2250 | super();
|
2251 | if (obj == null) {
|
2252 | return;
|
2253 | }
|
2254 | this.type = obj.type;
|
2255 | }
|
2256 | decrypt(orgId) {
|
2257 | return Promise.resolve(new SecureNoteView(this));
|
2258 | }
|
2259 | toSecureNoteData() {
|
2260 | const n = new SecureNoteData();
|
2261 | n.type = this.type;
|
2262 | return n;
|
2263 | }
|
2264 | }
|
2265 |
|
2266 |
|
2267 | var cipher_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2268 | return new (P || (P = Promise))(function (resolve, reject) {
|
2269 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
2270 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
2271 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
2272 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
2273 | });
|
2274 | };
|
2275 |
|
2276 |
|
2277 |
|
2278 |
|
2279 |
|
2280 |
|
2281 |
|
2282 |
|
2283 |
|
2284 |
|
2285 |
|
2286 | class cipher_Cipher extends domainBase_Domain {
|
2287 | constructor(obj, alreadyEncrypted = false, localData = null) {
|
2288 | super();
|
2289 | if (obj == null) {
|
2290 | return;
|
2291 | }
|
2292 | this.buildDomainModel(this, obj, {
|
2293 | id: null,
|
2294 | userId: null,
|
2295 | organizationId: null,
|
2296 | folderId: null,
|
2297 | name: null,
|
2298 | notes: null,
|
2299 | }, alreadyEncrypted, ['id', 'userId', 'organizationId', 'folderId']);
|
2300 | this.type = obj.type;
|
2301 | this.favorite = obj.favorite;
|
2302 | this.organizationUseTotp = obj.organizationUseTotp;
|
2303 | this.edit = obj.edit;
|
2304 | this.revisionDate = obj.revisionDate != null ? new Date(obj.revisionDate) : null;
|
2305 | this.collectionIds = obj.collectionIds;
|
2306 | this.localData = localData;
|
2307 | this.deletedDate = obj.deletedDate != null ? new Date(obj.deletedDate) : null;
|
2308 | switch (this.type) {
|
2309 | case CipherType.Login:
|
2310 | this.login = new login_Login(obj.login, alreadyEncrypted);
|
2311 | break;
|
2312 | case CipherType.SecureNote:
|
2313 | this.secureNote = new secureNote_SecureNote(obj.secureNote, alreadyEncrypted);
|
2314 | break;
|
2315 | case CipherType.Card:
|
2316 | this.card = new card_Card(obj.card, alreadyEncrypted);
|
2317 | break;
|
2318 | case CipherType.Identity:
|
2319 | this.identity = new identity_Identity(obj.identity, alreadyEncrypted);
|
2320 | break;
|
2321 | default:
|
2322 | break;
|
2323 | }
|
2324 | if (obj.attachments != null) {
|
2325 | this.attachments = obj.attachments.map((a) => new attachment_Attachment(a, alreadyEncrypted));
|
2326 | }
|
2327 | else {
|
2328 | this.attachments = null;
|
2329 | }
|
2330 | if (obj.fields != null) {
|
2331 | this.fields = obj.fields.map((f) => new field_Field(f, alreadyEncrypted));
|
2332 | }
|
2333 | else {
|
2334 | this.fields = null;
|
2335 | }
|
2336 | if (obj.passwordHistory != null) {
|
2337 | this.passwordHistory = obj.passwordHistory.map((ph) => new password_Password(ph, alreadyEncrypted));
|
2338 | }
|
2339 | else {
|
2340 | this.passwordHistory = null;
|
2341 | }
|
2342 | }
|
2343 | decrypt() {
|
2344 | return cipher_awaiter(this, void 0, void 0, function* () {
|
2345 | const model = new cipherView_CipherView(this);
|
2346 | yield this.decryptObj(model, {
|
2347 | name: null,
|
2348 | notes: null,
|
2349 | }, this.organizationId);
|
2350 | switch (this.type) {
|
2351 | case CipherType.Login:
|
2352 | model.login = yield this.login.decrypt(this.organizationId);
|
2353 | break;
|
2354 | case CipherType.SecureNote:
|
2355 | model.secureNote = yield this.secureNote.decrypt(this.organizationId);
|
2356 | break;
|
2357 | case CipherType.Card:
|
2358 | model.card = yield this.card.decrypt(this.organizationId);
|
2359 | break;
|
2360 | case CipherType.Identity:
|
2361 | model.identity = yield this.identity.decrypt(this.organizationId);
|
2362 | break;
|
2363 | default:
|
2364 | break;
|
2365 | }
|
2366 | const orgId = this.organizationId;
|
2367 | if (this.attachments != null && this.attachments.length > 0) {
|
2368 | const attachments = [];
|
2369 | yield this.attachments.reduce((promise, attachment) => {
|
2370 | return promise.then(() => {
|
2371 | return attachment.decrypt(orgId);
|
2372 | }).then((decAttachment) => {
|
2373 | attachments.push(decAttachment);
|
2374 | });
|
2375 | }, Promise.resolve());
|
2376 | model.attachments = attachments;
|
2377 | }
|
2378 | if (this.fields != null && this.fields.length > 0) {
|
2379 | const fields = [];
|
2380 | yield this.fields.reduce((promise, field) => {
|
2381 | return promise.then(() => {
|
2382 | return field.decrypt(orgId);
|
2383 | }).then((decField) => {
|
2384 | fields.push(decField);
|
2385 | });
|
2386 | }, Promise.resolve());
|
2387 | model.fields = fields;
|
2388 | }
|
2389 | if (this.passwordHistory != null && this.passwordHistory.length > 0) {
|
2390 | const passwordHistory = [];
|
2391 | yield this.passwordHistory.reduce((promise, ph) => {
|
2392 | return promise.then(() => {
|
2393 | return ph.decrypt(orgId);
|
2394 | }).then((decPh) => {
|
2395 | passwordHistory.push(decPh);
|
2396 | });
|
2397 | }, Promise.resolve());
|
2398 | model.passwordHistory = passwordHistory;
|
2399 | }
|
2400 | return model;
|
2401 | });
|
2402 | }
|
2403 | toCipherData(userId) {
|
2404 | const c = new cipherData_CipherData();
|
2405 | c.id = this.id;
|
2406 | c.organizationId = this.organizationId;
|
2407 | c.folderId = this.folderId;
|
2408 | c.userId = this.organizationId != null ? userId : null;
|
2409 | c.edit = this.edit;
|
2410 | c.organizationUseTotp = this.organizationUseTotp;
|
2411 | c.favorite = this.favorite;
|
2412 | c.revisionDate = this.revisionDate != null ? this.revisionDate.toISOString() : null;
|
2413 | c.type = this.type;
|
2414 | c.collectionIds = this.collectionIds;
|
2415 | c.deletedDate = this.deletedDate != null ? this.deletedDate.toISOString() : null;
|
2416 | this.buildDataModel(this, c, {
|
2417 | name: null,
|
2418 | notes: null,
|
2419 | });
|
2420 | switch (c.type) {
|
2421 | case CipherType.Login:
|
2422 | c.login = this.login.toLoginData();
|
2423 | break;
|
2424 | case CipherType.SecureNote:
|
2425 | c.secureNote = this.secureNote.toSecureNoteData();
|
2426 | break;
|
2427 | case CipherType.Card:
|
2428 | c.card = this.card.toCardData();
|
2429 | break;
|
2430 | case CipherType.Identity:
|
2431 | c.identity = this.identity.toIdentityData();
|
2432 | break;
|
2433 | default:
|
2434 | break;
|
2435 | }
|
2436 | if (this.fields != null) {
|
2437 | c.fields = this.fields.map((f) => f.toFieldData());
|
2438 | }
|
2439 | if (this.attachments != null) {
|
2440 | c.attachments = this.attachments.map((a) => a.toAttachmentData());
|
2441 | }
|
2442 | if (this.passwordHistory != null) {
|
2443 | c.passwordHistory = this.passwordHistory.map((ph) => ph.toPasswordHistoryData());
|
2444 | }
|
2445 | return c;
|
2446 | }
|
2447 | }
|
2448 |
|
2449 |
|
2450 |
|
2451 | class collectionView_CollectionView {
|
2452 | constructor(c) {
|
2453 | this.id = null;
|
2454 | this.organizationId = null;
|
2455 | this.name = null;
|
2456 | this.externalId = null;
|
2457 | this.readOnly = null;
|
2458 | if (!c) {
|
2459 | return;
|
2460 | }
|
2461 | this.id = c.id;
|
2462 | this.organizationId = c.organizationId;
|
2463 | this.externalId = c.externalId;
|
2464 | if (c instanceof collection_Collection) {
|
2465 | this.readOnly = c.readOnly;
|
2466 | }
|
2467 | }
|
2468 | }
|
2469 |
|
2470 |
|
2471 |
|
2472 |
|
2473 | class collection_Collection extends domainBase_Domain {
|
2474 | constructor(obj, alreadyEncrypted = false) {
|
2475 | super();
|
2476 | if (obj == null) {
|
2477 | return;
|
2478 | }
|
2479 | this.buildDomainModel(this, obj, {
|
2480 | id: null,
|
2481 | organizationId: null,
|
2482 | name: null,
|
2483 | externalId: null,
|
2484 | readOnly: null,
|
2485 | }, alreadyEncrypted, ['id', 'organizationId', 'externalId', 'readOnly']);
|
2486 | }
|
2487 | decrypt() {
|
2488 | return this.decryptObj(new collectionView_CollectionView(this), {
|
2489 | name: null,
|
2490 | }, this.organizationId);
|
2491 | }
|
2492 | }
|
2493 |
|
2494 |
|
2495 | class EncryptedObject {
|
2496 | }
|
2497 |
|
2498 |
|
2499 | class EnvironmentUrls {
|
2500 | }
|
2501 |
|
2502 |
|
2503 | class FolderView {
|
2504 | constructor(f) {
|
2505 | this.id = null;
|
2506 | this.name = null;
|
2507 | this.revisionDate = null;
|
2508 | if (!f) {
|
2509 | return;
|
2510 | }
|
2511 | this.id = f.id;
|
2512 | this.revisionDate = f.revisionDate;
|
2513 | }
|
2514 | }
|
2515 |
|
2516 |
|
2517 |
|
2518 |
|
2519 | class folder_Folder extends domainBase_Domain {
|
2520 | constructor(obj, alreadyEncrypted = false) {
|
2521 | super();
|
2522 | if (obj == null) {
|
2523 | return;
|
2524 | }
|
2525 | this.buildDomainModel(this, obj, {
|
2526 | id: null,
|
2527 | name: null,
|
2528 | }, alreadyEncrypted, ['id']);
|
2529 | this.revisionDate = obj.revisionDate != null ? new Date(obj.revisionDate) : null;
|
2530 | }
|
2531 | decrypt() {
|
2532 | return this.decryptObj(new FolderView(this), {
|
2533 | name: null,
|
2534 | }, null);
|
2535 | }
|
2536 | }
|
2537 |
|
2538 |
|
2539 | class GeneratedPasswordHistory {
|
2540 | constructor(password, date) {
|
2541 | this.password = password;
|
2542 | this.date = date;
|
2543 | }
|
2544 | }
|
2545 |
|
2546 |
|
2547 |
|
2548 |
|
2549 |
|
2550 |
|
2551 |
|
2552 |
|
2553 |
|
2554 |
|
2555 |
|
2556 |
|
2557 |
|
2558 |
|
2559 |
|
2560 |
|
2561 |
|
2562 |
|
2563 |
|
2564 |
|
2565 | var nodeEnvSecureStorage_service_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2566 | return new (P || (P = Promise))(function (resolve, reject) {
|
2567 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
2568 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
2569 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
2570 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
2571 | });
|
2572 | };
|
2573 |
|
2574 |
|
2575 | class nodeEnvSecureStorage_service_NodeEnvSecureStorageService {
|
2576 | constructor(storageService, cryptoService) {
|
2577 | this.storageService = storageService;
|
2578 | this.cryptoService = cryptoService;
|
2579 | }
|
2580 | get(key) {
|
2581 | return nodeEnvSecureStorage_service_awaiter(this, void 0, void 0, function* () {
|
2582 | const value = yield this.storageService.get(this.makeProtectedStorageKey(key));
|
2583 | if (value == null) {
|
2584 | return null;
|
2585 | }
|
2586 | const obj = yield this.decrypt(value);
|
2587 | return obj;
|
2588 | });
|
2589 | }
|
2590 | save(key, obj) {
|
2591 | return nodeEnvSecureStorage_service_awaiter(this, void 0, void 0, function* () {
|
2592 | if (typeof (obj) !== 'string') {
|
2593 | throw new Error('Only string storage is allowed.');
|
2594 | }
|
2595 | const protectedObj = yield this.encrypt(obj);
|
2596 | yield this.storageService.save(this.makeProtectedStorageKey(key), protectedObj);
|
2597 | });
|
2598 | }
|
2599 | remove(key) {
|
2600 | return this.storageService.remove(this.makeProtectedStorageKey(key));
|
2601 | }
|
2602 | encrypt(plainValue) {
|
2603 | return nodeEnvSecureStorage_service_awaiter(this, void 0, void 0, function* () {
|
2604 | const sessionKey = this.getSessionKey();
|
2605 | if (sessionKey == null) {
|
2606 | throw new Error('No session key available.');
|
2607 | }
|
2608 | const encValue = yield this.cryptoService().encryptToBytes(utils_Utils.fromB64ToArray(plainValue).buffer, sessionKey);
|
2609 | if (encValue == null) {
|
2610 | throw new Error('Value didn\'t encrypt.');
|
2611 | }
|
2612 | return utils_Utils.fromBufferToB64(encValue);
|
2613 | });
|
2614 | }
|
2615 | decrypt(encValue) {
|
2616 | return nodeEnvSecureStorage_service_awaiter(this, void 0, void 0, function* () {
|
2617 | try {
|
2618 | const sessionKey = this.getSessionKey();
|
2619 | if (sessionKey == null) {
|
2620 | return null;
|
2621 | }
|
2622 | const decValue = yield this.cryptoService().decryptFromBytes(utils_Utils.fromB64ToArray(encValue).buffer, sessionKey);
|
2623 | if (decValue == null) {
|
2624 |
|
2625 | console.log('Failed to decrypt.');
|
2626 | return null;
|
2627 | }
|
2628 | return utils_Utils.fromBufferToB64(decValue);
|
2629 | }
|
2630 | catch (e) {
|
2631 |
|
2632 | console.log('Decrypt error.');
|
2633 | return null;
|
2634 | }
|
2635 | });
|
2636 | }
|
2637 | getSessionKey() {
|
2638 | try {
|
2639 | if (process.env.BW_SESSION != null) {
|
2640 | const sessionBuffer = utils_Utils.fromB64ToArray(process.env.BW_SESSION).buffer;
|
2641 | if (sessionBuffer != null) {
|
2642 | const sessionKey = new symmetricCryptoKey_SymmetricCryptoKey(sessionBuffer);
|
2643 | if (sessionBuffer != null) {
|
2644 | return sessionKey;
|
2645 | }
|
2646 | }
|
2647 | }
|
2648 | }
|
2649 | catch (e) {
|
2650 |
|
2651 | console.log('Session key is invalid.');
|
2652 | }
|
2653 | return null;
|
2654 | }
|
2655 | makeProtectedStorageKey(key) {
|
2656 | return '__PROTECTED__' + key;
|
2657 | }
|
2658 | }
|
2659 |
|
2660 |
|
2661 | var DeviceType;
|
2662 | (function (DeviceType) {
|
2663 | DeviceType[DeviceType["Android"] = 0] = "Android";
|
2664 | DeviceType[DeviceType["iOS"] = 1] = "iOS";
|
2665 | DeviceType[DeviceType["ChromeExtension"] = 2] = "ChromeExtension";
|
2666 | DeviceType[DeviceType["FirefoxExtension"] = 3] = "FirefoxExtension";
|
2667 | DeviceType[DeviceType["OperaExtension"] = 4] = "OperaExtension";
|
2668 | DeviceType[DeviceType["EdgeExtension"] = 5] = "EdgeExtension";
|
2669 | DeviceType[DeviceType["WindowsDesktop"] = 6] = "WindowsDesktop";
|
2670 | DeviceType[DeviceType["MacOsDesktop"] = 7] = "MacOsDesktop";
|
2671 | DeviceType[DeviceType["LinuxDesktop"] = 8] = "LinuxDesktop";
|
2672 | DeviceType[DeviceType["ChromeBrowser"] = 9] = "ChromeBrowser";
|
2673 | DeviceType[DeviceType["FirefoxBrowser"] = 10] = "FirefoxBrowser";
|
2674 | DeviceType[DeviceType["OperaBrowser"] = 11] = "OperaBrowser";
|
2675 | DeviceType[DeviceType["EdgeBrowser"] = 12] = "EdgeBrowser";
|
2676 | DeviceType[DeviceType["IEBrowser"] = 13] = "IEBrowser";
|
2677 | DeviceType[DeviceType["UnknownBrowser"] = 14] = "UnknownBrowser";
|
2678 | DeviceType[DeviceType["AndroidAmazon"] = 15] = "AndroidAmazon";
|
2679 | DeviceType[DeviceType["UWP"] = 16] = "UWP";
|
2680 | DeviceType[DeviceType["SafariBrowser"] = 17] = "SafariBrowser";
|
2681 | DeviceType[DeviceType["VivaldiBrowser"] = 18] = "VivaldiBrowser";
|
2682 | DeviceType[DeviceType["VivaldiExtension"] = 19] = "VivaldiExtension";
|
2683 | DeviceType[DeviceType["SafariExtension"] = 20] = "SafariExtension";
|
2684 | })(DeviceType || (DeviceType = {}));
|
2685 |
|
2686 |
|
2687 |
|
2688 | class cliPlatformUtils_service_CliPlatformUtilsService {
|
2689 | constructor(identityClientId, packageJson) {
|
2690 | this.packageJson = packageJson;
|
2691 | this.deviceCache = null;
|
2692 | this.identityClientId = identityClientId;
|
2693 | }
|
2694 | getDevice() {
|
2695 | if (!this.deviceCache) {
|
2696 | switch (process.platform) {
|
2697 | case 'win32':
|
2698 | this.deviceCache = DeviceType.WindowsDesktop;
|
2699 | break;
|
2700 | case 'darwin':
|
2701 | this.deviceCache = DeviceType.MacOsDesktop;
|
2702 | break;
|
2703 | case 'linux':
|
2704 | default:
|
2705 | this.deviceCache = DeviceType.LinuxDesktop;
|
2706 | break;
|
2707 | }
|
2708 | }
|
2709 | return this.deviceCache;
|
2710 | }
|
2711 | getDeviceString() {
|
2712 | const device = DeviceType[this.getDevice()].toLowerCase();
|
2713 | return device.replace('desktop', '');
|
2714 | }
|
2715 | isFirefox() {
|
2716 | return false;
|
2717 | }
|
2718 | isChrome() {
|
2719 | return false;
|
2720 | }
|
2721 | isEdge() {
|
2722 | return false;
|
2723 | }
|
2724 | isOpera() {
|
2725 | return false;
|
2726 | }
|
2727 | isVivaldi() {
|
2728 | return false;
|
2729 | }
|
2730 | isSafari() {
|
2731 | return false;
|
2732 | }
|
2733 | isIE() {
|
2734 | return false;
|
2735 | }
|
2736 | isMacAppStore() {
|
2737 | return false;
|
2738 | }
|
2739 | analyticsId() {
|
2740 | return null;
|
2741 | }
|
2742 | isViewOpen() {
|
2743 | return Promise.resolve(false);
|
2744 | }
|
2745 | lockTimeout() {
|
2746 | return null;
|
2747 | }
|
2748 | launchUri(uri, options) {
|
2749 | throw new Error('Not implemented.');
|
2750 | }
|
2751 | saveFile(win, blobData, blobOptions, fileName) {
|
2752 | throw new Error('Not implemented.');
|
2753 | }
|
2754 | getApplicationVersion() {
|
2755 | return this.packageJson.version;
|
2756 | }
|
2757 | supportsU2f(win) {
|
2758 | return false;
|
2759 | }
|
2760 | supportsDuo() {
|
2761 | return false;
|
2762 | }
|
2763 | showToast(type, title, text, options) {
|
2764 | throw new Error('Not implemented.');
|
2765 | }
|
2766 | showDialog(text, title, confirmText, cancelText, type) {
|
2767 | throw new Error('Not implemented.');
|
2768 | }
|
2769 | eventTrack(action, label, options) {
|
2770 | throw new Error('Not implemented.');
|
2771 | }
|
2772 | isDev() {
|
2773 | return "production" === 'development';
|
2774 | }
|
2775 | isSelfHost() {
|
2776 | return false;
|
2777 | }
|
2778 | copyToClipboard(text, options) {
|
2779 | throw new Error('Not implemented.');
|
2780 | }
|
2781 | readFromClipboard(options) {
|
2782 | throw new Error('Not implemented.');
|
2783 | }
|
2784 | }
|
2785 |
|
2786 |
|
2787 | var appId_service_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2788 | return new (P || (P = Promise))(function (resolve, reject) {
|
2789 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
2790 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
2791 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
2792 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
2793 | });
|
2794 | };
|
2795 |
|
2796 | class appId_service_AppIdService {
|
2797 | constructor(storageService) {
|
2798 | this.storageService = storageService;
|
2799 | }
|
2800 | getAppId() {
|
2801 | return this.makeAndGetAppId('appId');
|
2802 | }
|
2803 | getAnonymousAppId() {
|
2804 | return this.makeAndGetAppId('anonymousAppId');
|
2805 | }
|
2806 | makeAndGetAppId(key) {
|
2807 | return appId_service_awaiter(this, void 0, void 0, function* () {
|
2808 | const existingId = yield this.storageService.get(key);
|
2809 | if (existingId != null) {
|
2810 | return existingId;
|
2811 | }
|
2812 | const guid = utils_Utils.newGuid();
|
2813 | yield this.storageService.save(key, guid);
|
2814 | return guid;
|
2815 | });
|
2816 | }
|
2817 | }
|
2818 |
|
2819 |
|
2820 |
|
2821 |
|
2822 |
|
2823 |
|
2824 |
|
2825 |
|
2826 | function throttle(limit, throttleKey) {
|
2827 | return (target, propertyKey, descriptor) => {
|
2828 | const originalMethod = descriptor.value;
|
2829 | const allThrottles = new Map();
|
2830 | const getThrottles = (obj) => {
|
2831 | let throttles = allThrottles.get(obj);
|
2832 | if (throttles != null) {
|
2833 | return throttles;
|
2834 | }
|
2835 | throttles = new Map();
|
2836 | allThrottles.set(obj, throttles);
|
2837 | return throttles;
|
2838 | };
|
2839 | return {
|
2840 | value: function (...args) {
|
2841 | const throttles = getThrottles(this);
|
2842 | const argsThrottleKey = throttleKey(args);
|
2843 | let queue = throttles.get(argsThrottleKey);
|
2844 | if (queue == null) {
|
2845 | queue = [];
|
2846 | throttles.set(argsThrottleKey, queue);
|
2847 | }
|
2848 | return new Promise((resolve, reject) => {
|
2849 | const exec = () => {
|
2850 | const onFinally = () => {
|
2851 | queue.splice(queue.indexOf(exec), 1);
|
2852 | if (queue.length >= limit) {
|
2853 | queue[limit - 1]();
|
2854 | }
|
2855 | else if (queue.length === 0) {
|
2856 | throttles.delete(argsThrottleKey);
|
2857 | if (throttles.size === 0) {
|
2858 | allThrottles.delete(this);
|
2859 | }
|
2860 | }
|
2861 | };
|
2862 | originalMethod.apply(this, args).then((val) => {
|
2863 | onFinally();
|
2864 | return val;
|
2865 | }).catch((err) => {
|
2866 | onFinally();
|
2867 | throw err;
|
2868 | }).then(resolve, reject);
|
2869 | };
|
2870 | queue.push(exec);
|
2871 | if (queue.length <= limit) {
|
2872 | exec();
|
2873 | }
|
2874 | });
|
2875 | },
|
2876 | };
|
2877 | };
|
2878 | }
|
2879 |
|
2880 |
|
2881 | var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
2882 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
2883 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
2884 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
2885 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
2886 | };
|
2887 | var __metadata = (undefined && undefined.__metadata) || function (k, v) {
|
2888 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
2889 | };
|
2890 | var audit_service_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2891 | return new (P || (P = Promise))(function (resolve, reject) {
|
2892 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
2893 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
2894 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
2895 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
2896 | });
|
2897 | };
|
2898 |
|
2899 |
|
2900 | const PwnedPasswordsApi = 'https://api.pwnedpasswords.com/range/';
|
2901 | class audit_service_AuditService {
|
2902 | constructor(cryptoFunctionService, apiService) {
|
2903 | this.cryptoFunctionService = cryptoFunctionService;
|
2904 | this.apiService = apiService;
|
2905 | }
|
2906 | passwordLeaked(password) {
|
2907 | return audit_service_awaiter(this, void 0, void 0, function* () {
|
2908 | const hashBytes = yield this.cryptoFunctionService.hash(password, 'sha1');
|
2909 | const hash = utils_Utils.fromBufferToHex(hashBytes).toUpperCase();
|
2910 | const hashStart = hash.substr(0, 5);
|
2911 | const hashEnding = hash.substr(5);
|
2912 | const response = yield this.apiService.nativeFetch(new Request(PwnedPasswordsApi + hashStart));
|
2913 | const leakedHashes = yield response.text();
|
2914 | const match = leakedHashes.split(/\r?\n/).find((v) => {
|
2915 | return v.split(':')[0] === hashEnding;
|
2916 | });
|
2917 | return match != null ? parseInt(match.split(':')[1], 10) : 0;
|
2918 | });
|
2919 | }
|
2920 | breachedAccounts(username) {
|
2921 | return audit_service_awaiter(this, void 0, void 0, function* () {
|
2922 | try {
|
2923 | return yield this.apiService.getHibpBreach(username);
|
2924 | }
|
2925 | catch (e) {
|
2926 | const error = e;
|
2927 | if (error.statusCode === 404) {
|
2928 | return [];
|
2929 | }
|
2930 | throw new Error();
|
2931 | }
|
2932 | });
|
2933 | }
|
2934 | }
|
2935 | __decorate([
|
2936 | throttle(100, () => 'passwordLeaked'),
|
2937 | __metadata("design:type", Function),
|
2938 | __metadata("design:paramtypes", [String]),
|
2939 | __metadata("design:returntype", Promise)
|
2940 | ], audit_service_AuditService.prototype, "passwordLeaked", null);
|
2941 |
|
2942 |
|
2943 | var FieldType;
|
2944 | (function (FieldType) {
|
2945 | FieldType[FieldType["Text"] = 0] = "Text";
|
2946 | FieldType[FieldType["Hidden"] = 1] = "Hidden";
|
2947 | FieldType[FieldType["Boolean"] = 2] = "Boolean";
|
2948 | })(FieldType || (FieldType = {}));
|
2949 |
|
2950 |
|
2951 | class CipherBulkDeleteRequest {
|
2952 | constructor(ids) {
|
2953 | this.ids = ids == null ? [] : ids;
|
2954 | }
|
2955 | }
|
2956 |
|
2957 |
|
2958 | class CipherBulkMoveRequest {
|
2959 | constructor(ids, folderId) {
|
2960 | this.ids = ids == null ? [] : ids;
|
2961 | this.folderId = folderId;
|
2962 | }
|
2963 | }
|
2964 |
|
2965 |
|
2966 | class CipherBulkRestoreRequest {
|
2967 | constructor(ids) {
|
2968 | this.ids = ids == null ? [] : ids;
|
2969 | }
|
2970 | }
|
2971 |
|
2972 |
|
2973 | class BaseResponse {
|
2974 | constructor(response) {
|
2975 | this.response = response;
|
2976 | }
|
2977 | getResponseProperty(propertyName, response = null, exactName = false) {
|
2978 | if (propertyName == null || propertyName === '') {
|
2979 | throw new Error('propertyName must not be null/empty.');
|
2980 | }
|
2981 | if (response == null && this.response != null) {
|
2982 | response = this.response;
|
2983 | }
|
2984 | if (response == null) {
|
2985 | return null;
|
2986 | }
|
2987 | if (!exactName && response[propertyName] === undefined) {
|
2988 | let otherCasePropertyName = null;
|
2989 | if (propertyName.charAt(0) === propertyName.charAt(0).toUpperCase()) {
|
2990 | otherCasePropertyName = propertyName.charAt(0).toLowerCase();
|
2991 | }
|
2992 | else {
|
2993 | otherCasePropertyName = propertyName.charAt(0).toUpperCase();
|
2994 | }
|
2995 | if (propertyName.length > 1) {
|
2996 | otherCasePropertyName += propertyName.slice(1);
|
2997 | }
|
2998 | propertyName = otherCasePropertyName;
|
2999 | if (response[propertyName] === undefined) {
|
3000 | propertyName = propertyName.toLowerCase();
|
3001 | }
|
3002 | if (response[propertyName] === undefined) {
|
3003 | propertyName = propertyName.toUpperCase();
|
3004 | }
|
3005 | }
|
3006 | return response[propertyName];
|
3007 | }
|
3008 | }
|
3009 |
|
3010 |
|
3011 |
|
3012 | class cardApi_CardApi extends BaseResponse {
|
3013 | constructor(data = null) {
|
3014 | super(data);
|
3015 | if (data == null) {
|
3016 | return;
|
3017 | }
|
3018 | this.cardholderName = this.getResponseProperty('CardholderName');
|
3019 | this.brand = this.getResponseProperty('Brand');
|
3020 | this.number = this.getResponseProperty('Number');
|
3021 | this.expMonth = this.getResponseProperty('ExpMonth');
|
3022 | this.expYear = this.getResponseProperty('ExpYear');
|
3023 | this.code = this.getResponseProperty('Code');
|
3024 | }
|
3025 | }
|
3026 |
|
3027 |
|
3028 |
|
3029 | class fieldApi_FieldApi extends BaseResponse {
|
3030 | constructor(data = null) {
|
3031 | super(data);
|
3032 | if (data == null) {
|
3033 | return;
|
3034 | }
|
3035 | this.type = this.getResponseProperty('Type');
|
3036 | this.name = this.getResponseProperty('Name');
|
3037 | this.value = this.getResponseProperty('Value');
|
3038 | }
|
3039 | }
|
3040 |
|
3041 |
|
3042 |
|
3043 | class identityApi_IdentityApi extends BaseResponse {
|
3044 | constructor(data = null) {
|
3045 | super(data);
|
3046 | if (data == null) {
|
3047 | return;
|
3048 | }
|
3049 | this.title = this.getResponseProperty('Title');
|
3050 | this.firstName = this.getResponseProperty('FirstName');
|
3051 | this.middleName = this.getResponseProperty('MiddleName');
|
3052 | this.lastName = this.getResponseProperty('LastName');
|
3053 | this.address1 = this.getResponseProperty('Address1');
|
3054 | this.address2 = this.getResponseProperty('Address2');
|
3055 | this.address3 = this.getResponseProperty('Address3');
|
3056 | this.city = this.getResponseProperty('City');
|
3057 | this.state = this.getResponseProperty('State');
|
3058 | this.postalCode = this.getResponseProperty('PostalCode');
|
3059 | this.country = this.getResponseProperty('Country');
|
3060 | this.company = this.getResponseProperty('Company');
|
3061 | this.email = this.getResponseProperty('Email');
|
3062 | this.phone = this.getResponseProperty('Phone');
|
3063 | this.ssn = this.getResponseProperty('SSN');
|
3064 | this.username = this.getResponseProperty('Username');
|
3065 | this.passportNumber = this.getResponseProperty('PassportNumber');
|
3066 | this.licenseNumber = this.getResponseProperty('LicenseNumber');
|
3067 | }
|
3068 | }
|
3069 |
|
3070 |
|
3071 |
|
3072 | class loginUriApi_LoginUriApi extends BaseResponse {
|
3073 | constructor(data = null) {
|
3074 | super(data);
|
3075 | this.match = null;
|
3076 | if (data == null) {
|
3077 | return;
|
3078 | }
|
3079 | this.uri = this.getResponseProperty('Uri');
|
3080 | const match = this.getResponseProperty('Match');
|
3081 | this.match = match != null ? match : null;
|
3082 | }
|
3083 | }
|
3084 |
|
3085 |
|
3086 |
|
3087 |
|
3088 | class loginApi_LoginApi extends BaseResponse {
|
3089 | constructor(data = null) {
|
3090 | super(data);
|
3091 | if (data == null) {
|
3092 | return;
|
3093 | }
|
3094 | this.username = this.getResponseProperty('Username');
|
3095 | this.password = this.getResponseProperty('Password');
|
3096 | this.passwordRevisionDate = this.getResponseProperty('PasswordRevisionDate');
|
3097 | this.totp = this.getResponseProperty('Totp');
|
3098 | const uris = this.getResponseProperty('Uris');
|
3099 | if (uris != null) {
|
3100 | this.uris = uris.map((u) => new loginUriApi_LoginUriApi(u));
|
3101 | }
|
3102 | }
|
3103 | }
|
3104 |
|
3105 |
|
3106 |
|
3107 | class secureNoteApi_SecureNoteApi extends BaseResponse {
|
3108 | constructor(data = null) {
|
3109 | super(data);
|
3110 | if (data == null) {
|
3111 | return;
|
3112 | }
|
3113 | this.type = this.getResponseProperty('Type');
|
3114 | }
|
3115 | }
|
3116 |
|
3117 |
|
3118 | class AttachmentRequest {
|
3119 | }
|
3120 |
|
3121 |
|
3122 |
|
3123 |
|
3124 |
|
3125 |
|
3126 |
|
3127 |
|
3128 |
|
3129 |
|
3130 | class cipherRequest_CipherRequest {
|
3131 | constructor(cipher) {
|
3132 | this.type = cipher.type;
|
3133 | this.folderId = cipher.folderId;
|
3134 | this.organizationId = cipher.organizationId;
|
3135 | this.name = cipher.name ? cipher.name.encryptedString : null;
|
3136 | this.notes = cipher.notes ? cipher.notes.encryptedString : null;
|
3137 | this.favorite = cipher.favorite;
|
3138 | switch (this.type) {
|
3139 | case CipherType.Login:
|
3140 | this.login = new loginApi_LoginApi();
|
3141 | this.login.uris = null;
|
3142 | this.login.username = cipher.login.username ? cipher.login.username.encryptedString : null;
|
3143 | this.login.password = cipher.login.password ? cipher.login.password.encryptedString : null;
|
3144 | this.login.passwordRevisionDate = cipher.login.passwordRevisionDate != null ?
|
3145 | cipher.login.passwordRevisionDate.toISOString() : null;
|
3146 | this.login.totp = cipher.login.totp ? cipher.login.totp.encryptedString : null;
|
3147 | if (cipher.login.uris != null) {
|
3148 | this.login.uris = cipher.login.uris.map((u) => {
|
3149 | const uri = new loginUriApi_LoginUriApi();
|
3150 | uri.uri = u.uri != null ? u.uri.encryptedString : null;
|
3151 | uri.match = u.match != null ? u.match : null;
|
3152 | return uri;
|
3153 | });
|
3154 | }
|
3155 | break;
|
3156 | case CipherType.SecureNote:
|
3157 | this.secureNote = new secureNoteApi_SecureNoteApi();
|
3158 | this.secureNote.type = cipher.secureNote.type;
|
3159 | break;
|
3160 | case CipherType.Card:
|
3161 | this.card = new cardApi_CardApi();
|
3162 | this.card.cardholderName = cipher.card.cardholderName != null ?
|
3163 | cipher.card.cardholderName.encryptedString : null;
|
3164 | this.card.brand = cipher.card.brand != null ? cipher.card.brand.encryptedString : null;
|
3165 | this.card.number = cipher.card.number != null ? cipher.card.number.encryptedString : null;
|
3166 | this.card.expMonth = cipher.card.expMonth != null ? cipher.card.expMonth.encryptedString : null;
|
3167 | this.card.expYear = cipher.card.expYear != null ? cipher.card.expYear.encryptedString : null;
|
3168 | this.card.code = cipher.card.code != null ? cipher.card.code.encryptedString : null;
|
3169 | break;
|
3170 | case CipherType.Identity:
|
3171 | this.identity = new identityApi_IdentityApi();
|
3172 | this.identity.title = cipher.identity.title != null ? cipher.identity.title.encryptedString : null;
|
3173 | this.identity.firstName = cipher.identity.firstName != null ?
|
3174 | cipher.identity.firstName.encryptedString : null;
|
3175 | this.identity.middleName = cipher.identity.middleName != null ?
|
3176 | cipher.identity.middleName.encryptedString : null;
|
3177 | this.identity.lastName = cipher.identity.lastName != null ?
|
3178 | cipher.identity.lastName.encryptedString : null;
|
3179 | this.identity.address1 = cipher.identity.address1 != null ?
|
3180 | cipher.identity.address1.encryptedString : null;
|
3181 | this.identity.address2 = cipher.identity.address2 != null ?
|
3182 | cipher.identity.address2.encryptedString : null;
|
3183 | this.identity.address3 = cipher.identity.address3 != null ?
|
3184 | cipher.identity.address3.encryptedString : null;
|
3185 | this.identity.city = cipher.identity.city != null ? cipher.identity.city.encryptedString : null;
|
3186 | this.identity.state = cipher.identity.state != null ? cipher.identity.state.encryptedString : null;
|
3187 | this.identity.postalCode = cipher.identity.postalCode != null ?
|
3188 | cipher.identity.postalCode.encryptedString : null;
|
3189 | this.identity.country = cipher.identity.country != null ?
|
3190 | cipher.identity.country.encryptedString : null;
|
3191 | this.identity.company = cipher.identity.company != null ?
|
3192 | cipher.identity.company.encryptedString : null;
|
3193 | this.identity.email = cipher.identity.email != null ? cipher.identity.email.encryptedString : null;
|
3194 | this.identity.phone = cipher.identity.phone != null ? cipher.identity.phone.encryptedString : null;
|
3195 | this.identity.ssn = cipher.identity.ssn != null ? cipher.identity.ssn.encryptedString : null;
|
3196 | this.identity.username = cipher.identity.username != null ?
|
3197 | cipher.identity.username.encryptedString : null;
|
3198 | this.identity.passportNumber = cipher.identity.passportNumber != null ?
|
3199 | cipher.identity.passportNumber.encryptedString : null;
|
3200 | this.identity.licenseNumber = cipher.identity.licenseNumber != null ?
|
3201 | cipher.identity.licenseNumber.encryptedString : null;
|
3202 | break;
|
3203 | default:
|
3204 | break;
|
3205 | }
|
3206 | if (cipher.fields != null) {
|
3207 | this.fields = cipher.fields.map((f) => {
|
3208 | const field = new fieldApi_FieldApi();
|
3209 | field.type = f.type;
|
3210 | field.name = f.name ? f.name.encryptedString : null;
|
3211 | field.value = f.value ? f.value.encryptedString : null;
|
3212 | return field;
|
3213 | });
|
3214 | }
|
3215 | if (cipher.passwordHistory != null) {
|
3216 | this.passwordHistory = [];
|
3217 | cipher.passwordHistory.forEach((ph) => {
|
3218 | this.passwordHistory.push({
|
3219 | lastUsedDate: ph.lastUsedDate,
|
3220 | password: ph.password ? ph.password.encryptedString : null,
|
3221 | });
|
3222 | });
|
3223 | }
|
3224 | if (cipher.attachments != null) {
|
3225 | this.attachments = {};
|
3226 | this.attachments2 = {};
|
3227 | cipher.attachments.forEach((attachment) => {
|
3228 | const fileName = attachment.fileName ? attachment.fileName.encryptedString : null;
|
3229 | this.attachments[attachment.id] = fileName;
|
3230 | const attachmentRequest = new AttachmentRequest();
|
3231 | attachmentRequest.fileName = fileName;
|
3232 | if (attachment.key != null) {
|
3233 | attachmentRequest.key = attachment.key.encryptedString;
|
3234 | }
|
3235 | this.attachments2[attachment.id] = attachmentRequest;
|
3236 | });
|
3237 | }
|
3238 | }
|
3239 | }
|
3240 |
|
3241 |
|
3242 |
|
3243 | class cipherWithIdRequest_CipherWithIdRequest extends cipherRequest_CipherRequest {
|
3244 | constructor(cipher) {
|
3245 | super(cipher);
|
3246 | this.id = cipher.id;
|
3247 | }
|
3248 | }
|
3249 |
|
3250 |
|
3251 |
|
3252 | class cipherBulkShareRequest_CipherBulkShareRequest {
|
3253 | constructor(ciphers, collectionIds) {
|
3254 | if (ciphers != null) {
|
3255 | this.ciphers = [];
|
3256 | ciphers.forEach((c) => {
|
3257 | this.ciphers.push(new cipherWithIdRequest_CipherWithIdRequest(c));
|
3258 | });
|
3259 | }
|
3260 | this.collectionIds = collectionIds;
|
3261 | }
|
3262 | }
|
3263 |
|
3264 |
|
3265 | class CipherCollectionsRequest {
|
3266 | constructor(collectionIds) {
|
3267 | this.collectionIds = collectionIds == null ? [] : collectionIds;
|
3268 | }
|
3269 | }
|
3270 |
|
3271 |
|
3272 |
|
3273 | class cipherCreateRequest_CipherCreateRequest {
|
3274 | constructor(cipher) {
|
3275 | this.cipher = new cipherRequest_CipherRequest(cipher);
|
3276 | this.collectionIds = cipher.collectionIds;
|
3277 | }
|
3278 | }
|
3279 |
|
3280 |
|
3281 |
|
3282 | class cipherShareRequest_CipherShareRequest {
|
3283 | constructor(cipher) {
|
3284 | this.cipher = new cipherRequest_CipherRequest(cipher);
|
3285 | this.collectionIds = cipher.collectionIds;
|
3286 | }
|
3287 | }
|
3288 |
|
3289 |
|
3290 | class ConstantsService {
|
3291 | constructor() {
|
3292 | this.environmentUrlsKey = ConstantsService.environmentUrlsKey;
|
3293 | this.disableGaKey = ConstantsService.disableGaKey;
|
3294 | this.disableAddLoginNotificationKey = ConstantsService.disableAddLoginNotificationKey;
|
3295 | this.disableContextMenuItemKey = ConstantsService.disableContextMenuItemKey;
|
3296 | this.disableFaviconKey = ConstantsService.disableFaviconKey;
|
3297 | this.disableAutoTotpCopyKey = ConstantsService.disableAutoTotpCopyKey;
|
3298 | this.enableAutoFillOnPageLoadKey = ConstantsService.enableAutoFillOnPageLoadKey;
|
3299 | this.vaultTimeoutKey = ConstantsService.vaultTimeoutKey;
|
3300 | this.vaultTimeoutActionKey = ConstantsService.vaultTimeoutActionKey;
|
3301 | this.lastActiveKey = ConstantsService.lastActiveKey;
|
3302 | this.neverDomainsKey = ConstantsService.neverDomainsKey;
|
3303 | this.installedVersionKey = ConstantsService.installedVersionKey;
|
3304 | this.localeKey = ConstantsService.localeKey;
|
3305 | this.themeKey = ConstantsService.themeKey;
|
3306 | this.collapsedGroupingsKey = ConstantsService.collapsedGroupingsKey;
|
3307 | this.autoConfirmFingerprints = ConstantsService.autoConfirmFingerprints;
|
3308 | this.dontShowCardsCurrentTab = ConstantsService.dontShowCardsCurrentTab;
|
3309 | this.dontShowIdentitiesCurrentTab = ConstantsService.dontShowIdentitiesCurrentTab;
|
3310 | this.defaultUriMatch = ConstantsService.defaultUriMatch;
|
3311 | this.pinProtectedKey = ConstantsService.pinProtectedKey;
|
3312 | this.protectedPin = ConstantsService.protectedPin;
|
3313 | this.clearClipboardKey = ConstantsService.clearClipboardKey;
|
3314 | this.eventCollectionKey = ConstantsService.eventCollectionKey;
|
3315 | }
|
3316 | }
|
3317 | ConstantsService.environmentUrlsKey = 'environmentUrls';
|
3318 | ConstantsService.disableGaKey = 'disableGa';
|
3319 | ConstantsService.disableAddLoginNotificationKey = 'disableAddLoginNotification';
|
3320 | ConstantsService.disableChangedPasswordNotificationKey = 'disableChangedPasswordNotification';
|
3321 | ConstantsService.disableContextMenuItemKey = 'disableContextMenuItem';
|
3322 | ConstantsService.disableFaviconKey = 'disableFavicon';
|
3323 | ConstantsService.disableAutoTotpCopyKey = 'disableAutoTotpCopy';
|
3324 | ConstantsService.enableAutoFillOnPageLoadKey = 'enableAutoFillOnPageLoad';
|
3325 | ConstantsService.vaultTimeoutKey = 'lockOption';
|
3326 | ConstantsService.vaultTimeoutActionKey = 'vaultTimeoutAction';
|
3327 | ConstantsService.lastActiveKey = 'lastActive';
|
3328 | ConstantsService.neverDomainsKey = 'neverDomains';
|
3329 | ConstantsService.installedVersionKey = 'installedVersion';
|
3330 | ConstantsService.localeKey = 'locale';
|
3331 | ConstantsService.themeKey = 'theme';
|
3332 | ConstantsService.collapsedGroupingsKey = 'collapsedGroupings';
|
3333 | ConstantsService.autoConfirmFingerprints = 'autoConfirmFingerprints';
|
3334 | ConstantsService.dontShowCardsCurrentTab = 'dontShowCardsCurrentTab';
|
3335 | ConstantsService.dontShowIdentitiesCurrentTab = 'dontShowIdentitiesCurrentTab';
|
3336 | ConstantsService.defaultUriMatch = 'defaultUriMatch';
|
3337 | ConstantsService.pinProtectedKey = 'pinProtectedKey';
|
3338 | ConstantsService.protectedPin = 'protectedPin';
|
3339 | ConstantsService.clearClipboardKey = 'clearClipboardKey';
|
3340 | ConstantsService.eventCollectionKey = 'eventCollection';
|
3341 |
|
3342 |
|
3343 |
|
3344 |
|
3345 |
|
3346 |
|
3347 |
|
3348 |
|
3349 |
|
3350 |
|
3351 |
|
3352 |
|
3353 | function sequentialize(cacheKey) {
|
3354 | return (target, propertyKey, descriptor) => {
|
3355 | const originalMethod = descriptor.value;
|
3356 | const caches = new Map();
|
3357 | const getCache = (obj) => {
|
3358 | let cache = caches.get(obj);
|
3359 | if (cache != null) {
|
3360 | return cache;
|
3361 | }
|
3362 | cache = new Map();
|
3363 | caches.set(obj, cache);
|
3364 | return cache;
|
3365 | };
|
3366 | return {
|
3367 | value: function (...args) {
|
3368 | const cache = getCache(this);
|
3369 | const argsCacheKey = cacheKey(args);
|
3370 | let response = cache.get(argsCacheKey);
|
3371 | if (response != null) {
|
3372 | return response;
|
3373 | }
|
3374 | const onFinally = () => {
|
3375 | cache.delete(argsCacheKey);
|
3376 | if (cache.size === 0) {
|
3377 | caches.delete(this);
|
3378 | }
|
3379 | };
|
3380 | response = originalMethod.apply(this, args).then((val) => {
|
3381 | onFinally();
|
3382 | return val;
|
3383 | }).catch((err) => {
|
3384 | onFinally();
|
3385 | throw err;
|
3386 | });
|
3387 | cache.set(argsCacheKey, response);
|
3388 | return response;
|
3389 | },
|
3390 | };
|
3391 | };
|
3392 | }
|
3393 |
|
3394 |
|
3395 | var cipher_service_decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
3396 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
3397 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
3398 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
3399 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
3400 | };
|
3401 | var cipher_service_metadata = (undefined && undefined.__metadata) || function (k, v) {
|
3402 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
3403 | };
|
3404 | var cipher_service_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3405 | return new (P || (P = Promise))(function (resolve, reject) {
|
3406 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
3407 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
3408 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
3409 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
3410 | });
|
3411 | };
|
3412 |
|
3413 |
|
3414 |
|
3415 |
|
3416 |
|
3417 |
|
3418 |
|
3419 |
|
3420 |
|
3421 |
|
3422 |
|
3423 |
|
3424 |
|
3425 |
|
3426 |
|
3427 |
|
3428 |
|
3429 |
|
3430 |
|
3431 |
|
3432 |
|
3433 |
|
3434 |
|
3435 |
|
3436 |
|
3437 | const Keys = {
|
3438 | ciphersPrefix: 'ciphers_',
|
3439 | localData: 'sitesLocalData',
|
3440 | neverDomains: 'neverDomains',
|
3441 | };
|
3442 | const DomainMatchBlacklist = new Map([
|
3443 | ['google.com', new Set(['script.google.com'])],
|
3444 | ]);
|
3445 | class cipher_service_CipherService {
|
3446 | constructor(cryptoService, userService, settingsService, apiService, storageService, i18nService, searchService) {
|
3447 | this.cryptoService = cryptoService;
|
3448 | this.userService = userService;
|
3449 | this.settingsService = settingsService;
|
3450 | this.apiService = apiService;
|
3451 | this.storageService = storageService;
|
3452 | this.i18nService = i18nService;
|
3453 | this.searchService = searchService;
|
3454 | }
|
3455 | get decryptedCipherCache() {
|
3456 | return this._decryptedCipherCache;
|
3457 | }
|
3458 | set decryptedCipherCache(value) {
|
3459 | this._decryptedCipherCache = value;
|
3460 | if (this.searchService != null) {
|
3461 | if (value == null) {
|
3462 | this.searchService().clearIndex();
|
3463 | }
|
3464 | else {
|
3465 | this.searchService().indexCiphers();
|
3466 | }
|
3467 | }
|
3468 | }
|
3469 | clearCache() {
|
3470 | this.decryptedCipherCache = null;
|
3471 | }
|
3472 | encrypt(model, key, originalCipher = null) {
|
3473 | return cipher_service_awaiter(this, void 0, void 0, function* () {
|
3474 |
|
3475 | if (model.id != null) {
|
3476 | if (originalCipher == null) {
|
3477 | originalCipher = yield this.get(model.id);
|
3478 | }
|
3479 | if (originalCipher != null) {
|
3480 | const existingCipher = yield originalCipher.decrypt();
|
3481 | model.passwordHistory = existingCipher.passwordHistory || [];
|
3482 | if (model.type === CipherType.Login && existingCipher.type === CipherType.Login) {
|
3483 | if (existingCipher.login.password != null && existingCipher.login.password !== '' &&
|
3484 | existingCipher.login.password !== model.login.password) {
|
3485 | const ph = new PasswordHistoryView();
|
3486 | ph.password = existingCipher.login.password;
|
3487 | ph.lastUsedDate = model.login.passwordRevisionDate = new Date();
|
3488 | model.passwordHistory.splice(0, 0, ph);
|
3489 | }
|
3490 | else {
|
3491 | model.login.passwordRevisionDate = existingCipher.login.passwordRevisionDate;
|
3492 | }
|
3493 | }
|
3494 | if (existingCipher.hasFields) {
|
3495 | const existingHiddenFields = existingCipher.fields.filter((f) => f.type === FieldType.Hidden &&
|
3496 | f.name != null && f.name !== '' && f.value != null && f.value !== '');
|
3497 | const hiddenFields = model.fields == null ? [] :
|
3498 | model.fields.filter((f) => f.type === FieldType.Hidden && f.name != null && f.name !== '');
|
3499 | existingHiddenFields.forEach((ef) => {
|
3500 | const matchedField = hiddenFields.find((f) => f.name === ef.name);
|
3501 | if (matchedField == null || matchedField.value !== ef.value) {
|
3502 | const ph = new PasswordHistoryView();
|
3503 | ph.password = ef.name + ': ' + ef.value;
|
3504 | ph.lastUsedDate = new Date();
|
3505 | model.passwordHistory.splice(0, 0, ph);
|
3506 | }
|
3507 | });
|
3508 | }
|
3509 | }
|
3510 | if (model.passwordHistory != null && model.passwordHistory.length === 0) {
|
3511 | model.passwordHistory = null;
|
3512 | }
|
3513 | else if (model.passwordHistory != null && model.passwordHistory.length > 5) {
|
3514 |
|
3515 | model.passwordHistory = model.passwordHistory.slice(0, 5);
|
3516 | }
|
3517 | }
|
3518 | const cipher = new cipher_Cipher();
|
3519 | cipher.id = model.id;
|
3520 | cipher.folderId = model.folderId;
|
3521 | cipher.favorite = model.favorite;
|
3522 | cipher.organizationId = model.organizationId;
|
3523 | cipher.type = model.type;
|
3524 | cipher.collectionIds = model.collectionIds;
|
3525 | if (key == null && cipher.organizationId != null) {
|
3526 | key = yield this.cryptoService.getOrgKey(cipher.organizationId);
|
3527 | if (key == null) {
|
3528 | throw new Error('Cannot encrypt cipher for organization. No key.');
|
3529 | }
|
3530 | }
|
3531 | yield Promise.all([
|
3532 | this.encryptObjProperty(model, cipher, {
|
3533 | name: null,
|
3534 | notes: null,
|
3535 | }, key),
|
3536 | this.encryptCipherData(cipher, model, key),
|
3537 | this.encryptFields(model.fields, key).then((fields) => {
|
3538 | cipher.fields = fields;
|
3539 | }),
|
3540 | this.encryptPasswordHistories(model.passwordHistory, key).then((ph) => {
|
3541 | cipher.passwordHistory = ph;
|
3542 | }),
|
3543 | this.encryptAttachments(model.attachments, key).then((attachments) => {
|
3544 | cipher.attachments = attachments;
|
3545 | }),
|
3546 | ]);
|
3547 | return cipher;
|
3548 | });
|
3549 | }
|
3550 | encryptAttachments(attachmentsModel, key) {
|
3551 | return cipher_service_awaiter(this, void 0, void 0, function* () {
|
3552 | if (attachmentsModel == null || attachmentsModel.length === 0) {
|
3553 | return null;
|
3554 | }
|
3555 | const promises = [];
|
3556 | const encAttachments = [];
|
3557 | attachmentsModel.forEach((model) => cipher_service_awaiter(this, void 0, void 0, function* () {
|
3558 | const attachment = new attachment_Attachment();
|
3559 | attachment.id = model.id;
|
3560 | attachment.size = model.size;
|
3561 | attachment.sizeName = model.sizeName;
|
3562 | attachment.url = model.url;
|
3563 | const promise = this.encryptObjProperty(model, attachment, {
|
3564 | fileName: null,
|
3565 | }, key).then(() => cipher_service_awaiter(this, void 0, void 0, function* () {
|
3566 | if (model.key != null) {
|
3567 | attachment.key = yield this.cryptoService.encrypt(model.key.key, key);
|
3568 | }
|
3569 | encAttachments.push(attachment);
|
3570 | }));
|
3571 | promises.push(promise);
|
3572 | }));
|
3573 | yield Promise.all(promises);
|
3574 | return encAttachments;
|
3575 | });
|
3576 | }
|
3577 | encryptFields(fieldsModel, key) {
|
3578 | return cipher_service_awaiter(this, void 0, void 0, function* () {
|
3579 | if (!fieldsModel || !fieldsModel.length) {
|
3580 | return null;
|
3581 | }
|
3582 | const self = this;
|
3583 | const encFields = [];
|
3584 | yield fieldsModel.reduce((promise, field) => {
|
3585 | return promise.then(() => {
|
3586 | return self.encryptField(field, key);
|
3587 | }).then((encField) => {
|
3588 | encFields.push(encField);
|
3589 | });
|
3590 | }, Promise.resolve());
|
3591 | return encFields;
|
3592 | });
|
3593 | }
|
3594 | encryptField(fieldModel, key) {
|
3595 | return cipher_service_awaiter(this, void 0, void 0, function* () {
|
3596 | const field = new field_Field();
|
3597 | field.type = fieldModel.type;
|
3598 |
|
3599 | if (fieldModel.type === FieldType.Boolean && fieldModel.value !== 'true') {
|
3600 | fieldModel.value = 'false';
|
3601 | }
|
3602 | yield this.encryptObjProperty(fieldModel, field, {
|
3603 | name: null,
|
3604 | value: null,
|
3605 | }, key);
|
3606 | return field;
|
3607 | });
|
3608 | }
|
3609 | encryptPasswordHistories(phModels, key) {
|
3610 | return cipher_service_awaiter(this, void 0, void 0, function* () {
|
3611 | if (!phModels || !phModels.length) {
|
3612 | return null;
|
3613 | }
|
3614 | const self = this;
|
3615 | const encPhs = [];
|
3616 | yield phModels.reduce((promise, ph) => {
|
3617 | return promise.then(() => {
|
3618 | return self.encryptPasswordHistory(ph, key);
|
3619 | }).then((encPh) => {
|
3620 | encPhs.push(encPh);
|
3621 | });
|
3622 | }, Promise.resolve());
|
3623 | return encPhs;
|
3624 | });
|
3625 | }
|
3626 | encryptPasswordHistory(phModel, key) {
|
3627 | return cipher_service_awaiter(this, void 0, void 0, function* () {
|
3628 | const ph = new password_Password();
|
3629 | ph.lastUsedDate = phModel.lastUsedDate;
|
3630 | yield this.encryptObjProperty(phModel, ph, {
|
3631 | password: null,
|
3632 | }, key);
|
3633 | return ph;
|
3634 | });
|
3635 | }
|
3636 | get(id) {
|
3637 | return cipher_service_awaiter(this, void 0, void 0, function* () {
|
3638 | const userId = yield this.userService.getUserId();
|
3639 | const localData = yield this.storageService.get(Keys.localData);
|
3640 | const ciphers = yield this.storageService.get(Keys.ciphersPrefix + userId);
|
3641 | if (ciphers == null || !ciphers.hasOwnProperty(id)) {
|
3642 | return null;
|
3643 | }
|
3644 | return new cipher_Cipher(ciphers[id], false, localData ? localData[id] : null);
|
3645 | });
|
3646 | }
|
3647 | getAll() {
|
3648 | return cipher_service_awaiter(this, void 0, void 0, function* () {
|
3649 | const userId = yield this.userService.getUserId();
|
3650 | const localData = yield this.storageService.get(Keys.localData);
|
3651 | const ciphers = yield this.storageService.get(Keys.ciphersPrefix + userId);
|
3652 | const response = [];
|
3653 | for (const id in ciphers) {
|
3654 | if (ciphers.hasOwnProperty(id)) {
|
3655 | response.push(new cipher_Cipher(ciphers[id], false, localData ? localData[id] : null));
|
3656 | }
|
3657 | }
|
3658 | return response;
|
3659 | });
|
3660 | }
|
3661 | getAllDecrypted() {
|
3662 | return cipher_service_awaiter(this, void 0, void 0, function* () {
|
3663 | if (this.decryptedCipherCache != null) {
|
3664 | return this.decryptedCipherCache;
|
3665 | }
|
3666 | const decCiphers = [];
|
3667 | const hasKey = yield this.cryptoService.hasKey();
|
3668 | if (!hasKey) {
|
3669 | throw new Error('No key.');
|
3670 | }
|
3671 | const promises = [];
|
3672 | const ciphers = yield this.getAll();
|
3673 | ciphers.forEach((cipher) => {
|
3674 | promises.push(cipher.decrypt().then((c) => decCiphers.push(c)));
|
3675 | });
|
3676 | yield Promise.all(promises);
|
3677 | decCiphers.sort(this.getLocaleSortingFunction());
|
3678 | this.decryptedCipherCache = decCiphers;
|
3679 | return this.decryptedCipherCache;
|
3680 | });
|
3681 | }
|
3682 | getAllDecryptedForGrouping(groupingId, folder = true) {
|
3683 | return cipher_service_awaiter(this, void 0, void 0, function* () {
|
3684 | const ciphers = yield this.getAllDecrypted();
|
3685 | return ciphers.filter((cipher) => {
|
3686 | if (cipher.isDeleted) {
|
3687 | return false;
|
3688 | }
|
3689 | if (folder && cipher.folderId === groupingId) {
|
3690 | return true;
|
3691 | }
|
3692 | else if (!folder && cipher.collectionIds != null && cipher.collectionIds.indexOf(groupingId) > -1) {
|
3693 | return true;
|
3694 | }
|
3695 | return false;
|
3696 | });
|
3697 | });
|
3698 | }
|
3699 | getAllDecryptedForUrl(url, includeOtherTypes) {
|
3700 | return cipher_service_awaiter(this, void 0, void 0, function* () {
|
3701 | if (url == null && includeOtherTypes == null) {
|
3702 | return Promise.resolve([]);
|
3703 | }
|
3704 | const domain = utils_Utils.getDomain(url);
|
3705 | const eqDomainsPromise = domain == null ? Promise.resolve([]) :
|
3706 | this.settingsService.getEquivalentDomains().then((eqDomains) => {
|
3707 | let matches = [];
|
3708 | eqDomains.forEach((eqDomain) => {
|
3709 | if (eqDomain.length && eqDomain.indexOf(domain) >= 0) {
|
3710 | matches = matches.concat(eqDomain);
|
3711 | }
|
3712 | });
|
3713 | if (!matches.length) {
|
3714 | matches.push(domain);
|
3715 | }
|
3716 | return matches;
|
3717 | });
|
3718 | const result = yield Promise.all([eqDomainsPromise, this.getAllDecrypted()]);
|
3719 | const matchingDomains = result[0];
|
3720 | const ciphers = result[1];
|
3721 | let defaultMatch = yield this.storageService.get(ConstantsService.defaultUriMatch);
|
3722 | if (defaultMatch == null) {
|
3723 | defaultMatch = UriMatchType.Domain;
|
3724 | }
|
3725 | return ciphers.filter((cipher) => {
|
3726 | if (cipher.deletedDate != null) {
|
3727 | return false;
|
3728 | }
|
3729 | if (includeOtherTypes != null && includeOtherTypes.indexOf(cipher.type) > -1) {
|
3730 | return true;
|
3731 | }
|
3732 | if (url != null && cipher.type === CipherType.Login && cipher.login.uris != null) {
|
3733 | for (let i = 0; i < cipher.login.uris.length; i++) {
|
3734 | const u = cipher.login.uris[i];
|
3735 | if (u.uri == null) {
|
3736 | continue;
|
3737 | }
|
3738 | const match = u.match == null ? defaultMatch : u.match;
|
3739 | switch (match) {
|
3740 | case UriMatchType.Domain:
|
3741 | if (domain != null && u.domain != null && matchingDomains.indexOf(u.domain) > -1) {
|
3742 | if (DomainMatchBlacklist.has(u.domain)) {
|
3743 | const domainUrlHost = utils_Utils.getHost(url);
|
3744 | if (!DomainMatchBlacklist.get(u.domain).has(domainUrlHost)) {
|
3745 | return true;
|
3746 | }
|
3747 | }
|
3748 | else {
|
3749 | return true;
|
3750 | }
|
3751 | }
|
3752 | break;
|
3753 | case UriMatchType.Host:
|
3754 | const urlHost = utils_Utils.getHost(url);
|
3755 | if (urlHost != null && urlHost === utils_Utils.getHost(u.uri)) {
|
3756 | return true;
|
3757 | }
|
3758 | break;
|
3759 | case UriMatchType.Exact:
|
3760 | if (url === u.uri) {
|
3761 | return true;
|
3762 | }
|
3763 | break;
|
3764 | case UriMatchType.StartsWith:
|
3765 | if (url.startsWith(u.uri)) {
|
3766 | return true;
|
3767 | }
|
3768 | break;
|
3769 | case UriMatchType.RegularExpression:
|
3770 | try {
|
3771 | const regex = new RegExp(u.uri, 'i');
|
3772 | if (regex.test(url)) {
|
3773 | return true;
|
3774 | }
|
3775 | }
|
3776 | catch (_a) { }
|
3777 | break;
|
3778 | case UriMatchType.Never:
|
3779 | default:
|
3780 | break;
|
3781 | }
|
3782 | }
|
3783 | }
|
3784 | return false;
|
3785 | });
|
3786 | });
|
3787 | }
|
3788 | getAllFromApiForOrganization(organizationId) {
|
3789 | return cipher_service_awaiter(this, void 0, void 0, function* () {
|
3790 | const ciphers = yield this.apiService.getCiphersOrganization(organizationId);
|
3791 | if (ciphers != null && ciphers.data != null && ciphers.data.length) {
|
3792 | const decCiphers = [];
|
3793 | const promises = [];
|
3794 | ciphers.data.forEach((r) => {
|
3795 | const data = new cipherData_CipherData(r);
|
3796 | const cipher = new cipher_Cipher(data);
|
3797 | promises.push(cipher.decrypt().then((c) => decCiphers.push(c)));
|
3798 | });
|
3799 | yield Promise.all(promises);
|
3800 | decCiphers.sort(this.getLocaleSortingFunction());
|
3801 | return decCiphers;
|
3802 | }
|
3803 | else {
|
3804 | return [];
|
3805 | }
|
3806 | });
|
3807 | }
|
3808 | getLastUsedForUrl(url) {
|
3809 | return cipher_service_awaiter(this, void 0, void 0, function* () {
|
3810 | const ciphers = yield this.getAllDecryptedForUrl(url);
|
3811 | if (ciphers.length === 0) {
|
3812 | return null;
|
3813 | }
|
3814 | const sortedCiphers = ciphers.sort(this.sortCiphersByLastUsed);
|
3815 | return sortedCiphers[0];
|
3816 | });
|
3817 | }
|
3818 | updateLastUsedDate(id) {
|
3819 | return cipher_service_awaiter(this, void 0, void 0, function* () {
|
3820 | let ciphersLocalData = yield this.storageService.get(Keys.localData);
|
3821 | if (!ciphersLocalData) {
|
3822 | ciphersLocalData = {};
|
3823 | }
|
3824 | if (ciphersLocalData[id]) {
|
3825 | ciphersLocalData[id].lastUsedDate = new Date().getTime();
|
3826 | }
|
3827 | else {
|
3828 | ciphersLocalData[id] = {
|
3829 | lastUsedDate: new Date().getTime(),
|
3830 | };
|
3831 | }
|
3832 | yield this.storageService.save(Keys.localData, ciphersLocalData);
|
3833 | if (this.decryptedCipherCache == null) {
|
3834 | return;
|
3835 | }
|
3836 | for (let i = 0; i < this.decryptedCipherCache.length; i++) {
|
3837 | const cached = this.decryptedCipherCache[i];
|
3838 | if (cached.id === id) {
|
3839 | cached.localData = ciphersLocalData[id];
|
3840 | break;
|
3841 | }
|
3842 | }
|
3843 | });
|
3844 | }
|
3845 | saveNeverDomain(domain) {
|
3846 | return cipher_service_awaiter(this, void 0, void 0, function* () {
|
3847 | if (domain == null) {
|
3848 | return;
|
3849 | }
|
3850 | let domains = yield this.storageService.get(Keys.neverDomains);
|
3851 | if (!domains) {
|
3852 | domains = {};
|
3853 | }
|
3854 | domains[domain] = null;
|
3855 | yield this.storageService.save(Keys.neverDomains, domains);
|
3856 | });
|
3857 | }
|
3858 | saveWithServer(cipher) {
|
3859 | return cipher_service_awaiter(this, void 0, void 0, function* () {
|
3860 | let response;
|
3861 | if (cipher.id == null) {
|
3862 | if (cipher.collectionIds != null) {
|
3863 | const request = new cipherCreateRequest_CipherCreateRequest(cipher);
|
3864 | response = yield this.apiService.postCipherCreate(request);
|
3865 | }
|
3866 | else {
|
3867 | const request = new cipherRequest_CipherRequest(cipher);
|
3868 | response = yield this.apiService.postCipher(request);
|
3869 | }
|
3870 | cipher.id = response.id;
|
3871 | }
|
3872 | else {
|
3873 | const request = new cipherRequest_CipherRequest(cipher);
|
3874 | response = yield this.apiService.putCipher(cipher.id, request);
|
3875 | }
|
3876 | const userId = yield this.userService.getUserId();
|
3877 | const data = new cipherData_CipherData(response, userId, cipher.collectionIds);
|
3878 | yield this.upsert(data);
|
3879 | });
|
3880 | }
|
3881 | shareWithServer(cipher, organizationId, collectionIds) {
|
3882 | return cipher_service_awaiter(this, void 0, void 0, function* () {
|
3883 | const attachmentPromises = [];
|
3884 | if (cipher.attachments != null) {
|
3885 | cipher.attachments.forEach((attachment) => {
|
3886 | if (attachment.key == null) {
|
3887 | attachmentPromises.push(this.shareAttachmentWithServer(attachment, cipher.id, organizationId));
|
3888 | }
|
3889 | });
|
3890 | }
|
3891 | yield Promise.all(attachmentPromises);
|
3892 | cipher.organizationId = organizationId;
|
3893 | cipher.collectionIds = collectionIds;
|
3894 | const encCipher = yield this.encrypt(cipher);
|
3895 | const request = new cipherShareRequest_CipherShareRequest(encCipher);
|
3896 | const response = yield this.apiService.putShareCipher(cipher.id, request);
|
3897 | const userId = yield this.userService.getUserId();
|
3898 | const data = new cipherData_CipherData(response, userId, collectionIds);
|
3899 | yield this.upsert(data);
|
3900 | });
|
3901 | }
|
3902 | shareManyWithServer(ciphers, organizationId, collectionIds) {
|
3903 | return cipher_service_awaiter(this, void 0, void 0, function* () {
|
3904 | const promises = [];
|
3905 | const encCiphers = [];
|
3906 | for (const cipher of ciphers) {
|
3907 | cipher.organizationId = organizationId;
|
3908 | cipher.collectionIds = collectionIds;
|
3909 | promises.push(this.encrypt(cipher).then((c) => {
|
3910 | encCiphers.push(c);
|
3911 | }));
|
3912 | }
|
3913 | yield Promise.all(promises);
|
3914 | const request = new cipherBulkShareRequest_CipherBulkShareRequest(encCiphers, collectionIds);
|
3915 | yield this.apiService.putShareCiphers(request);
|
3916 | const userId = yield this.userService.getUserId();
|
3917 | yield this.upsert(encCiphers.map((c) => c.toCipherData(userId)));
|
3918 | });
|
3919 | }
|
3920 | saveAttachmentWithServer(cipher, unencryptedFile, admin = false) {
|
3921 | return new Promise((resolve, reject) => {
|
3922 | const reader = new FileReader();
|
3923 | reader.readAsArrayBuffer(unencryptedFile);
|
3924 | reader.onload = (evt) => cipher_service_awaiter(this, void 0, void 0, function* () {
|
3925 | try {
|
3926 | const cData = yield this.saveAttachmentRawWithServer(cipher, unencryptedFile.name, evt.target.result, admin);
|
3927 | resolve(cData);
|
3928 | }
|
3929 | catch (e) {
|
3930 | reject(e);
|
3931 | }
|
3932 | });
|
3933 | reader.onerror = (evt) => {
|
3934 | reject('Error reading file.');
|
3935 | };
|
3936 | });
|
3937 | }
|
3938 | saveAttachmentRawWithServer(cipher, filename, data, admin = false) {
|
3939 | return cipher_service_awaiter(this, void 0, void 0, function* () {
|
3940 | const key = yield this.cryptoService.getOrgKey(cipher.organizationId);
|
3941 | const encFileName = yield this.cryptoService.encrypt(filename, key);
|
3942 | const dataEncKey = yield this.cryptoService.makeEncKey(key);
|
3943 | const encData = yield this.cryptoService.encryptToBytes(data, dataEncKey[0]);
|
3944 | const fd = new FormData();
|
3945 | try {
|
3946 | const blob = new Blob([encData], { type: 'application/octet-stream' });
|
3947 | fd.append('key', dataEncKey[1].encryptedString);
|
3948 | fd.append('data', blob, encFileName.encryptedString);
|
3949 | }
|
3950 | catch (e) {
|
3951 | if (utils_Utils.isNode && !utils_Utils.isBrowser) {
|
3952 | fd.append('key', dataEncKey[1].encryptedString);
|
3953 | fd.append('data', Buffer.from(encData), {
|
3954 | filepath: encFileName.encryptedString,
|
3955 | contentType: 'application/octet-stream',
|
3956 | });
|
3957 | }
|
3958 | else {
|
3959 | throw e;
|
3960 | }
|
3961 | }
|
3962 | let response;
|
3963 | try {
|
3964 | if (admin) {
|
3965 | response = yield this.apiService.postCipherAttachmentAdmin(cipher.id, fd);
|
3966 | }
|
3967 | else {
|
3968 | response = yield this.apiService.postCipherAttachment(cipher.id, fd);
|
3969 | }
|
3970 | }
|
3971 | catch (e) {
|
3972 | throw new Error(e.getSingleMessage());
|
3973 | }
|
3974 | const userId = yield this.userService.getUserId();
|
3975 | const cData = new cipherData_CipherData(response, userId, cipher.collectionIds);
|
3976 | if (!admin) {
|
3977 | yield this.upsert(cData);
|
3978 | }
|
3979 | return new cipher_Cipher(cData);
|
3980 | });
|
3981 | }
|
3982 | saveCollectionsWithServer(cipher) {
|
3983 | return cipher_service_awaiter(this, void 0, void 0, function* () {
|
3984 | const request = new CipherCollectionsRequest(cipher.collectionIds);
|
3985 | yield this.apiService.putCipherCollections(cipher.id, request);
|
3986 | const userId = yield this.userService.getUserId();
|
3987 | const data = cipher.toCipherData(userId);
|
3988 | yield this.upsert(data);
|
3989 | });
|
3990 | }
|
3991 | upsert(cipher) {
|
3992 | return cipher_service_awaiter(this, void 0, void 0, function* () {
|
3993 | const userId = yield this.userService.getUserId();
|
3994 | let ciphers = yield this.storageService.get(Keys.ciphersPrefix + userId);
|
3995 | if (ciphers == null) {
|
3996 | ciphers = {};
|
3997 | }
|
3998 | if (cipher instanceof cipherData_CipherData) {
|
3999 | const c = cipher;
|
4000 | ciphers[c.id] = c;
|
4001 | }
|
4002 | else {
|
4003 | cipher.forEach((c) => {
|
4004 | ciphers[c.id] = c;
|
4005 | });
|
4006 | }
|
4007 | yield this.storageService.save(Keys.ciphersPrefix + userId, ciphers);
|
4008 | this.decryptedCipherCache = null;
|
4009 | });
|
4010 | }
|
4011 | replace(ciphers) {
|
4012 | return cipher_service_awaiter(this, void 0, void 0, function* () {
|
4013 | const userId = yield this.userService.getUserId();
|
4014 | yield this.storageService.save(Keys.ciphersPrefix + userId, ciphers);
|
4015 | this.decryptedCipherCache = null;
|
4016 | });
|
4017 | }
|
4018 | clear(userId) {
|
4019 | return cipher_service_awaiter(this, void 0, void 0, function* () {
|
4020 | yield this.storageService.remove(Keys.ciphersPrefix + userId);
|
4021 | this.clearCache();
|
4022 | });
|
4023 | }
|
4024 | moveManyWithServer(ids, folderId) {
|
4025 | return cipher_service_awaiter(this, void 0, void 0, function* () {
|
4026 | yield this.apiService.putMoveCiphers(new CipherBulkMoveRequest(ids, folderId));
|
4027 | const userId = yield this.userService.getUserId();
|
4028 | let ciphers = yield this.storageService.get(Keys.ciphersPrefix + userId);
|
4029 | if (ciphers == null) {
|
4030 | ciphers = {};
|
4031 | }
|
4032 | ids.forEach((id) => {
|
4033 | if (ciphers.hasOwnProperty(id)) {
|
4034 | ciphers[id].folderId = folderId;
|
4035 | }
|
4036 | });
|
4037 | yield this.storageService.save(Keys.ciphersPrefix + userId, ciphers);
|
4038 | this.decryptedCipherCache = null;
|
4039 | });
|
4040 | }
|
4041 | delete(id) {
|
4042 | return cipher_service_awaiter(this, void 0, void 0, function* () {
|
4043 | const userId = yield this.userService.getUserId();
|
4044 | const ciphers = yield this.storageService.get(Keys.ciphersPrefix + userId);
|
4045 | if (ciphers == null) {
|
4046 | return;
|
4047 | }
|
4048 | if (typeof id === 'string') {
|
4049 | if (ciphers[id] == null) {
|
4050 | return;
|
4051 | }
|
4052 | delete ciphers[id];
|
4053 | }
|
4054 | else {
|
4055 | id.forEach((i) => {
|
4056 | delete ciphers[i];
|
4057 | });
|
4058 | }
|
4059 | yield this.storageService.save(Keys.ciphersPrefix + userId, ciphers);
|
4060 | this.decryptedCipherCache = null;
|
4061 | });
|
4062 | }
|
4063 | deleteWithServer(id) {
|
4064 | return cipher_service_awaiter(this, void 0, void 0, function* () {
|
4065 | yield this.apiService.deleteCipher(id);
|
4066 | yield this.delete(id);
|
4067 | });
|
4068 | }
|
4069 | deleteManyWithServer(ids) {
|
4070 | return cipher_service_awaiter(this, void 0, void 0, function* () {
|
4071 | yield this.apiService.deleteManyCiphers(new CipherBulkDeleteRequest(ids));
|
4072 | yield this.delete(ids);
|
4073 | });
|
4074 | }
|
4075 | deleteAttachment(id, attachmentId) {
|
4076 | return cipher_service_awaiter(this, void 0, void 0, function* () {
|
4077 | const userId = yield this.userService.getUserId();
|
4078 | const ciphers = yield this.storageService.get(Keys.ciphersPrefix + userId);
|
4079 | if (ciphers == null || !ciphers.hasOwnProperty(id) || ciphers[id].attachments == null) {
|
4080 | return;
|
4081 | }
|
4082 | for (let i = 0; i < ciphers[id].attachments.length; i++) {
|
4083 | if (ciphers[id].attachments[i].id === attachmentId) {
|
4084 | ciphers[id].attachments.splice(i, 1);
|
4085 | }
|
4086 | }
|
4087 | yield this.storageService.save(Keys.ciphersPrefix + userId, ciphers);
|
4088 | this.decryptedCipherCache = null;
|
4089 | });
|
4090 | }
|
4091 | deleteAttachmentWithServer(id, attachmentId) {
|
4092 | return cipher_service_awaiter(this, void 0, void 0, function* () {
|
4093 | try {
|
4094 | yield this.apiService.deleteCipherAttachment(id, attachmentId);
|
4095 | }
|
4096 | catch (e) {
|
4097 | return Promise.reject(e.getSingleMessage());
|
4098 | }
|
4099 | yield this.deleteAttachment(id, attachmentId);
|
4100 | });
|
4101 | }
|
4102 | sortCiphersByLastUsed(a, b) {
|
4103 | const aLastUsed = a.localData && a.localData.lastUsedDate ? a.localData.lastUsedDate : null;
|
4104 | const bLastUsed = b.localData && b.localData.lastUsedDate ? b.localData.lastUsedDate : null;
|
4105 | const bothNotNull = aLastUsed != null && bLastUsed != null;
|
4106 | if (bothNotNull && aLastUsed < bLastUsed) {
|
4107 | return 1;
|
4108 | }
|
4109 | if (aLastUsed != null && bLastUsed == null) {
|
4110 | return -1;
|
4111 | }
|
4112 | if (bothNotNull && aLastUsed > bLastUsed) {
|
4113 | return -1;
|
4114 | }
|
4115 | if (bLastUsed != null && aLastUsed == null) {
|
4116 | return 1;
|
4117 | }
|
4118 | return 0;
|
4119 | }
|
4120 | sortCiphersByLastUsedThenName(a, b) {
|
4121 | const result = this.sortCiphersByLastUsed(a, b);
|
4122 | if (result !== 0) {
|
4123 | return result;
|
4124 | }
|
4125 | return this.getLocaleSortingFunction()(a, b);
|
4126 | }
|
4127 | getLocaleSortingFunction() {
|
4128 | return (a, b) => {
|
4129 | let aName = a.name;
|
4130 | let bName = b.name;
|
4131 | if (aName == null && bName != null) {
|
4132 | return -1;
|
4133 | }
|
4134 | if (aName != null && bName == null) {
|
4135 | return 1;
|
4136 | }
|
4137 | if (aName == null && bName == null) {
|
4138 | return 0;
|
4139 | }
|
4140 | const result = this.i18nService.collator ? this.i18nService.collator.compare(aName, bName) :
|
4141 | aName.localeCompare(bName);
|
4142 | if (result !== 0 || a.type !== CipherType.Login || b.type !== CipherType.Login) {
|
4143 | return result;
|
4144 | }
|
4145 | if (a.login.username != null) {
|
4146 | aName += a.login.username;
|
4147 | }
|
4148 | if (b.login.username != null) {
|
4149 | bName += b.login.username;
|
4150 | }
|
4151 | return this.i18nService.collator ? this.i18nService.collator.compare(aName, bName) :
|
4152 | aName.localeCompare(bName);
|
4153 | };
|
4154 | }
|
4155 | softDelete(id) {
|
4156 | return cipher_service_awaiter(this, void 0, void 0, function* () {
|
4157 | const userId = yield this.userService.getUserId();
|
4158 | const ciphers = yield this.storageService.get(Keys.ciphersPrefix + userId);
|
4159 | if (ciphers == null) {
|
4160 | return;
|
4161 | }
|
4162 | const setDeletedDate = (cipherId) => {
|
4163 | if (ciphers[cipherId] == null) {
|
4164 | return;
|
4165 | }
|
4166 | ciphers[cipherId].deletedDate = new Date().toISOString();
|
4167 | };
|
4168 | if (typeof id === 'string') {
|
4169 | setDeletedDate(id);
|
4170 | }
|
4171 | else {
|
4172 | id.forEach(setDeletedDate);
|
4173 | }
|
4174 | yield this.storageService.save(Keys.ciphersPrefix + userId, ciphers);
|
4175 | this.decryptedCipherCache = null;
|
4176 | });
|
4177 | }
|
4178 | softDeleteWithServer(id) {
|
4179 | return cipher_service_awaiter(this, void 0, void 0, function* () {
|
4180 | yield this.apiService.putDeleteCipher(id);
|
4181 | yield this.softDelete(id);
|
4182 | });
|
4183 | }
|
4184 | softDeleteManyWithServer(ids) {
|
4185 | return cipher_service_awaiter(this, void 0, void 0, function* () {
|
4186 | yield this.apiService.putDeleteManyCiphers(new CipherBulkDeleteRequest(ids));
|
4187 | yield this.softDelete(ids);
|
4188 | });
|
4189 | }
|
4190 | restore(id) {
|
4191 | return cipher_service_awaiter(this, void 0, void 0, function* () {
|
4192 | const userId = yield this.userService.getUserId();
|
4193 | const ciphers = yield this.storageService.get(Keys.ciphersPrefix + userId);
|
4194 | if (ciphers == null) {
|
4195 | return;
|
4196 | }
|
4197 | const clearDeletedDate = (cipherId) => {
|
4198 | if (ciphers[cipherId] == null) {
|
4199 | return;
|
4200 | }
|
4201 | ciphers[cipherId].deletedDate = null;
|
4202 | };
|
4203 | if (typeof id === 'string') {
|
4204 | clearDeletedDate(id);
|
4205 | }
|
4206 | else {
|
4207 | id.forEach(clearDeletedDate);
|
4208 | }
|
4209 | yield this.storageService.save(Keys.ciphersPrefix + userId, ciphers);
|
4210 | this.decryptedCipherCache = null;
|
4211 | });
|
4212 | }
|
4213 | restoreWithServer(id) {
|
4214 | return cipher_service_awaiter(this, void 0, void 0, function* () {
|
4215 | yield this.apiService.putRestoreCipher(id);
|
4216 | yield this.restore(id);
|
4217 | });
|
4218 | }
|
4219 | restoreManyWithServer(ids) {
|
4220 | return cipher_service_awaiter(this, void 0, void 0, function* () {
|
4221 | yield this.apiService.putRestoreManyCiphers(new CipherBulkRestoreRequest(ids));
|
4222 | yield this.restore(ids);
|
4223 | });
|
4224 | }
|
4225 |
|
4226 | shareAttachmentWithServer(attachmentView, cipherId, organizationId) {
|
4227 | return cipher_service_awaiter(this, void 0, void 0, function* () {
|
4228 | const attachmentResponse = yield this.apiService.nativeFetch(new Request(attachmentView.url, { cache: 'no-store' }));
|
4229 | if (attachmentResponse.status !== 200) {
|
4230 | throw Error('Failed to download attachment: ' + attachmentResponse.status.toString());
|
4231 | }
|
4232 | const buf = yield attachmentResponse.arrayBuffer();
|
4233 | const decBuf = yield this.cryptoService.decryptFromBytes(buf, null);
|
4234 | const key = yield this.cryptoService.getOrgKey(organizationId);
|
4235 | const encFileName = yield this.cryptoService.encrypt(attachmentView.fileName, key);
|
4236 | const dataEncKey = yield this.cryptoService.makeEncKey(key);
|
4237 | const encData = yield this.cryptoService.encryptToBytes(decBuf, dataEncKey[0]);
|
4238 | const fd = new FormData();
|
4239 | try {
|
4240 | const blob = new Blob([encData], { type: 'application/octet-stream' });
|
4241 | fd.append('key', dataEncKey[1].encryptedString);
|
4242 | fd.append('data', blob, encFileName.encryptedString);
|
4243 | }
|
4244 | catch (e) {
|
4245 | if (utils_Utils.isNode && !utils_Utils.isBrowser) {
|
4246 | fd.append('key', dataEncKey[1].encryptedString);
|
4247 | fd.append('data', Buffer.from(encData), {
|
4248 | filepath: encFileName.encryptedString,
|
4249 | contentType: 'application/octet-stream',
|
4250 | });
|
4251 | }
|
4252 | else {
|
4253 | throw e;
|
4254 | }
|
4255 | }
|
4256 | try {
|
4257 | yield this.apiService.postShareCipherAttachment(cipherId, attachmentView.id, fd, organizationId);
|
4258 | }
|
4259 | catch (e) {
|
4260 | throw new Error(e.getSingleMessage());
|
4261 | }
|
4262 | });
|
4263 | }
|
4264 | encryptObjProperty(model, obj, map, key) {
|
4265 | return cipher_service_awaiter(this, void 0, void 0, function* () {
|
4266 | const promises = [];
|
4267 | const self = this;
|
4268 | for (const prop in map) {
|
4269 | if (!map.hasOwnProperty(prop)) {
|
4270 | continue;
|
4271 | }
|
4272 |
|
4273 | (function (theProp, theObj) {
|
4274 | const p = Promise.resolve().then(() => {
|
4275 | const modelProp = model[(map[theProp] || theProp)];
|
4276 | if (modelProp && modelProp !== '') {
|
4277 | return self.cryptoService.encrypt(modelProp, key);
|
4278 | }
|
4279 | return null;
|
4280 | }).then((val) => {
|
4281 | theObj[theProp] = val;
|
4282 | });
|
4283 | promises.push(p);
|
4284 | })(prop, obj);
|
4285 | }
|
4286 | yield Promise.all(promises);
|
4287 | });
|
4288 | }
|
4289 | encryptCipherData(cipher, model, key) {
|
4290 | return cipher_service_awaiter(this, void 0, void 0, function* () {
|
4291 | switch (cipher.type) {
|
4292 | case CipherType.Login:
|
4293 | cipher.login = new login_Login();
|
4294 | cipher.login.passwordRevisionDate = model.login.passwordRevisionDate;
|
4295 | yield this.encryptObjProperty(model.login, cipher.login, {
|
4296 | username: null,
|
4297 | password: null,
|
4298 | totp: null,
|
4299 | }, key);
|
4300 | if (model.login.uris != null) {
|
4301 | cipher.login.uris = [];
|
4302 | for (let i = 0; i < model.login.uris.length; i++) {
|
4303 | const loginUri = new loginUri_LoginUri();
|
4304 | loginUri.match = model.login.uris[i].match;
|
4305 | yield this.encryptObjProperty(model.login.uris[i], loginUri, {
|
4306 | uri: null,
|
4307 | }, key);
|
4308 | cipher.login.uris.push(loginUri);
|
4309 | }
|
4310 | }
|
4311 | return;
|
4312 | case CipherType.SecureNote:
|
4313 | cipher.secureNote = new secureNote_SecureNote();
|
4314 | cipher.secureNote.type = model.secureNote.type;
|
4315 | return;
|
4316 | case CipherType.Card:
|
4317 | cipher.card = new card_Card();
|
4318 | yield this.encryptObjProperty(model.card, cipher.card, {
|
4319 | cardholderName: null,
|
4320 | brand: null,
|
4321 | number: null,
|
4322 | expMonth: null,
|
4323 | expYear: null,
|
4324 | code: null,
|
4325 | }, key);
|
4326 | return;
|
4327 | case CipherType.Identity:
|
4328 | cipher.identity = new identity_Identity();
|
4329 | yield this.encryptObjProperty(model.identity, cipher.identity, {
|
4330 | title: null,
|
4331 | firstName: null,
|
4332 | middleName: null,
|
4333 | lastName: null,
|
4334 | address1: null,
|
4335 | address2: null,
|
4336 | address3: null,
|
4337 | city: null,
|
4338 | state: null,
|
4339 | postalCode: null,
|
4340 | country: null,
|
4341 | company: null,
|
4342 | email: null,
|
4343 | phone: null,
|
4344 | ssn: null,
|
4345 | username: null,
|
4346 | passportNumber: null,
|
4347 | licenseNumber: null,
|
4348 | }, key);
|
4349 | return;
|
4350 | default:
|
4351 | throw new Error('Unknown cipher type.');
|
4352 | }
|
4353 | });
|
4354 | }
|
4355 | }
|
4356 | cipher_service_decorate([
|
4357 | sequentialize(() => 'getAllDecrypted'),
|
4358 | cipher_service_metadata("design:type", Function),
|
4359 | cipher_service_metadata("design:paramtypes", []),
|
4360 | cipher_service_metadata("design:returntype", Promise)
|
4361 | ], cipher_service_CipherService.prototype, "getAllDecrypted", null);
|
4362 |
|
4363 |
|
4364 | class CollectionData {
|
4365 | constructor(response) {
|
4366 | this.id = response.id;
|
4367 | this.organizationId = response.organizationId;
|
4368 | this.name = response.name;
|
4369 | this.externalId = response.externalId;
|
4370 | this.readOnly = response.readOnly;
|
4371 | }
|
4372 | }
|
4373 |
|
4374 |
|
4375 | class TreeNode {
|
4376 | constructor(node, name, parent) {
|
4377 | this.children = [];
|
4378 | this.parent = parent;
|
4379 | this.node = node;
|
4380 | this.node.name = name;
|
4381 | }
|
4382 | }
|
4383 |
|
4384 |
|
4385 |
|
4386 | class serviceUtils_ServiceUtils {
|
4387 | static nestedTraverse(nodeTree, partIndex, parts, obj, parent, delimiter) {
|
4388 | if (parts.length <= partIndex) {
|
4389 | return;
|
4390 | }
|
4391 | const end = partIndex === parts.length - 1;
|
4392 | const partName = parts[partIndex];
|
4393 | for (let i = 0; i < nodeTree.length; i++) {
|
4394 | if (nodeTree[i].node.name !== parts[partIndex]) {
|
4395 | continue;
|
4396 | }
|
4397 | if (end && nodeTree[i].node.id !== obj.id) {
|
4398 |
|
4399 | nodeTree.push(new TreeNode(obj, partName, parent));
|
4400 | return;
|
4401 | }
|
4402 | serviceUtils_ServiceUtils.nestedTraverse(nodeTree[i].children, partIndex + 1, parts, obj, nodeTree[i].node, delimiter);
|
4403 | return;
|
4404 | }
|
4405 | if (nodeTree.filter((n) => n.node.name === partName).length === 0) {
|
4406 | if (end) {
|
4407 | nodeTree.push(new TreeNode(obj, partName, parent));
|
4408 | return;
|
4409 | }
|
4410 | const newPartName = parts[partIndex] + delimiter + parts[partIndex + 1];
|
4411 | serviceUtils_ServiceUtils.nestedTraverse(nodeTree, 0, [newPartName, ...parts.slice(partIndex + 2)], obj, parent, delimiter);
|
4412 | }
|
4413 | }
|
4414 | static getTreeNodeObject(nodeTree, id) {
|
4415 | for (let i = 0; i < nodeTree.length; i++) {
|
4416 | if (nodeTree[i].node.id === id) {
|
4417 | return nodeTree[i];
|
4418 | }
|
4419 | else if (nodeTree[i].children != null) {
|
4420 | const node = serviceUtils_ServiceUtils.getTreeNodeObject(nodeTree[i].children, id);
|
4421 | if (node !== null) {
|
4422 | return node;
|
4423 | }
|
4424 | }
|
4425 | }
|
4426 | return null;
|
4427 | }
|
4428 | }
|
4429 |
|
4430 |
|
4431 | var collection_service_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
4432 | return new (P || (P = Promise))(function (resolve, reject) {
|
4433 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
4434 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
4435 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
4436 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
4437 | });
|
4438 | };
|
4439 |
|
4440 |
|
4441 |
|
4442 |
|
4443 |
|
4444 | const collection_service_Keys = {
|
4445 | collectionsPrefix: 'collections_',
|
4446 | };
|
4447 | const NestingDelimiter = '/';
|
4448 | class collection_service_CollectionService {
|
4449 | constructor(cryptoService, userService, storageService, i18nService) {
|
4450 | this.cryptoService = cryptoService;
|
4451 | this.userService = userService;
|
4452 | this.storageService = storageService;
|
4453 | this.i18nService = i18nService;
|
4454 | }
|
4455 | clearCache() {
|
4456 | this.decryptedCollectionCache = null;
|
4457 | }
|
4458 | encrypt(model) {
|
4459 | return collection_service_awaiter(this, void 0, void 0, function* () {
|
4460 | if (model.organizationId == null) {
|
4461 | throw new Error('Collection has no organization id.');
|
4462 | }
|
4463 | const key = yield this.cryptoService.getOrgKey(model.organizationId);
|
4464 | if (key == null) {
|
4465 | throw new Error('No key for this collection\'s organization.');
|
4466 | }
|
4467 | const collection = new collection_Collection();
|
4468 | collection.id = model.id;
|
4469 | collection.organizationId = model.organizationId;
|
4470 | collection.readOnly = model.readOnly;
|
4471 | collection.name = yield this.cryptoService.encrypt(model.name, key);
|
4472 | return collection;
|
4473 | });
|
4474 | }
|
4475 | decryptMany(collections) {
|
4476 | return collection_service_awaiter(this, void 0, void 0, function* () {
|
4477 | if (collections == null) {
|
4478 | return [];
|
4479 | }
|
4480 | const decCollections = [];
|
4481 | const promises = [];
|
4482 | collections.forEach((collection) => {
|
4483 | promises.push(collection.decrypt().then((c) => decCollections.push(c)));
|
4484 | });
|
4485 | yield Promise.all(promises);
|
4486 | return decCollections.sort(utils_Utils.getSortFunction(this.i18nService, 'name'));
|
4487 | });
|
4488 | }
|
4489 | get(id) {
|
4490 | return collection_service_awaiter(this, void 0, void 0, function* () {
|
4491 | const userId = yield this.userService.getUserId();
|
4492 | const collections = yield this.storageService.get(collection_service_Keys.collectionsPrefix + userId);
|
4493 | if (collections == null || !collections.hasOwnProperty(id)) {
|
4494 | return null;
|
4495 | }
|
4496 | return new collection_Collection(collections[id]);
|
4497 | });
|
4498 | }
|
4499 | getAll() {
|
4500 | return collection_service_awaiter(this, void 0, void 0, function* () {
|
4501 | const userId = yield this.userService.getUserId();
|
4502 | const collections = yield this.storageService.get(collection_service_Keys.collectionsPrefix + userId);
|
4503 | const response = [];
|
4504 | for (const id in collections) {
|
4505 | if (collections.hasOwnProperty(id)) {
|
4506 | response.push(new collection_Collection(collections[id]));
|
4507 | }
|
4508 | }
|
4509 | return response;
|
4510 | });
|
4511 | }
|
4512 | getAllDecrypted() {
|
4513 | return collection_service_awaiter(this, void 0, void 0, function* () {
|
4514 | if (this.decryptedCollectionCache != null) {
|
4515 | return this.decryptedCollectionCache;
|
4516 | }
|
4517 | const hasKey = yield this.cryptoService.hasKey();
|
4518 | if (!hasKey) {
|
4519 | throw new Error('No key.');
|
4520 | }
|
4521 | const collections = yield this.getAll();
|
4522 | this.decryptedCollectionCache = yield this.decryptMany(collections);
|
4523 | return this.decryptedCollectionCache;
|
4524 | });
|
4525 | }
|
4526 | getAllNested(collections = null) {
|
4527 | return collection_service_awaiter(this, void 0, void 0, function* () {
|
4528 | if (collections == null) {
|
4529 | collections = yield this.getAllDecrypted();
|
4530 | }
|
4531 | const nodes = [];
|
4532 | collections.forEach((c) => {
|
4533 | const collectionCopy = new collectionView_CollectionView();
|
4534 | collectionCopy.id = c.id;
|
4535 | collectionCopy.organizationId = c.organizationId;
|
4536 | const parts = c.name != null ? c.name.replace(/^\/+|\/+$/g, '').split(NestingDelimiter) : [];
|
4537 | serviceUtils_ServiceUtils.nestedTraverse(nodes, 0, parts, collectionCopy, null, NestingDelimiter);
|
4538 | });
|
4539 | return nodes;
|
4540 | });
|
4541 | }
|
4542 | getNested(id) {
|
4543 | return collection_service_awaiter(this, void 0, void 0, function* () {
|
4544 | const collections = yield this.getAllNested();
|
4545 | return serviceUtils_ServiceUtils.getTreeNodeObject(collections, id);
|
4546 | });
|
4547 | }
|
4548 | upsert(collection) {
|
4549 | return collection_service_awaiter(this, void 0, void 0, function* () {
|
4550 | const userId = yield this.userService.getUserId();
|
4551 | let collections = yield this.storageService.get(collection_service_Keys.collectionsPrefix + userId);
|
4552 | if (collections == null) {
|
4553 | collections = {};
|
4554 | }
|
4555 | if (collection instanceof CollectionData) {
|
4556 | const c = collection;
|
4557 | collections[c.id] = c;
|
4558 | }
|
4559 | else {
|
4560 | collection.forEach((c) => {
|
4561 | collections[c.id] = c;
|
4562 | });
|
4563 | }
|
4564 | yield this.storageService.save(collection_service_Keys.collectionsPrefix + userId, collections);
|
4565 | this.decryptedCollectionCache = null;
|
4566 | });
|
4567 | }
|
4568 | replace(collections) {
|
4569 | return collection_service_awaiter(this, void 0, void 0, function* () {
|
4570 | const userId = yield this.userService.getUserId();
|
4571 | yield this.storageService.save(collection_service_Keys.collectionsPrefix + userId, collections);
|
4572 | this.decryptedCollectionCache = null;
|
4573 | });
|
4574 | }
|
4575 | clear(userId) {
|
4576 | return collection_service_awaiter(this, void 0, void 0, function* () {
|
4577 | yield this.storageService.remove(collection_service_Keys.collectionsPrefix + userId);
|
4578 | this.decryptedCollectionCache = null;
|
4579 | });
|
4580 | }
|
4581 | delete(id) {
|
4582 | return collection_service_awaiter(this, void 0, void 0, function* () {
|
4583 | const userId = yield this.userService.getUserId();
|
4584 | const collections = yield this.storageService.get(collection_service_Keys.collectionsPrefix + userId);
|
4585 | if (collections == null) {
|
4586 | return;
|
4587 | }
|
4588 | if (typeof id === 'string') {
|
4589 | const i = id;
|
4590 | delete collections[id];
|
4591 | }
|
4592 | else {
|
4593 | id.forEach((i) => {
|
4594 | delete collections[i];
|
4595 | });
|
4596 | }
|
4597 | yield this.storageService.save(collection_service_Keys.collectionsPrefix + userId, collections);
|
4598 | this.decryptedCollectionCache = null;
|
4599 | });
|
4600 | }
|
4601 | }
|
4602 |
|
4603 |
|
4604 | class ContainerService {
|
4605 | constructor(cryptoService) {
|
4606 | this.cryptoService = cryptoService;
|
4607 | }
|
4608 |
|
4609 | attachToWindow(win) {
|
4610 | this.attachToGlobal(win);
|
4611 | }
|
4612 | attachToGlobal(global) {
|
4613 | if (!global.bitwardenContainerService) {
|
4614 | global.bitwardenContainerService = this;
|
4615 | }
|
4616 | }
|
4617 | getCryptoService() {
|
4618 | return this.cryptoService;
|
4619 | }
|
4620 | }
|
4621 |
|
4622 |
|
4623 | var external_big_integer_ = __webpack_require__(13);
|
4624 |
|
4625 |
|
4626 | var KdfType;
|
4627 | (function (KdfType) {
|
4628 | KdfType[KdfType["PBKDF2_SHA256"] = 0] = "PBKDF2_SHA256";
|
4629 | })(KdfType || (KdfType = {}));
|
4630 |
|
4631 |
|
4632 |
|
4633 | const EEFLongWordList = [
|
4634 | 'abacus',
|
4635 | 'abdomen',
|
4636 | 'abdominal',
|
4637 | 'abide',
|
4638 | 'abiding',
|
4639 | 'ability',
|
4640 | 'ablaze',
|
4641 | 'able',
|
4642 | 'abnormal',
|
4643 | 'abrasion',
|
4644 | 'abrasive',
|
4645 | 'abreast',
|
4646 | 'abridge',
|
4647 | 'abroad',
|
4648 | 'abruptly',
|
4649 | 'absence',
|
4650 | 'absentee',
|
4651 | 'absently',
|
4652 | 'absinthe',
|
4653 | 'absolute',
|
4654 | 'absolve',
|
4655 | 'abstain',
|
4656 | 'abstract',
|
4657 | 'absurd',
|
4658 | 'accent',
|
4659 | 'acclaim',
|
4660 | 'acclimate',
|
4661 | 'accompany',
|
4662 | 'account',
|
4663 | 'accuracy',
|
4664 | 'accurate',
|
4665 | 'accustom',
|
4666 | 'acetone',
|
4667 | 'achiness',
|
4668 | 'aching',
|
4669 | 'acid',
|
4670 | 'acorn',
|
4671 | 'acquaint',
|
4672 | 'acquire',
|
4673 | 'acre',
|
4674 | 'acrobat',
|
4675 | 'acronym',
|
4676 | 'acting',
|
4677 | 'action',
|
4678 | 'activate',
|
4679 | 'activator',
|
4680 | 'active',
|
4681 | 'activism',
|
4682 | 'activist',
|
4683 | 'activity',
|
4684 | 'actress',
|
4685 | 'acts',
|
4686 | 'acutely',
|
4687 | 'acuteness',
|
4688 | 'aeration',
|
4689 | 'aerobics',
|
4690 | 'aerosol',
|
4691 | 'aerospace',
|
4692 | 'afar',
|
4693 | 'affair',
|
4694 | 'affected',
|
4695 | 'affecting',
|
4696 | 'affection',
|
4697 | 'affidavit',
|
4698 | 'affiliate',
|
4699 | 'affirm',
|
4700 | 'affix',
|
4701 | 'afflicted',
|
4702 | 'affluent',
|
4703 | 'afford',
|
4704 | 'affront',
|
4705 | 'aflame',
|
4706 | 'afloat',
|
4707 | 'aflutter',
|
4708 | 'afoot',
|
4709 | 'afraid',
|
4710 | 'afterglow',
|
4711 | 'afterlife',
|
4712 | 'aftermath',
|
4713 | 'aftermost',
|
4714 | 'afternoon',
|
4715 | 'aged',
|
4716 | 'ageless',
|
4717 | 'agency',
|
4718 | 'agenda',
|
4719 | 'agent',
|
4720 | 'aggregate',
|
4721 | 'aghast',
|
4722 | 'agile',
|
4723 | 'agility',
|
4724 | 'aging',
|
4725 | 'agnostic',
|
4726 | 'agonize',
|
4727 | 'agonizing',
|
4728 | 'agony',
|
4729 | 'agreeable',
|
4730 | 'agreeably',
|
4731 | 'agreed',
|
4732 | 'agreeing',
|
4733 | 'agreement',
|
4734 | 'aground',
|
4735 | 'ahead',
|
4736 | 'ahoy',
|
4737 | 'aide',
|
4738 | 'aids',
|
4739 | 'aim',
|
4740 | 'ajar',
|
4741 | 'alabaster',
|
4742 | 'alarm',
|
4743 | 'albatross',
|
4744 | 'album',
|
4745 | 'alfalfa',
|
4746 | 'algebra',
|
4747 | 'algorithm',
|
4748 | 'alias',
|
4749 | 'alibi',
|
4750 | 'alienable',
|
4751 | 'alienate',
|
4752 | 'aliens',
|
4753 | 'alike',
|
4754 | 'alive',
|
4755 | 'alkaline',
|
4756 | 'alkalize',
|
4757 | 'almanac',
|
4758 | 'almighty',
|
4759 | 'almost',
|
4760 | 'aloe',
|
4761 | 'aloft',
|
4762 | 'aloha',
|
4763 | 'alone',
|
4764 | 'alongside',
|
4765 | 'aloof',
|
4766 | 'alphabet',
|
4767 | 'alright',
|
4768 | 'although',
|
4769 | 'altitude',
|
4770 | 'alto',
|
4771 | 'aluminum',
|
4772 | 'alumni',
|
4773 | 'always',
|
4774 | 'amaretto',
|
4775 | 'amaze',
|
4776 | 'amazingly',
|
4777 | 'amber',
|
4778 | 'ambiance',
|
4779 | 'ambiguity',
|
4780 | 'ambiguous',
|
4781 | 'ambition',
|
4782 | 'ambitious',
|
4783 | 'ambulance',
|
4784 | 'ambush',
|
4785 | 'amendable',
|
4786 | 'amendment',
|
4787 | 'amends',
|
4788 | 'amenity',
|
4789 | 'amiable',
|
4790 | 'amicably',
|
4791 | 'amid',
|
4792 | 'amigo',
|
4793 | 'amino',
|
4794 | 'amiss',
|
4795 | 'ammonia',
|
4796 | 'ammonium',
|
4797 | 'amnesty',
|
4798 | 'amniotic',
|
4799 | 'among',
|
4800 | 'amount',
|
4801 | 'amperage',
|
4802 | 'ample',
|
4803 | 'amplifier',
|
4804 | 'amplify',
|
4805 | 'amply',
|
4806 | 'amuck',
|
4807 | 'amulet',
|
4808 | 'amusable',
|
4809 | 'amused',
|
4810 | 'amusement',
|
4811 | 'amuser',
|
4812 | 'amusing',
|
4813 | 'anaconda',
|
4814 | 'anaerobic',
|
4815 | 'anagram',
|
4816 | 'anatomist',
|
4817 | 'anatomy',
|
4818 | 'anchor',
|
4819 | 'anchovy',
|
4820 | 'ancient',
|
4821 | 'android',
|
4822 | 'anemia',
|
4823 | 'anemic',
|
4824 | 'aneurism',
|
4825 | 'anew',
|
4826 | 'angelfish',
|
4827 | 'angelic',
|
4828 | 'anger',
|
4829 | 'angled',
|
4830 | 'angler',
|
4831 | 'angles',
|
4832 | 'angling',
|
4833 | 'angrily',
|
4834 | 'angriness',
|
4835 | 'anguished',
|
4836 | 'angular',
|
4837 | 'animal',
|
4838 | 'animate',
|
4839 | 'animating',
|
4840 | 'animation',
|
4841 | 'animator',
|
4842 | 'anime',
|
4843 | 'animosity',
|
4844 | 'ankle',
|
4845 | 'annex',
|
4846 | 'annotate',
|
4847 | 'announcer',
|
4848 | 'annoying',
|
4849 | 'annually',
|
4850 | 'annuity',
|
4851 | 'anointer',
|
4852 | 'another',
|
4853 | 'answering',
|
4854 | 'antacid',
|
4855 | 'antarctic',
|
4856 | 'anteater',
|
4857 | 'antelope',
|
4858 | 'antennae',
|
4859 | 'anthem',
|
4860 | 'anthill',
|
4861 | 'anthology',
|
4862 | 'antibody',
|
4863 | 'antics',
|
4864 | 'antidote',
|
4865 | 'antihero',
|
4866 | 'antiquely',
|
4867 | 'antiques',
|
4868 | 'antiquity',
|
4869 | 'antirust',
|
4870 | 'antitoxic',
|
4871 | 'antitrust',
|
4872 | 'antiviral',
|
4873 | 'antivirus',
|
4874 | 'antler',
|
4875 | 'antonym',
|
4876 | 'antsy',
|
4877 | 'anvil',
|
4878 | 'anybody',
|
4879 | 'anyhow',
|
4880 | 'anymore',
|
4881 | 'anyone',
|
4882 | 'anyplace',
|
4883 | 'anything',
|
4884 | 'anytime',
|
4885 | 'anyway',
|
4886 | 'anywhere',
|
4887 | 'aorta',
|
4888 | 'apache',
|
4889 | 'apostle',
|
4890 | 'appealing',
|
4891 | 'appear',
|
4892 | 'appease',
|
4893 | 'appeasing',
|
4894 | 'appendage',
|
4895 | 'appendix',
|
4896 | 'appetite',
|
4897 | 'appetizer',
|
4898 | 'applaud',
|
4899 | 'applause',
|
4900 | 'apple',
|
4901 | 'appliance',
|
4902 | 'applicant',
|
4903 | 'applied',
|
4904 | 'apply',
|
4905 | 'appointee',
|
4906 | 'appraisal',
|
4907 | 'appraiser',
|
4908 | 'apprehend',
|
4909 | 'approach',
|
4910 | 'approval',
|
4911 | 'approve',
|
4912 | 'apricot',
|
4913 | 'april',
|
4914 | 'apron',
|
4915 | 'aptitude',
|
4916 | 'aptly',
|
4917 | 'aqua',
|
4918 | 'aqueduct',
|
4919 | 'arbitrary',
|
4920 | 'arbitrate',
|
4921 | 'ardently',
|
4922 | 'area',
|
4923 | 'arena',
|
4924 | 'arguable',
|
4925 | 'arguably',
|
4926 | 'argue',
|
4927 | 'arise',
|
4928 | 'armadillo',
|
4929 | 'armband',
|
4930 | 'armchair',
|
4931 | 'armed',
|
4932 | 'armful',
|
4933 | 'armhole',
|
4934 | 'arming',
|
4935 | 'armless',
|
4936 | 'armoire',
|
4937 | 'armored',
|
4938 | 'armory',
|
4939 | 'armrest',
|
4940 | 'army',
|
4941 | 'aroma',
|
4942 | 'arose',
|
4943 | 'around',
|
4944 | 'arousal',
|
4945 | 'arrange',
|
4946 | 'array',
|
4947 | 'arrest',
|
4948 | 'arrival',
|
4949 | 'arrive',
|
4950 | 'arrogance',
|
4951 | 'arrogant',
|
4952 | 'arson',
|
4953 | 'art',
|
4954 | 'ascend',
|
4955 | 'ascension',
|
4956 | 'ascent',
|
4957 | 'ascertain',
|
4958 | 'ashamed',
|
4959 | 'ashen',
|
4960 | 'ashes',
|
4961 | 'ashy',
|
4962 | 'aside',
|
4963 | 'askew',
|
4964 | 'asleep',
|
4965 | 'asparagus',
|
4966 | 'aspect',
|
4967 | 'aspirate',
|
4968 | 'aspire',
|
4969 | 'aspirin',
|
4970 | 'astonish',
|
4971 | 'astound',
|
4972 | 'astride',
|
4973 | 'astrology',
|
4974 | 'astronaut',
|
4975 | 'astronomy',
|
4976 | 'astute',
|
4977 | 'atlantic',
|
4978 | 'atlas',
|
4979 | 'atom',
|
4980 | 'atonable',
|
4981 | 'atop',
|
4982 | 'atrium',
|
4983 | 'atrocious',
|
4984 | 'atrophy',
|
4985 | 'attach',
|
4986 | 'attain',
|
4987 | 'attempt',
|
4988 | 'attendant',
|
4989 | 'attendee',
|
4990 | 'attention',
|
4991 | 'attentive',
|
4992 | 'attest',
|
4993 | 'attic',
|
4994 | 'attire',
|
4995 | 'attitude',
|
4996 | 'attractor',
|
4997 | 'attribute',
|
4998 | 'atypical',
|
4999 | 'auction',
|
5000 | 'audacious',
|
5001 | 'audacity',
|
5002 | 'audible',
|
5003 | 'audibly',
|
5004 | 'audience',
|
5005 | 'audio',
|
5006 | 'audition',
|
5007 | 'augmented',
|
5008 | 'august',
|
5009 | 'authentic',
|
5010 | 'author',
|
5011 | 'autism',
|
5012 | 'autistic',
|
5013 | 'autograph',
|
5014 | 'automaker',
|
5015 | 'automated',
|
5016 | 'automatic',
|
5017 | 'autopilot',
|
5018 | 'available',
|
5019 | 'avalanche',
|
5020 | 'avatar',
|
5021 | 'avenge',
|
5022 | 'avenging',
|
5023 | 'avenue',
|
5024 | 'average',
|
5025 | 'aversion',
|
5026 | 'avert',
|
5027 | 'aviation',
|
5028 | 'aviator',
|
5029 | 'avid',
|
5030 | 'avoid',
|
5031 | 'await',
|
5032 | 'awaken',
|
5033 | 'award',
|
5034 | 'aware',
|
5035 | 'awhile',
|
5036 | 'awkward',
|
5037 | 'awning',
|
5038 | 'awoke',
|
5039 | 'awry',
|
5040 | 'axis',
|
5041 | 'babble',
|
5042 | 'babbling',
|
5043 | 'babied',
|
5044 | 'baboon',
|
5045 | 'backache',
|
5046 | 'backboard',
|
5047 | 'backboned',
|
5048 | 'backdrop',
|
5049 | 'backed',
|
5050 | 'backer',
|
5051 | 'backfield',
|
5052 | 'backfire',
|
5053 | 'backhand',
|
5054 | 'backing',
|
5055 | 'backlands',
|
5056 | 'backlash',
|
5057 | 'backless',
|
5058 | 'backlight',
|
5059 | 'backlit',
|
5060 | 'backlog',
|
5061 | 'backpack',
|
5062 | 'backpedal',
|
5063 | 'backrest',
|
5064 | 'backroom',
|
5065 | 'backshift',
|
5066 | 'backside',
|
5067 | 'backslid',
|
5068 | 'backspace',
|
5069 | 'backspin',
|
5070 | 'backstab',
|
5071 | 'backstage',
|
5072 | 'backtalk',
|
5073 | 'backtrack',
|
5074 | 'backup',
|
5075 | 'backward',
|
5076 | 'backwash',
|
5077 | 'backwater',
|
5078 | 'backyard',
|
5079 | 'bacon',
|
5080 | 'bacteria',
|
5081 | 'bacterium',
|
5082 | 'badass',
|
5083 | 'badge',
|
5084 | 'badland',
|
5085 | 'badly',
|
5086 | 'badness',
|
5087 | 'baffle',
|
5088 | 'baffling',
|
5089 | 'bagel',
|
5090 | 'bagful',
|
5091 | 'baggage',
|
5092 | 'bagged',
|
5093 | 'baggie',
|
5094 | 'bagginess',
|
5095 | 'bagging',
|
5096 | 'baggy',
|
5097 | 'bagpipe',
|
5098 | 'baguette',
|
5099 | 'baked',
|
5100 | 'bakery',
|
5101 | 'bakeshop',
|
5102 | 'baking',
|
5103 | 'balance',
|
5104 | 'balancing',
|
5105 | 'balcony',
|
5106 | 'balmy',
|
5107 | 'balsamic',
|
5108 | 'bamboo',
|
5109 | 'banana',
|
5110 | 'banish',
|
5111 | 'banister',
|
5112 | 'banjo',
|
5113 | 'bankable',
|
5114 | 'bankbook',
|
5115 | 'banked',
|
5116 | 'banker',
|
5117 | 'banking',
|
5118 | 'banknote',
|
5119 | 'bankroll',
|
5120 | 'banner',
|
5121 | 'bannister',
|
5122 | 'banshee',
|
5123 | 'banter',
|
5124 | 'barbecue',
|
5125 | 'barbed',
|
5126 | 'barbell',
|
5127 | 'barber',
|
5128 | 'barcode',
|
5129 | 'barge',
|
5130 | 'bargraph',
|
5131 | 'barista',
|
5132 | 'baritone',
|
5133 | 'barley',
|
5134 | 'barmaid',
|
5135 | 'barman',
|
5136 | 'barn',
|
5137 | 'barometer',
|
5138 | 'barrack',
|
5139 | 'barracuda',
|
5140 | 'barrel',
|
5141 | 'barrette',
|
5142 | 'barricade',
|
5143 | 'barrier',
|
5144 | 'barstool',
|
5145 | 'bartender',
|
5146 | 'barterer',
|
5147 | 'bash',
|
5148 | 'basically',
|
5149 | 'basics',
|
5150 | 'basil',
|
5151 | 'basin',
|
5152 | 'basis',
|
5153 | 'basket',
|
5154 | 'batboy',
|
5155 | 'batch',
|
5156 | 'bath',
|
5157 | 'baton',
|
5158 | 'bats',
|
5159 | 'battalion',
|
5160 | 'battered',
|
5161 | 'battering',
|
5162 | 'battery',
|
5163 | 'batting',
|
5164 | 'battle',
|
5165 | 'bauble',
|
5166 | 'bazooka',
|
5167 | 'blabber',
|
5168 | 'bladder',
|
5169 | 'blade',
|
5170 | 'blah',
|
5171 | 'blame',
|
5172 | 'blaming',
|
5173 | 'blanching',
|
5174 | 'blandness',
|
5175 | 'blank',
|
5176 | 'blaspheme',
|
5177 | 'blasphemy',
|
5178 | 'blast',
|
5179 | 'blatancy',
|
5180 | 'blatantly',
|
5181 | 'blazer',
|
5182 | 'blazing',
|
5183 | 'bleach',
|
5184 | 'bleak',
|
5185 | 'bleep',
|
5186 | 'blemish',
|
5187 | 'blend',
|
5188 | 'bless',
|
5189 | 'blighted',
|
5190 | 'blimp',
|
5191 | 'bling',
|
5192 | 'blinked',
|
5193 | 'blinker',
|
5194 | 'blinking',
|
5195 | 'blinks',
|
5196 | 'blip',
|
5197 | 'blissful',
|
5198 | 'blitz',
|
5199 | 'blizzard',
|
5200 | 'bloated',
|
5201 | 'bloating',
|
5202 | 'blob',
|
5203 | 'blog',
|
5204 | 'bloomers',
|
5205 | 'blooming',
|
5206 | 'blooper',
|
5207 | 'blot',
|
5208 | 'blouse',
|
5209 | 'blubber',
|
5210 | 'bluff',
|
5211 | 'bluish',
|
5212 | 'blunderer',
|
5213 | 'blunt',
|
5214 | 'blurb',
|
5215 | 'blurred',
|
5216 | 'blurry',
|
5217 | 'blurt',
|
5218 | 'blush',
|
5219 | 'blustery',
|
5220 | 'boaster',
|
5221 | 'boastful',
|
5222 | 'boasting',
|
5223 | 'boat',
|
5224 | 'bobbed',
|
5225 | 'bobbing',
|
5226 | 'bobble',
|
5227 | 'bobcat',
|
5228 | 'bobsled',
|
5229 | 'bobtail',
|
5230 | 'bodacious',
|
5231 | 'body',
|
5232 | 'bogged',
|
5233 | 'boggle',
|
5234 | 'bogus',
|
5235 | 'boil',
|
5236 | 'bok',
|
5237 | 'bolster',
|
5238 | 'bolt',
|
5239 | 'bonanza',
|
5240 | 'bonded',
|
5241 | 'bonding',
|
5242 | 'bondless',
|
5243 | 'boned',
|
5244 | 'bonehead',
|
5245 | 'boneless',
|
5246 | 'bonelike',
|
5247 | 'boney',
|
5248 | 'bonfire',
|
5249 | 'bonnet',
|
5250 | 'bonsai',
|
5251 | 'bonus',
|
5252 | 'bony',
|
5253 | 'boogeyman',
|
5254 | 'boogieman',
|
5255 | 'book',
|
5256 | 'boondocks',
|
5257 | 'booted',
|
5258 | 'booth',
|
5259 | 'bootie',
|
5260 | 'booting',
|
5261 | 'bootlace',
|
5262 | 'bootleg',
|
5263 | 'boots',
|
5264 | 'boozy',
|
5265 | 'borax',
|
5266 | 'boring',
|
5267 | 'borough',
|
5268 | 'borrower',
|
5269 | 'borrowing',
|
5270 | 'boss',
|
5271 | 'botanical',
|
5272 | 'botanist',
|
5273 | 'botany',
|
5274 | 'botch',
|
5275 | 'both',
|
5276 | 'bottle',
|
5277 | 'bottling',
|
5278 | 'bottom',
|
5279 | 'bounce',
|
5280 | 'bouncing',
|
5281 | 'bouncy',
|
5282 | 'bounding',
|
5283 | 'boundless',
|
5284 | 'bountiful',
|
5285 | 'bovine',
|
5286 | 'boxcar',
|
5287 | 'boxer',
|
5288 | 'boxing',
|
5289 | 'boxlike',
|
5290 | 'boxy',
|
5291 | 'breach',
|
5292 | 'breath',
|
5293 | 'breeches',
|
5294 | 'breeching',
|
5295 | 'breeder',
|
5296 | 'breeding',
|
5297 | 'breeze',
|
5298 | 'breezy',
|
5299 | 'brethren',
|
5300 | 'brewery',
|
5301 | 'brewing',
|
5302 | 'briar',
|
5303 | 'bribe',
|
5304 | 'brick',
|
5305 | 'bride',
|
5306 | 'bridged',
|
5307 | 'brigade',
|
5308 | 'bright',
|
5309 | 'brilliant',
|
5310 | 'brim',
|
5311 | 'bring',
|
5312 | 'brink',
|
5313 | 'brisket',
|
5314 | 'briskly',
|
5315 | 'briskness',
|
5316 | 'bristle',
|
5317 | 'brittle',
|
5318 | 'broadband',
|
5319 | 'broadcast',
|
5320 | 'broaden',
|
5321 | 'broadly',
|
5322 | 'broadness',
|
5323 | 'broadside',
|
5324 | 'broadways',
|
5325 | 'broiler',
|
5326 | 'broiling',
|
5327 | 'broken',
|
5328 | 'broker',
|
5329 | 'bronchial',
|
5330 | 'bronco',
|
5331 | 'bronze',
|
5332 | 'bronzing',
|
5333 | 'brook',
|
5334 | 'broom',
|
5335 | 'brought',
|
5336 | 'browbeat',
|
5337 | 'brownnose',
|
5338 | 'browse',
|
5339 | 'browsing',
|
5340 | 'bruising',
|
5341 | 'brunch',
|
5342 | 'brunette',
|
5343 | 'brunt',
|
5344 | 'brush',
|
5345 | 'brussels',
|
5346 | 'brute',
|
5347 | 'brutishly',
|
5348 | 'bubble',
|
5349 | 'bubbling',
|
5350 | 'bubbly',
|
5351 | 'buccaneer',
|
5352 | 'bucked',
|
5353 | 'bucket',
|
5354 | 'buckle',
|
5355 | 'buckshot',
|
5356 | 'buckskin',
|
5357 | 'bucktooth',
|
5358 | 'buckwheat',
|
5359 | 'buddhism',
|
5360 | 'buddhist',
|
5361 | 'budding',
|
5362 | 'buddy',
|
5363 | 'budget',
|
5364 | 'buffalo',
|
5365 | 'buffed',
|
5366 | 'buffer',
|
5367 | 'buffing',
|
5368 | 'buffoon',
|
5369 | 'buggy',
|
5370 | 'bulb',
|
5371 | 'bulge',
|
5372 | 'bulginess',
|
5373 | 'bulgur',
|
5374 | 'bulk',
|
5375 | 'bulldog',
|
5376 | 'bulldozer',
|
5377 | 'bullfight',
|
5378 | 'bullfrog',
|
5379 | 'bullhorn',
|
5380 | 'bullion',
|
5381 | 'bullish',
|
5382 | 'bullpen',
|
5383 | 'bullring',
|
5384 | 'bullseye',
|
5385 | 'bullwhip',
|
5386 | 'bully',
|
5387 | 'bunch',
|
5388 | 'bundle',
|
5389 | 'bungee',
|
5390 | 'bunion',
|
5391 | 'bunkbed',
|
5392 | 'bunkhouse',
|
5393 | 'bunkmate',
|
5394 | 'bunny',
|
5395 | 'bunt',
|
5396 | 'busboy',
|
5397 | 'bush',
|
5398 | 'busily',
|
5399 | 'busload',
|
5400 | 'bust',
|
5401 | 'busybody',
|
5402 | 'buzz',
|
5403 | 'cabana',
|
5404 | 'cabbage',
|
5405 | 'cabbie',
|
5406 | 'cabdriver',
|
5407 | 'cable',
|
5408 | 'caboose',
|
5409 | 'cache',
|
5410 | 'cackle',
|
5411 | 'cacti',
|
5412 | 'cactus',
|
5413 | 'caddie',
|
5414 | 'caddy',
|
5415 | 'cadet',
|
5416 | 'cadillac',
|
5417 | 'cadmium',
|
5418 | 'cage',
|
5419 | 'cahoots',
|
5420 | 'cake',
|
5421 | 'calamari',
|
5422 | 'calamity',
|
5423 | 'calcium',
|
5424 | 'calculate',
|
5425 | 'calculus',
|
5426 | 'caliber',
|
5427 | 'calibrate',
|
5428 | 'calm',
|
5429 | 'caloric',
|
5430 | 'calorie',
|
5431 | 'calzone',
|
5432 | 'camcorder',
|
5433 | 'cameo',
|
5434 | 'camera',
|
5435 | 'camisole',
|
5436 | 'camper',
|
5437 | 'campfire',
|
5438 | 'camping',
|
5439 | 'campsite',
|
5440 | 'campus',
|
5441 | 'canal',
|
5442 | 'canary',
|
5443 | 'cancel',
|
5444 | 'candied',
|
5445 | 'candle',
|
5446 | 'candy',
|
5447 | 'cane',
|
5448 | 'canine',
|
5449 | 'canister',
|
5450 | 'cannabis',
|
5451 | 'canned',
|
5452 | 'canning',
|
5453 | 'cannon',
|
5454 | 'cannot',
|
5455 | 'canola',
|
5456 | 'canon',
|
5457 | 'canopener',
|
5458 | 'canopy',
|
5459 | 'canteen',
|
5460 | 'canyon',
|
5461 | 'capable',
|
5462 | 'capably',
|
5463 | 'capacity',
|
5464 | 'cape',
|
5465 | 'capillary',
|
5466 | 'capital',
|
5467 | 'capitol',
|
5468 | 'capped',
|
5469 | 'capricorn',
|
5470 | 'capsize',
|
5471 | 'capsule',
|
5472 | 'caption',
|
5473 | 'captivate',
|
5474 | 'captive',
|
5475 | 'captivity',
|
5476 | 'capture',
|
5477 | 'caramel',
|
5478 | 'carat',
|
5479 | 'caravan',
|
5480 | 'carbon',
|
5481 | 'cardboard',
|
5482 | 'carded',
|
5483 | 'cardiac',
|
5484 | 'cardigan',
|
5485 | 'cardinal',
|
5486 | 'cardstock',
|
5487 | 'carefully',
|
5488 | 'caregiver',
|
5489 | 'careless',
|
5490 | 'caress',
|
5491 | 'caretaker',
|
5492 | 'cargo',
|
5493 | 'caring',
|
5494 | 'carless',
|
5495 | 'carload',
|
5496 | 'carmaker',
|
5497 | 'carnage',
|
5498 | 'carnation',
|
5499 | 'carnival',
|
5500 | 'carnivore',
|
5501 | 'carol',
|
5502 | 'carpenter',
|
5503 | 'carpentry',
|
5504 | 'carpool',
|
5505 | 'carport',
|
5506 | 'carried',
|
5507 | 'carrot',
|
5508 | 'carrousel',
|
5509 | 'carry',
|
5510 | 'cartel',
|
5511 | 'cartload',
|
5512 | 'carton',
|
5513 | 'cartoon',
|
5514 | 'cartridge',
|
5515 | 'cartwheel',
|
5516 | 'carve',
|
5517 | 'carving',
|
5518 | 'carwash',
|
5519 | 'cascade',
|
5520 | 'case',
|
5521 | 'cash',
|
5522 | 'casing',
|
5523 | 'casino',
|
5524 | 'casket',
|
5525 | 'cassette',
|
5526 | 'casually',
|
5527 | 'casualty',
|
5528 | 'catacomb',
|
5529 | 'catalog',
|
5530 | 'catalyst',
|
5531 | 'catalyze',
|
5532 | 'catapult',
|
5533 | 'cataract',
|
5534 | 'catatonic',
|
5535 | 'catcall',
|
5536 | 'catchable',
|
5537 | 'catcher',
|
5538 | 'catching',
|
5539 | 'catchy',
|
5540 | 'caterer',
|
5541 | 'catering',
|
5542 | 'catfight',
|
5543 | 'catfish',
|
5544 | 'cathedral',
|
5545 | 'cathouse',
|
5546 | 'catlike',
|
5547 | 'catnap',
|
5548 | 'catnip',
|
5549 | 'catsup',
|
5550 | 'cattail',
|
5551 | 'cattishly',
|
5552 | 'cattle',
|
5553 | 'catty',
|
5554 | 'catwalk',
|
5555 | 'caucasian',
|
5556 | 'caucus',
|
5557 | 'causal',
|
5558 | 'causation',
|
5559 | 'cause',
|
5560 | 'causing',
|
5561 | 'cauterize',
|
5562 | 'caution',
|
5563 | 'cautious',
|
5564 | 'cavalier',
|
5565 | 'cavalry',
|
5566 | 'caviar',
|
5567 | 'cavity',
|
5568 | 'cedar',
|
5569 | 'celery',
|
5570 | 'celestial',
|
5571 | 'celibacy',
|
5572 | 'celibate',
|
5573 | 'celtic',
|
5574 | 'cement',
|
5575 | 'census',
|
5576 | 'ceramics',
|
5577 | 'ceremony',
|
5578 | 'certainly',
|
5579 | 'certainty',
|
5580 | 'certified',
|
5581 | 'certify',
|
5582 | 'cesarean',
|
5583 | 'cesspool',
|
5584 | 'chafe',
|
5585 | 'chaffing',
|
5586 | 'chain',
|
5587 | 'chair',
|
5588 | 'chalice',
|
5589 | 'challenge',
|
5590 | 'chamber',
|
5591 | 'chamomile',
|
5592 | 'champion',
|
5593 | 'chance',
|
5594 | 'change',
|
5595 | 'channel',
|
5596 | 'chant',
|
5597 | 'chaos',
|
5598 | 'chaperone',
|
5599 | 'chaplain',
|
5600 | 'chapped',
|
5601 | 'chaps',
|
5602 | 'chapter',
|
5603 | 'character',
|
5604 | 'charbroil',
|
5605 | 'charcoal',
|
5606 | 'charger',
|
5607 | 'charging',
|
5608 | 'chariot',
|
5609 | 'charity',
|
5610 | 'charm',
|
5611 | 'charred',
|
5612 | 'charter',
|
5613 | 'charting',
|
5614 | 'chase',
|
5615 | 'chasing',
|
5616 | 'chaste',
|
5617 | 'chastise',
|
5618 | 'chastity',
|
5619 | 'chatroom',
|
5620 | 'chatter',
|
5621 | 'chatting',
|
5622 | 'chatty',
|
5623 | 'cheating',
|
5624 | 'cheddar',
|
5625 | 'cheek',
|
5626 | 'cheer',
|
5627 | 'cheese',
|
5628 | 'cheesy',
|
5629 | 'chef',
|
5630 | 'chemicals',
|
5631 | 'chemist',
|
5632 | 'chemo',
|
5633 | 'cherisher',
|
5634 | 'cherub',
|
5635 | 'chess',
|
5636 | 'chest',
|
5637 | 'chevron',
|
5638 | 'chevy',
|
5639 | 'chewable',
|
5640 | 'chewer',
|
5641 | 'chewing',
|
5642 | 'chewy',
|
5643 | 'chief',
|
5644 | 'chihuahua',
|
5645 | 'childcare',
|
5646 | 'childhood',
|
5647 | 'childish',
|
5648 | 'childless',
|
5649 | 'childlike',
|
5650 | 'chili',
|
5651 | 'chill',
|
5652 | 'chimp',
|
5653 | 'chip',
|
5654 | 'chirping',
|
5655 | 'chirpy',
|
5656 | 'chitchat',
|
5657 | 'chivalry',
|
5658 | 'chive',
|
5659 | 'chloride',
|
5660 | 'chlorine',
|
5661 | 'choice',
|
5662 | 'chokehold',
|
5663 | 'choking',
|
5664 | 'chomp',
|
5665 | 'chooser',
|
5666 | 'choosing',
|
5667 | 'choosy',
|
5668 | 'chop',
|
5669 | 'chosen',
|
5670 | 'chowder',
|
5671 | 'chowtime',
|
5672 | 'chrome',
|
5673 | 'chubby',
|
5674 | 'chuck',
|
5675 | 'chug',
|
5676 | 'chummy',
|
5677 | 'chump',
|
5678 | 'chunk',
|
5679 | 'churn',
|
5680 | 'chute',
|
5681 | 'cider',
|
5682 | 'cilantro',
|
5683 | 'cinch',
|
5684 | 'cinema',
|
5685 | 'cinnamon',
|
5686 | 'circle',
|
5687 | 'circling',
|
5688 | 'circular',
|
5689 | 'circulate',
|
5690 | 'circus',
|
5691 | 'citable',
|
5692 | 'citadel',
|
5693 | 'citation',
|
5694 | 'citizen',
|
5695 | 'citric',
|
5696 | 'citrus',
|
5697 | 'city',
|
5698 | 'civic',
|
5699 | 'civil',
|
5700 | 'clad',
|
5701 | 'claim',
|
5702 | 'clambake',
|
5703 | 'clammy',
|
5704 | 'clamor',
|
5705 | 'clamp',
|
5706 | 'clamshell',
|
5707 | 'clang',
|
5708 | 'clanking',
|
5709 | 'clapped',
|
5710 | 'clapper',
|
5711 | 'clapping',
|
5712 | 'clarify',
|
5713 | 'clarinet',
|
5714 | 'clarity',
|
5715 | 'clash',
|
5716 | 'clasp',
|
5717 | 'class',
|
5718 | 'clatter',
|
5719 | 'clause',
|
5720 | 'clavicle',
|
5721 | 'claw',
|
5722 | 'clay',
|
5723 | 'clean',
|
5724 | 'clear',
|
5725 | 'cleat',
|
5726 | 'cleaver',
|
5727 | 'cleft',
|
5728 | 'clench',
|
5729 | 'clergyman',
|
5730 | 'clerical',
|
5731 | 'clerk',
|
5732 | 'clever',
|
5733 | 'clicker',
|
5734 | 'client',
|
5735 | 'climate',
|
5736 | 'climatic',
|
5737 | 'cling',
|
5738 | 'clinic',
|
5739 | 'clinking',
|
5740 | 'clip',
|
5741 | 'clique',
|
5742 | 'cloak',
|
5743 | 'clobber',
|
5744 | 'clock',
|
5745 | 'clone',
|
5746 | 'cloning',
|
5747 | 'closable',
|
5748 | 'closure',
|
5749 | 'clothes',
|
5750 | 'clothing',
|
5751 | 'cloud',
|
5752 | 'clover',
|
5753 | 'clubbed',
|
5754 | 'clubbing',
|
5755 | 'clubhouse',
|
5756 | 'clump',
|
5757 | 'clumsily',
|
5758 | 'clumsy',
|
5759 | 'clunky',
|
5760 | 'clustered',
|
5761 | 'clutch',
|
5762 | 'clutter',
|
5763 | 'coach',
|
5764 | 'coagulant',
|
5765 | 'coastal',
|
5766 | 'coaster',
|
5767 | 'coasting',
|
5768 | 'coastland',
|
5769 | 'coastline',
|
5770 | 'coat',
|
5771 | 'coauthor',
|
5772 | 'cobalt',
|
5773 | 'cobbler',
|
5774 | 'cobweb',
|
5775 | 'cocoa',
|
5776 | 'coconut',
|
5777 | 'cod',
|
5778 | 'coeditor',
|
5779 | 'coerce',
|
5780 | 'coexist',
|
5781 | 'coffee',
|
5782 | 'cofounder',
|
5783 | 'cognition',
|
5784 | 'cognitive',
|
5785 | 'cogwheel',
|
5786 | 'coherence',
|
5787 | 'coherent',
|
5788 | 'cohesive',
|
5789 | 'coil',
|
5790 | 'coke',
|
5791 | 'cola',
|
5792 | 'cold',
|
5793 | 'coleslaw',
|
5794 | 'coliseum',
|
5795 | 'collage',
|
5796 | 'collapse',
|
5797 | 'collar',
|
5798 | 'collected',
|
5799 | 'collector',
|
5800 | 'collide',
|
5801 | 'collie',
|
5802 | 'collision',
|
5803 | 'colonial',
|
5804 | 'colonist',
|
5805 | 'colonize',
|
5806 | 'colony',
|
5807 | 'colossal',
|
5808 | 'colt',
|
5809 | 'coma',
|
5810 | 'come',
|
5811 | 'comfort',
|
5812 | 'comfy',
|
5813 | 'comic',
|
5814 | 'coming',
|
5815 | 'comma',
|
5816 | 'commence',
|
5817 | 'commend',
|
5818 | 'comment',
|
5819 | 'commerce',
|
5820 | 'commode',
|
5821 | 'commodity',
|
5822 | 'commodore',
|
5823 | 'common',
|
5824 | 'commotion',
|
5825 | 'commute',
|
5826 | 'commuting',
|
5827 | 'compacted',
|
5828 | 'compacter',
|
5829 | 'compactly',
|
5830 | 'compactor',
|
5831 | 'companion',
|
5832 | 'company',
|
5833 | 'compare',
|
5834 | 'compel',
|
5835 | 'compile',
|
5836 | 'comply',
|
5837 | 'component',
|
5838 | 'composed',
|
5839 | 'composer',
|
5840 | 'composite',
|
5841 | 'compost',
|
5842 | 'composure',
|
5843 | 'compound',
|
5844 | 'compress',
|
5845 | 'comprised',
|
5846 | 'computer',
|
5847 | 'computing',
|
5848 | 'comrade',
|
5849 | 'concave',
|
5850 | 'conceal',
|
5851 | 'conceded',
|
5852 | 'concept',
|
5853 | 'concerned',
|
5854 | 'concert',
|
5855 | 'conch',
|
5856 | 'concierge',
|
5857 | 'concise',
|
5858 | 'conclude',
|
5859 | 'concrete',
|
5860 | 'concur',
|
5861 | 'condense',
|
5862 | 'condiment',
|
5863 | 'condition',
|
5864 | 'condone',
|
5865 | 'conducive',
|
5866 | 'conductor',
|
5867 | 'conduit',
|
5868 | 'cone',
|
5869 | 'confess',
|
5870 | 'confetti',
|
5871 | 'confidant',
|
5872 | 'confident',
|
5873 | 'confider',
|
5874 | 'confiding',
|
5875 | 'configure',
|
5876 | 'confined',
|
5877 | 'confining',
|
5878 | 'confirm',
|
5879 | 'conflict',
|
5880 | 'conform',
|
5881 | 'confound',
|
5882 | 'confront',
|
5883 | 'confused',
|
5884 | 'confusing',
|
5885 | 'confusion',
|
5886 | 'congenial',
|
5887 | 'congested',
|
5888 | 'congrats',
|
5889 | 'congress',
|
5890 | 'conical',
|
5891 | 'conjoined',
|
5892 | 'conjure',
|
5893 | 'conjuror',
|
5894 | 'connected',
|
5895 | 'connector',
|
5896 | 'consensus',
|
5897 | 'consent',
|
5898 | 'console',
|
5899 | 'consoling',
|
5900 | 'consonant',
|
5901 | 'constable',
|
5902 | 'constant',
|
5903 | 'constrain',
|
5904 | 'constrict',
|
5905 | 'construct',
|
5906 | 'consult',
|
5907 | 'consumer',
|
5908 | 'consuming',
|
5909 | 'contact',
|
5910 | 'container',
|
5911 | 'contempt',
|
5912 | 'contend',
|
5913 | 'contented',
|
5914 | 'contently',
|
5915 | 'contents',
|
5916 | 'contest',
|
5917 | 'context',
|
5918 | 'contort',
|
5919 | 'contour',
|
5920 | 'contrite',
|
5921 | 'control',
|
5922 | 'contusion',
|
5923 | 'convene',
|
5924 | 'convent',
|
5925 | 'copartner',
|
5926 | 'cope',
|
5927 | 'copied',
|
5928 | 'copier',
|
5929 | 'copilot',
|
5930 | 'coping',
|
5931 | 'copious',
|
5932 | 'copper',
|
5933 | 'copy',
|
5934 | 'coral',
|
5935 | 'cork',
|
5936 | 'cornball',
|
5937 | 'cornbread',
|
5938 | 'corncob',
|
5939 | 'cornea',
|
5940 | 'corned',
|
5941 | 'corner',
|
5942 | 'cornfield',
|
5943 | 'cornflake',
|
5944 | 'cornhusk',
|
5945 | 'cornmeal',
|
5946 | 'cornstalk',
|
5947 | 'corny',
|
5948 | 'coronary',
|
5949 | 'coroner',
|
5950 | 'corporal',
|
5951 | 'corporate',
|
5952 | 'corral',
|
5953 | 'correct',
|
5954 | 'corridor',
|
5955 | 'corrode',
|
5956 | 'corroding',
|
5957 | 'corrosive',
|
5958 | 'corsage',
|
5959 | 'corset',
|
5960 | 'cortex',
|
5961 | 'cosigner',
|
5962 | 'cosmetics',
|
5963 | 'cosmic',
|
5964 | 'cosmos',
|
5965 | 'cosponsor',
|
5966 | 'cost',
|
5967 | 'cottage',
|
5968 | 'cotton',
|
5969 | 'couch',
|
5970 | 'cough',
|
5971 | 'could',
|
5972 | 'countable',
|
5973 | 'countdown',
|
5974 | 'counting',
|
5975 | 'countless',
|
5976 | 'country',
|
5977 | 'county',
|
5978 | 'courier',
|
5979 | 'covenant',
|
5980 | 'cover',
|
5981 | 'coveted',
|
5982 | 'coveting',
|
5983 | 'coyness',
|
5984 | 'cozily',
|
5985 | 'coziness',
|
5986 | 'cozy',
|
5987 | 'crabbing',
|
5988 | 'crabgrass',
|
5989 | 'crablike',
|
5990 | 'crabmeat',
|
5991 | 'cradle',
|
5992 | 'cradling',
|
5993 | 'crafter',
|
5994 | 'craftily',
|
5995 | 'craftsman',
|
5996 | 'craftwork',
|
5997 | 'crafty',
|
5998 | 'cramp',
|
5999 | 'cranberry',
|
6000 | 'crane',
|
6001 | 'cranial',
|
6002 | 'cranium',
|
6003 | 'crank',
|
6004 | 'crate',
|
6005 | 'crave',
|
6006 | 'craving',
|
6007 | 'crawfish',
|
6008 | 'crawlers',
|
6009 | 'crawling',
|
6010 | 'crayfish',
|
6011 | 'crayon',
|
6012 | 'crazed',
|
6013 | 'crazily',
|
6014 | 'craziness',
|
6015 | 'crazy',
|
6016 | 'creamed',
|
6017 | 'creamer',
|
6018 | 'creamlike',
|
6019 | 'crease',
|
6020 | 'creasing',
|
6021 | 'creatable',
|
6022 | 'create',
|
6023 | 'creation',
|
6024 | 'creative',
|
6025 | 'creature',
|
6026 | 'credible',
|
6027 | 'credibly',
|
6028 | 'credit',
|
6029 | 'creed',
|
6030 | 'creme',
|
6031 | 'creole',
|
6032 | 'crepe',
|
6033 | 'crept',
|
6034 | 'crescent',
|
6035 | 'crested',
|
6036 | 'cresting',
|
6037 | 'crestless',
|
6038 | 'crevice',
|
6039 | 'crewless',
|
6040 | 'crewman',
|
6041 | 'crewmate',
|
6042 | 'crib',
|
6043 | 'cricket',
|
6044 | 'cried',
|
6045 | 'crier',
|
6046 | 'crimp',
|
6047 | 'crimson',
|
6048 | 'cringe',
|
6049 | 'cringing',
|
6050 | 'crinkle',
|
6051 | 'crinkly',
|
6052 | 'crisped',
|
6053 | 'crisping',
|
6054 | 'crisply',
|
6055 | 'crispness',
|
6056 | 'crispy',
|
6057 | 'criteria',
|
6058 | 'critter',
|
6059 | 'croak',
|
6060 | 'crock',
|
6061 | 'crook',
|
6062 | 'croon',
|
6063 | 'crop',
|
6064 | 'cross',
|
6065 | 'crouch',
|
6066 | 'crouton',
|
6067 | 'crowbar',
|
6068 | 'crowd',
|
6069 | 'crown',
|
6070 | 'crucial',
|
6071 | 'crudely',
|
6072 | 'crudeness',
|
6073 | 'cruelly',
|
6074 | 'cruelness',
|
6075 | 'cruelty',
|
6076 | 'crumb',
|
6077 | 'crummiest',
|
6078 | 'crummy',
|
6079 | 'crumpet',
|
6080 | 'crumpled',
|
6081 | 'cruncher',
|
6082 | 'crunching',
|
6083 | 'crunchy',
|
6084 | 'crusader',
|
6085 | 'crushable',
|
6086 | 'crushed',
|
6087 | 'crusher',
|
6088 | 'crushing',
|
6089 | 'crust',
|
6090 | 'crux',
|
6091 | 'crying',
|
6092 | 'cryptic',
|
6093 | 'crystal',
|
6094 | 'cubbyhole',
|
6095 | 'cube',
|
6096 | 'cubical',
|
6097 | 'cubicle',
|
6098 | 'cucumber',
|
6099 | 'cuddle',
|
6100 | 'cuddly',
|
6101 | 'cufflink',
|
6102 | 'culinary',
|
6103 | 'culminate',
|
6104 | 'culpable',
|
6105 | 'culprit',
|
6106 | 'cultivate',
|
6107 | 'cultural',
|
6108 | 'culture',
|
6109 | 'cupbearer',
|
6110 | 'cupcake',
|
6111 | 'cupid',
|
6112 | 'cupped',
|
6113 | 'cupping',
|
6114 | 'curable',
|
6115 | 'curator',
|
6116 | 'curdle',
|
6117 | 'cure',
|
6118 | 'curfew',
|
6119 | 'curing',
|
6120 | 'curled',
|
6121 | 'curler',
|
6122 | 'curliness',
|
6123 | 'curling',
|
6124 | 'curly',
|
6125 | 'curry',
|
6126 | 'curse',
|
6127 | 'cursive',
|
6128 | 'cursor',
|
6129 | 'curtain',
|
6130 | 'curtly',
|
6131 | 'curtsy',
|
6132 | 'curvature',
|
6133 | 'curve',
|
6134 | 'curvy',
|
6135 | 'cushy',
|
6136 | 'cusp',
|
6137 | 'cussed',
|
6138 | 'custard',
|
6139 | 'custodian',
|
6140 | 'custody',
|
6141 | 'customary',
|
6142 | 'customer',
|
6143 | 'customize',
|
6144 | 'customs',
|
6145 | 'cut',
|
6146 | 'cycle',
|
6147 | 'cyclic',
|
6148 | 'cycling',
|
6149 | 'cyclist',
|
6150 | 'cylinder',
|
6151 | 'cymbal',
|
6152 | 'cytoplasm',
|
6153 | 'cytoplast',
|
6154 | 'dab',
|
6155 | 'dad',
|
6156 | 'daffodil',
|
6157 | 'dagger',
|
6158 | 'daily',
|
6159 | 'daintily',
|
6160 | 'dainty',
|
6161 | 'dairy',
|
6162 | 'daisy',
|
6163 | 'dallying',
|
6164 | 'dance',
|
6165 | 'dancing',
|
6166 | 'dandelion',
|
6167 | 'dander',
|
6168 | 'dandruff',
|
6169 | 'dandy',
|
6170 | 'danger',
|
6171 | 'dangle',
|
6172 | 'dangling',
|
6173 | 'daredevil',
|
6174 | 'dares',
|
6175 | 'daringly',
|
6176 | 'darkened',
|
6177 | 'darkening',
|
6178 | 'darkish',
|
6179 | 'darkness',
|
6180 | 'darkroom',
|
6181 | 'darling',
|
6182 | 'darn',
|
6183 | 'dart',
|
6184 | 'darwinism',
|
6185 | 'dash',
|
6186 | 'dastardly',
|
6187 | 'data',
|
6188 | 'datebook',
|
6189 | 'dating',
|
6190 | 'daughter',
|
6191 | 'daunting',
|
6192 | 'dawdler',
|
6193 | 'dawn',
|
6194 | 'daybed',
|
6195 | 'daybreak',
|
6196 | 'daycare',
|
6197 | 'daydream',
|
6198 | 'daylight',
|
6199 | 'daylong',
|
6200 | 'dayroom',
|
6201 | 'daytime',
|
6202 | 'dazzler',
|
6203 | 'dazzling',
|
6204 | 'deacon',
|
6205 | 'deafening',
|
6206 | 'deafness',
|
6207 | 'dealer',
|
6208 | 'dealing',
|
6209 | 'dealmaker',
|
6210 | 'dealt',
|
6211 | 'dean',
|
6212 | 'debatable',
|
6213 | 'debate',
|
6214 | 'debating',
|
6215 | 'debit',
|
6216 | 'debrief',
|
6217 | 'debtless',
|
6218 | 'debtor',
|
6219 | 'debug',
|
6220 | 'debunk',
|
6221 | 'decade',
|
6222 | 'decaf',
|
6223 | 'decal',
|
6224 | 'decathlon',
|
6225 | 'decay',
|
6226 | 'deceased',
|
6227 | 'deceit',
|
6228 | 'deceiver',
|
6229 | 'deceiving',
|
6230 | 'december',
|
6231 | 'decency',
|
6232 | 'decent',
|
6233 | 'deception',
|
6234 | 'deceptive',
|
6235 | 'decibel',
|
6236 | 'decidable',
|
6237 | 'decimal',
|
6238 | 'decimeter',
|
6239 | 'decipher',
|
6240 | 'deck',
|
6241 | 'declared',
|
6242 | 'decline',
|
6243 | 'decode',
|
6244 | 'decompose',
|
6245 | 'decorated',
|
6246 | 'decorator',
|
6247 | 'decoy',
|
6248 | 'decrease',
|
6249 | 'decree',
|
6250 | 'dedicate',
|
6251 | 'dedicator',
|
6252 | 'deduce',
|
6253 | 'deduct',
|
6254 | 'deed',
|
6255 | 'deem',
|
6256 | 'deepen',
|
6257 | 'deeply',
|
6258 | 'deepness',
|
6259 | 'deface',
|
6260 | 'defacing',
|
6261 | 'defame',
|
6262 | 'default',
|
6263 | 'defeat',
|
6264 | 'defection',
|
6265 | 'defective',
|
6266 | 'defendant',
|
6267 | 'defender',
|
6268 | 'defense',
|
6269 | 'defensive',
|
6270 | 'deferral',
|
6271 | 'deferred',
|
6272 | 'defiance',
|
6273 | 'defiant',
|
6274 | 'defile',
|
6275 | 'defiling',
|
6276 | 'define',
|
6277 | 'definite',
|
6278 | 'deflate',
|
6279 | 'deflation',
|
6280 | 'deflator',
|
6281 | 'deflected',
|
6282 | 'deflector',
|
6283 | 'defog',
|
6284 | 'deforest',
|
6285 | 'defraud',
|
6286 | 'defrost',
|
6287 | 'deftly',
|
6288 | 'defuse',
|
6289 | 'defy',
|
6290 | 'degraded',
|
6291 | 'degrading',
|
6292 | 'degrease',
|
6293 | 'degree',
|
6294 | 'dehydrate',
|
6295 | 'deity',
|
6296 | 'dejected',
|
6297 | 'delay',
|
6298 | 'delegate',
|
6299 | 'delegator',
|
6300 | 'delete',
|
6301 | 'deletion',
|
6302 | 'delicacy',
|
6303 | 'delicate',
|
6304 | 'delicious',
|
6305 | 'delighted',
|
6306 | 'delirious',
|
6307 | 'delirium',
|
6308 | 'deliverer',
|
6309 | 'delivery',
|
6310 | 'delouse',
|
6311 | 'delta',
|
6312 | 'deluge',
|
6313 | 'delusion',
|
6314 | 'deluxe',
|
6315 | 'demanding',
|
6316 | 'demeaning',
|
6317 | 'demeanor',
|
6318 | 'demise',
|
6319 | 'democracy',
|
6320 | 'democrat',
|
6321 | 'demote',
|
6322 | 'demotion',
|
6323 | 'demystify',
|
6324 | 'denatured',
|
6325 | 'deniable',
|
6326 | 'denial',
|
6327 | 'denim',
|
6328 | 'denote',
|
6329 | 'dense',
|
6330 | 'density',
|
6331 | 'dental',
|
6332 | 'dentist',
|
6333 | 'denture',
|
6334 | 'deny',
|
6335 | 'deodorant',
|
6336 | 'deodorize',
|
6337 | 'departed',
|
6338 | 'departure',
|
6339 | 'depict',
|
6340 | 'deplete',
|
6341 | 'depletion',
|
6342 | 'deplored',
|
6343 | 'deploy',
|
6344 | 'deport',
|
6345 | 'depose',
|
6346 | 'depraved',
|
6347 | 'depravity',
|
6348 | 'deprecate',
|
6349 | 'depress',
|
6350 | 'deprive',
|
6351 | 'depth',
|
6352 | 'deputize',
|
6353 | 'deputy',
|
6354 | 'derail',
|
6355 | 'deranged',
|
6356 | 'derby',
|
6357 | 'derived',
|
6358 | 'desecrate',
|
6359 | 'deserve',
|
6360 | 'deserving',
|
6361 | 'designate',
|
6362 | 'designed',
|
6363 | 'designer',
|
6364 | 'designing',
|
6365 | 'deskbound',
|
6366 | 'desktop',
|
6367 | 'deskwork',
|
6368 | 'desolate',
|
6369 | 'despair',
|
6370 | 'despise',
|
6371 | 'despite',
|
6372 | 'destiny',
|
6373 | 'destitute',
|
6374 | 'destruct',
|
6375 | 'detached',
|
6376 | 'detail',
|
6377 | 'detection',
|
6378 | 'detective',
|
6379 | 'detector',
|
6380 | 'detention',
|
6381 | 'detergent',
|
6382 | 'detest',
|
6383 | 'detonate',
|
6384 | 'detonator',
|
6385 | 'detoxify',
|
6386 | 'detract',
|
6387 | 'deuce',
|
6388 | 'devalue',
|
6389 | 'deviancy',
|
6390 | 'deviant',
|
6391 | 'deviate',
|
6392 | 'deviation',
|
6393 | 'deviator',
|
6394 | 'device',
|
6395 | 'devious',
|
6396 | 'devotedly',
|
6397 | 'devotee',
|
6398 | 'devotion',
|
6399 | 'devourer',
|
6400 | 'devouring',
|
6401 | 'devoutly',
|
6402 | 'dexterity',
|
6403 | 'dexterous',
|
6404 | 'diabetes',
|
6405 | 'diabetic',
|
6406 | 'diabolic',
|
6407 | 'diagnoses',
|
6408 | 'diagnosis',
|
6409 | 'diagram',
|
6410 | 'dial',
|
6411 | 'diameter',
|
6412 | 'diaper',
|
6413 | 'diaphragm',
|
6414 | 'diary',
|
6415 | 'dice',
|
6416 | 'dicing',
|
6417 | 'dictate',
|
6418 | 'dictation',
|
6419 | 'dictator',
|
6420 | 'difficult',
|
6421 | 'diffused',
|
6422 | 'diffuser',
|
6423 | 'diffusion',
|
6424 | 'diffusive',
|
6425 | 'dig',
|
6426 | 'dilation',
|
6427 | 'diligence',
|
6428 | 'diligent',
|
6429 | 'dill',
|
6430 | 'dilute',
|
6431 | 'dime',
|
6432 | 'diminish',
|
6433 | 'dimly',
|
6434 | 'dimmed',
|
6435 | 'dimmer',
|
6436 | 'dimness',
|
6437 | 'dimple',
|
6438 | 'diner',
|
6439 | 'dingbat',
|
6440 | 'dinghy',
|
6441 | 'dinginess',
|
6442 | 'dingo',
|
6443 | 'dingy',
|
6444 | 'dining',
|
6445 | 'dinner',
|
6446 | 'diocese',
|
6447 | 'dioxide',
|
6448 | 'diploma',
|
6449 | 'dipped',
|
6450 | 'dipper',
|
6451 | 'dipping',
|
6452 | 'directed',
|
6453 | 'direction',
|
6454 | 'directive',
|
6455 | 'directly',
|
6456 | 'directory',
|
6457 | 'direness',
|
6458 | 'dirtiness',
|
6459 | 'disabled',
|
6460 | 'disagree',
|
6461 | 'disallow',
|
6462 | 'disarm',
|
6463 | 'disarray',
|
6464 | 'disaster',
|
6465 | 'disband',
|
6466 | 'disbelief',
|
6467 | 'disburse',
|
6468 | 'discard',
|
6469 | 'discern',
|
6470 | 'discharge',
|
6471 | 'disclose',
|
6472 | 'discolor',
|
6473 | 'discount',
|
6474 | 'discourse',
|
6475 | 'discover',
|
6476 | 'discuss',
|
6477 | 'disdain',
|
6478 | 'disengage',
|
6479 | 'disfigure',
|
6480 | 'disgrace',
|
6481 | 'dish',
|
6482 | 'disinfect',
|
6483 | 'disjoin',
|
6484 | 'disk',
|
6485 | 'dislike',
|
6486 | 'disliking',
|
6487 | 'dislocate',
|
6488 | 'dislodge',
|
6489 | 'disloyal',
|
6490 | 'dismantle',
|
6491 | 'dismay',
|
6492 | 'dismiss',
|
6493 | 'dismount',
|
6494 | 'disobey',
|
6495 | 'disorder',
|
6496 | 'disown',
|
6497 | 'disparate',
|
6498 | 'disparity',
|
6499 | 'dispatch',
|
6500 | 'dispense',
|
6501 | 'dispersal',
|
6502 | 'dispersed',
|
6503 | 'disperser',
|
6504 | 'displace',
|
6505 | 'display',
|
6506 | 'displease',
|
6507 | 'disposal',
|
6508 | 'dispose',
|
6509 | 'disprove',
|
6510 | 'dispute',
|
6511 | 'disregard',
|
6512 | 'disrupt',
|
6513 | 'dissuade',
|
6514 | 'distance',
|
6515 | 'distant',
|
6516 | 'distaste',
|
6517 | 'distill',
|
6518 | 'distinct',
|
6519 | 'distort',
|
6520 | 'distract',
|
6521 | 'distress',
|
6522 | 'district',
|
6523 | 'distrust',
|
6524 | 'ditch',
|
6525 | 'ditto',
|
6526 | 'ditzy',
|
6527 | 'dividable',
|
6528 | 'divided',
|
6529 | 'dividend',
|
6530 | 'dividers',
|
6531 | 'dividing',
|
6532 | 'divinely',
|
6533 | 'diving',
|
6534 | 'divinity',
|
6535 | 'divisible',
|
6536 | 'divisibly',
|
6537 | 'division',
|
6538 | 'divisive',
|
6539 | 'divorcee',
|
6540 | 'dizziness',
|
6541 | 'dizzy',
|
6542 | 'doable',
|
6543 | 'docile',
|
6544 | 'dock',
|
6545 | 'doctrine',
|
6546 | 'document',
|
6547 | 'dodge',
|
6548 | 'dodgy',
|
6549 | 'doily',
|
6550 | 'doing',
|
6551 | 'dole',
|
6552 | 'dollar',
|
6553 | 'dollhouse',
|
6554 | 'dollop',
|
6555 | 'dolly',
|
6556 | 'dolphin',
|
6557 | 'domain',
|
6558 | 'domelike',
|
6559 | 'domestic',
|
6560 | 'dominion',
|
6561 | 'dominoes',
|
6562 | 'donated',
|
6563 | 'donation',
|
6564 | 'donator',
|
6565 | 'donor',
|
6566 | 'donut',
|
6567 | 'doodle',
|
6568 | 'doorbell',
|
6569 | 'doorframe',
|
6570 | 'doorknob',
|
6571 | 'doorman',
|
6572 | 'doormat',
|
6573 | 'doornail',
|
6574 | 'doorpost',
|
6575 | 'doorstep',
|
6576 | 'doorstop',
|
6577 | 'doorway',
|
6578 | 'doozy',
|
6579 | 'dork',
|
6580 | 'dormitory',
|
6581 | 'dorsal',
|
6582 | 'dosage',
|
6583 | 'dose',
|
6584 | 'dotted',
|
6585 | 'doubling',
|
6586 | 'douche',
|
6587 | 'dove',
|
6588 | 'down',
|
6589 | 'dowry',
|
6590 | 'doze',
|
6591 | 'drab',
|
6592 | 'dragging',
|
6593 | 'dragonfly',
|
6594 | 'dragonish',
|
6595 | 'dragster',
|
6596 | 'drainable',
|
6597 | 'drainage',
|
6598 | 'drained',
|
6599 | 'drainer',
|
6600 | 'drainpipe',
|
6601 | 'dramatic',
|
6602 | 'dramatize',
|
6603 | 'drank',
|
6604 | 'drapery',
|
6605 | 'drastic',
|
6606 | 'draw',
|
6607 | 'dreaded',
|
6608 | 'dreadful',
|
6609 | 'dreadlock',
|
6610 | 'dreamboat',
|
6611 | 'dreamily',
|
6612 | 'dreamland',
|
6613 | 'dreamless',
|
6614 | 'dreamlike',
|
6615 | 'dreamt',
|
6616 | 'dreamy',
|
6617 | 'drearily',
|
6618 | 'dreary',
|
6619 | 'drench',
|
6620 | 'dress',
|
6621 | 'drew',
|
6622 | 'dribble',
|
6623 | 'dried',
|
6624 | 'drier',
|
6625 | 'drift',
|
6626 | 'driller',
|
6627 | 'drilling',
|
6628 | 'drinkable',
|
6629 | 'drinking',
|
6630 | 'dripping',
|
6631 | 'drippy',
|
6632 | 'drivable',
|
6633 | 'driven',
|
6634 | 'driver',
|
6635 | 'driveway',
|
6636 | 'driving',
|
6637 | 'drizzle',
|
6638 | 'drizzly',
|
6639 | 'drone',
|
6640 | 'drool',
|
6641 | 'droop',
|
6642 | 'drop-down',
|
6643 | 'dropbox',
|
6644 | 'dropkick',
|
6645 | 'droplet',
|
6646 | 'dropout',
|
6647 | 'dropper',
|
6648 | 'drove',
|
6649 | 'drown',
|
6650 | 'drowsily',
|
6651 | 'drudge',
|
6652 | 'drum',
|
6653 | 'dry',
|
6654 | 'dubbed',
|
6655 | 'dubiously',
|
6656 | 'duchess',
|
6657 | 'duckbill',
|
6658 | 'ducking',
|
6659 | 'duckling',
|
6660 | 'ducktail',
|
6661 | 'ducky',
|
6662 | 'duct',
|
6663 | 'dude',
|
6664 | 'duffel',
|
6665 | 'dugout',
|
6666 | 'duh',
|
6667 | 'duke',
|
6668 | 'duller',
|
6669 | 'dullness',
|
6670 | 'duly',
|
6671 | 'dumping',
|
6672 | 'dumpling',
|
6673 | 'dumpster',
|
6674 | 'duo',
|
6675 | 'dupe',
|
6676 | 'duplex',
|
6677 | 'duplicate',
|
6678 | 'duplicity',
|
6679 | 'durable',
|
6680 | 'durably',
|
6681 | 'duration',
|
6682 | 'duress',
|
6683 | 'during',
|
6684 | 'dusk',
|
6685 | 'dust',
|
6686 | 'dutiful',
|
6687 | 'duty',
|
6688 | 'duvet',
|
6689 | 'dwarf',
|
6690 | 'dweeb',
|
6691 | 'dwelled',
|
6692 | 'dweller',
|
6693 | 'dwelling',
|
6694 | 'dwindle',
|
6695 | 'dwindling',
|
6696 | 'dynamic',
|
6697 | 'dynamite',
|
6698 | 'dynasty',
|
6699 | 'dyslexia',
|
6700 | 'dyslexic',
|
6701 | 'each',
|
6702 | 'eagle',
|
6703 | 'earache',
|
6704 | 'eardrum',
|
6705 | 'earflap',
|
6706 | 'earful',
|
6707 | 'earlobe',
|
6708 | 'early',
|
6709 | 'earmark',
|
6710 | 'earmuff',
|
6711 | 'earphone',
|
6712 | 'earpiece',
|
6713 | 'earplugs',
|
6714 | 'earring',
|
6715 | 'earshot',
|
6716 | 'earthen',
|
6717 | 'earthlike',
|
6718 | 'earthling',
|
6719 | 'earthly',
|
6720 | 'earthworm',
|
6721 | 'earthy',
|
6722 | 'earwig',
|
6723 | 'easeful',
|
6724 | 'easel',
|
6725 | 'easiest',
|
6726 | 'easily',
|
6727 | 'easiness',
|
6728 | 'easing',
|
6729 | 'eastbound',
|
6730 | 'eastcoast',
|
6731 | 'easter',
|
6732 | 'eastward',
|
6733 | 'eatable',
|
6734 | 'eaten',
|
6735 | 'eatery',
|
6736 | 'eating',
|
6737 | 'eats',
|
6738 | 'ebay',
|
6739 | 'ebony',
|
6740 | 'ebook',
|
6741 | 'ecard',
|
6742 | 'eccentric',
|
6743 | 'echo',
|
6744 | 'eclair',
|
6745 | 'eclipse',
|
6746 | 'ecologist',
|
6747 | 'ecology',
|
6748 | 'economic',
|
6749 | 'economist',
|
6750 | 'economy',
|
6751 | 'ecosphere',
|
6752 | 'ecosystem',
|
6753 | 'edge',
|
6754 | 'edginess',
|
6755 | 'edging',
|
6756 | 'edgy',
|
6757 | 'edition',
|
6758 | 'editor',
|
6759 | 'educated',
|
6760 | 'education',
|
6761 | 'educator',
|
6762 | 'eel',
|
6763 | 'effective',
|
6764 | 'effects',
|
6765 | 'efficient',
|
6766 | 'effort',
|
6767 | 'eggbeater',
|
6768 | 'egging',
|
6769 | 'eggnog',
|
6770 | 'eggplant',
|
6771 | 'eggshell',
|
6772 | 'egomaniac',
|
6773 | 'egotism',
|
6774 | 'egotistic',
|
6775 | 'either',
|
6776 | 'eject',
|
6777 | 'elaborate',
|
6778 | 'elastic',
|
6779 | 'elated',
|
6780 | 'elbow',
|
6781 | 'eldercare',
|
6782 | 'elderly',
|
6783 | 'eldest',
|
6784 | 'electable',
|
6785 | 'election',
|
6786 | 'elective',
|
6787 | 'elephant',
|
6788 | 'elevate',
|
6789 | 'elevating',
|
6790 | 'elevation',
|
6791 | 'elevator',
|
6792 | 'eleven',
|
6793 | 'elf',
|
6794 | 'eligible',
|
6795 | 'eligibly',
|
6796 | 'eliminate',
|
6797 | 'elite',
|
6798 | 'elitism',
|
6799 | 'elixir',
|
6800 | 'elk',
|
6801 | 'ellipse',
|
6802 | 'elliptic',
|
6803 | 'elm',
|
6804 | 'elongated',
|
6805 | 'elope',
|
6806 | 'eloquence',
|
6807 | 'eloquent',
|
6808 | 'elsewhere',
|
6809 | 'elude',
|
6810 | 'elusive',
|
6811 | 'elves',
|
6812 | 'email',
|
6813 | 'embargo',
|
6814 | 'embark',
|
6815 | 'embassy',
|
6816 | 'embattled',
|
6817 | 'embellish',
|
6818 | 'ember',
|
6819 | 'embezzle',
|
6820 | 'emblaze',
|
6821 | 'emblem',
|
6822 | 'embody',
|
6823 | 'embolism',
|
6824 | 'emboss',
|
6825 | 'embroider',
|
6826 | 'emcee',
|
6827 | 'emerald',
|
6828 | 'emergency',
|
6829 | 'emission',
|
6830 | 'emit',
|
6831 | 'emote',
|
6832 | 'emoticon',
|
6833 | 'emotion',
|
6834 | 'empathic',
|
6835 | 'empathy',
|
6836 | 'emperor',
|
6837 | 'emphases',
|
6838 | 'emphasis',
|
6839 | 'emphasize',
|
6840 | 'emphatic',
|
6841 | 'empirical',
|
6842 | 'employed',
|
6843 | 'employee',
|
6844 | 'employer',
|
6845 | 'emporium',
|
6846 | 'empower',
|
6847 | 'emptier',
|
6848 | 'emptiness',
|
6849 | 'empty',
|
6850 | 'emu',
|
6851 | 'enable',
|
6852 | 'enactment',
|
6853 | 'enamel',
|
6854 | 'enchanted',
|
6855 | 'enchilada',
|
6856 | 'encircle',
|
6857 | 'enclose',
|
6858 | 'enclosure',
|
6859 | 'encode',
|
6860 | 'encore',
|
6861 | 'encounter',
|
6862 | 'encourage',
|
6863 | 'encroach',
|
6864 | 'encrust',
|
6865 | 'encrypt',
|
6866 | 'endanger',
|
6867 | 'endeared',
|
6868 | 'endearing',
|
6869 | 'ended',
|
6870 | 'ending',
|
6871 | 'endless',
|
6872 | 'endnote',
|
6873 | 'endocrine',
|
6874 | 'endorphin',
|
6875 | 'endorse',
|
6876 | 'endowment',
|
6877 | 'endpoint',
|
6878 | 'endurable',
|
6879 | 'endurance',
|
6880 | 'enduring',
|
6881 | 'energetic',
|
6882 | 'energize',
|
6883 | 'energy',
|
6884 | 'enforced',
|
6885 | 'enforcer',
|
6886 | 'engaged',
|
6887 | 'engaging',
|
6888 | 'engine',
|
6889 | 'engorge',
|
6890 | 'engraved',
|
6891 | 'engraver',
|
6892 | 'engraving',
|
6893 | 'engross',
|
6894 | 'engulf',
|
6895 | 'enhance',
|
6896 | 'enigmatic',
|
6897 | 'enjoyable',
|
6898 | 'enjoyably',
|
6899 | 'enjoyer',
|
6900 | 'enjoying',
|
6901 | 'enjoyment',
|
6902 | 'enlarged',
|
6903 | 'enlarging',
|
6904 | 'enlighten',
|
6905 | 'enlisted',
|
6906 | 'enquirer',
|
6907 | 'enrage',
|
6908 | 'enrich',
|
6909 | 'enroll',
|
6910 | 'enslave',
|
6911 | 'ensnare',
|
6912 | 'ensure',
|
6913 | 'entail',
|
6914 | 'entangled',
|
6915 | 'entering',
|
6916 | 'entertain',
|
6917 | 'enticing',
|
6918 | 'entire',
|
6919 | 'entitle',
|
6920 | 'entity',
|
6921 | 'entomb',
|
6922 | 'entourage',
|
6923 | 'entrap',
|
6924 | 'entree',
|
6925 | 'entrench',
|
6926 | 'entrust',
|
6927 | 'entryway',
|
6928 | 'entwine',
|
6929 | 'enunciate',
|
6930 | 'envelope',
|
6931 | 'enviable',
|
6932 | 'enviably',
|
6933 | 'envious',
|
6934 | 'envision',
|
6935 | 'envoy',
|
6936 | 'envy',
|
6937 | 'enzyme',
|
6938 | 'epic',
|
6939 | 'epidemic',
|
6940 | 'epidermal',
|
6941 | 'epidermis',
|
6942 | 'epidural',
|
6943 | 'epilepsy',
|
6944 | 'epileptic',
|
6945 | 'epilogue',
|
6946 | 'epiphany',
|
6947 | 'episode',
|
6948 | 'equal',
|
6949 | 'equate',
|
6950 | 'equation',
|
6951 | 'equator',
|
6952 | 'equinox',
|
6953 | 'equipment',
|
6954 | 'equity',
|
6955 | 'equivocal',
|
6956 | 'eradicate',
|
6957 | 'erasable',
|
6958 | 'erased',
|
6959 | 'eraser',
|
6960 | 'erasure',
|
6961 | 'ergonomic',
|
6962 | 'errand',
|
6963 | 'errant',
|
6964 | 'erratic',
|
6965 | 'error',
|
6966 | 'erupt',
|
6967 | 'escalate',
|
6968 | 'escalator',
|
6969 | 'escapable',
|
6970 | 'escapade',
|
6971 | 'escapist',
|
6972 | 'escargot',
|
6973 | 'eskimo',
|
6974 | 'esophagus',
|
6975 | 'espionage',
|
6976 | 'espresso',
|
6977 | 'esquire',
|
6978 | 'essay',
|
6979 | 'essence',
|
6980 | 'essential',
|
6981 | 'establish',
|
6982 | 'estate',
|
6983 | 'esteemed',
|
6984 | 'estimate',
|
6985 | 'estimator',
|
6986 | 'estranged',
|
6987 | 'estrogen',
|
6988 | 'etching',
|
6989 | 'eternal',
|
6990 | 'eternity',
|
6991 | 'ethanol',
|
6992 | 'ether',
|
6993 | 'ethically',
|
6994 | 'ethics',
|
6995 | 'euphemism',
|
6996 | 'evacuate',
|
6997 | 'evacuee',
|
6998 | 'evade',
|
6999 | 'evaluate',
|
7000 | 'evaluator',
|
7001 | 'evaporate',
|
7002 | 'evasion',
|
7003 | 'evasive',
|
7004 | 'even',
|
7005 | 'everglade',
|
7006 | 'evergreen',
|
7007 | 'everybody',
|
7008 | 'everyday',
|
7009 | 'everyone',
|
7010 | 'evict',
|
7011 | 'evidence',
|
7012 | 'evident',
|
7013 | 'evil',
|
7014 | 'evoke',
|
7015 | 'evolution',
|
7016 | 'evolve',
|
7017 | 'exact',
|
7018 | 'exalted',
|
7019 | 'example',
|
7020 | 'excavate',
|
7021 | 'excavator',
|
7022 | 'exceeding',
|
7023 | 'exception',
|
7024 | 'excess',
|
7025 | 'exchange',
|
7026 | 'excitable',
|
7027 | 'exciting',
|
7028 | 'exclaim',
|
7029 | 'exclude',
|
7030 | 'excluding',
|
7031 | 'exclusion',
|
7032 | 'exclusive',
|
7033 | 'excretion',
|
7034 | 'excretory',
|
7035 | 'excursion',
|
7036 | 'excusable',
|
7037 | 'excusably',
|
7038 | 'excuse',
|
7039 | 'exemplary',
|
7040 | 'exemplify',
|
7041 | 'exemption',
|
7042 | 'exerciser',
|
7043 | 'exert',
|
7044 | 'exes',
|
7045 | 'exfoliate',
|
7046 | 'exhale',
|
7047 | 'exhaust',
|
7048 | 'exhume',
|
7049 | 'exile',
|
7050 | 'existing',
|
7051 | 'exit',
|
7052 | 'exodus',
|
7053 | 'exonerate',
|
7054 | 'exorcism',
|
7055 | 'exorcist',
|
7056 | 'expand',
|
7057 | 'expanse',
|
7058 | 'expansion',
|
7059 | 'expansive',
|
7060 | 'expectant',
|
7061 | 'expedited',
|
7062 | 'expediter',
|
7063 | 'expel',
|
7064 | 'expend',
|
7065 | 'expenses',
|
7066 | 'expensive',
|
7067 | 'expert',
|
7068 | 'expire',
|
7069 | 'expiring',
|
7070 | 'explain',
|
7071 | 'expletive',
|
7072 | 'explicit',
|
7073 | 'explode',
|
7074 | 'exploit',
|
7075 | 'explore',
|
7076 | 'exploring',
|
7077 | 'exponent',
|
7078 | 'exporter',
|
7079 | 'exposable',
|
7080 | 'expose',
|
7081 | 'exposure',
|
7082 | 'express',
|
7083 | 'expulsion',
|
7084 | 'exquisite',
|
7085 | 'extended',
|
7086 | 'extending',
|
7087 | 'extent',
|
7088 | 'extenuate',
|
7089 | 'exterior',
|
7090 | 'external',
|
7091 | 'extinct',
|
7092 | 'extortion',
|
7093 | 'extradite',
|
7094 | 'extras',
|
7095 | 'extrovert',
|
7096 | 'extrude',
|
7097 | 'extruding',
|
7098 | 'exuberant',
|
7099 | 'fable',
|
7100 | 'fabric',
|
7101 | 'fabulous',
|
7102 | 'facebook',
|
7103 | 'facecloth',
|
7104 | 'facedown',
|
7105 | 'faceless',
|
7106 | 'facelift',
|
7107 | 'faceplate',
|
7108 | 'faceted',
|
7109 | 'facial',
|
7110 | 'facility',
|
7111 | 'facing',
|
7112 | 'facsimile',
|
7113 | 'faction',
|
7114 | 'factoid',
|
7115 | 'factor',
|
7116 | 'factsheet',
|
7117 | 'factual',
|
7118 | 'faculty',
|
7119 | 'fade',
|
7120 | 'fading',
|
7121 | 'failing',
|
7122 | 'falcon',
|
7123 | 'fall',
|
7124 | 'false',
|
7125 | 'falsify',
|
7126 | 'fame',
|
7127 | 'familiar',
|
7128 | 'family',
|
7129 | 'famine',
|
7130 | 'famished',
|
7131 | 'fanatic',
|
7132 | 'fancied',
|
7133 | 'fanciness',
|
7134 | 'fancy',
|
7135 | 'fanfare',
|
7136 | 'fang',
|
7137 | 'fanning',
|
7138 | 'fantasize',
|
7139 | 'fantastic',
|
7140 | 'fantasy',
|
7141 | 'fascism',
|
7142 | 'fastball',
|
7143 | 'faster',
|
7144 | 'fasting',
|
7145 | 'fastness',
|
7146 | 'faucet',
|
7147 | 'favorable',
|
7148 | 'favorably',
|
7149 | 'favored',
|
7150 | 'favoring',
|
7151 | 'favorite',
|
7152 | 'fax',
|
7153 | 'feast',
|
7154 | 'federal',
|
7155 | 'fedora',
|
7156 | 'feeble',
|
7157 | 'feed',
|
7158 | 'feel',
|
7159 | 'feisty',
|
7160 | 'feline',
|
7161 | 'felt-tip',
|
7162 | 'feminine',
|
7163 | 'feminism',
|
7164 | 'feminist',
|
7165 | 'feminize',
|
7166 | 'femur',
|
7167 | 'fence',
|
7168 | 'fencing',
|
7169 | 'fender',
|
7170 | 'ferment',
|
7171 | 'fernlike',
|
7172 | 'ferocious',
|
7173 | 'ferocity',
|
7174 | 'ferret',
|
7175 | 'ferris',
|
7176 | 'ferry',
|
7177 | 'fervor',
|
7178 | 'fester',
|
7179 | 'festival',
|
7180 | 'festive',
|
7181 | 'festivity',
|
7182 | 'fetal',
|
7183 | 'fetch',
|
7184 | 'fever',
|
7185 | 'fiber',
|
7186 | 'fiction',
|
7187 | 'fiddle',
|
7188 | 'fiddling',
|
7189 | 'fidelity',
|
7190 | 'fidgeting',
|
7191 | 'fidgety',
|
7192 | 'fifteen',
|
7193 | 'fifth',
|
7194 | 'fiftieth',
|
7195 | 'fifty',
|
7196 | 'figment',
|
7197 | 'figure',
|
7198 | 'figurine',
|
7199 | 'filing',
|
7200 | 'filled',
|
7201 | 'filler',
|
7202 | 'filling',
|
7203 | 'film',
|
7204 | 'filter',
|
7205 | 'filth',
|
7206 | 'filtrate',
|
7207 | 'finale',
|
7208 | 'finalist',
|
7209 | 'finalize',
|
7210 | 'finally',
|
7211 | 'finance',
|
7212 | 'financial',
|
7213 | 'finch',
|
7214 | 'fineness',
|
7215 | 'finer',
|
7216 | 'finicky',
|
7217 | 'finished',
|
7218 | 'finisher',
|
7219 | 'finishing',
|
7220 | 'finite',
|
7221 | 'finless',
|
7222 | 'finlike',
|
7223 | 'fiscally',
|
7224 | 'fit',
|
7225 | 'five',
|
7226 | 'flaccid',
|
7227 | 'flagman',
|
7228 | 'flagpole',
|
7229 | 'flagship',
|
7230 | 'flagstick',
|
7231 | 'flagstone',
|
7232 | 'flail',
|
7233 | 'flakily',
|
7234 | 'flaky',
|
7235 | 'flame',
|
7236 | 'flammable',
|
7237 | 'flanked',
|
7238 | 'flanking',
|
7239 | 'flannels',
|
7240 | 'flap',
|
7241 | 'flaring',
|
7242 | 'flashback',
|
7243 | 'flashbulb',
|
7244 | 'flashcard',
|
7245 | 'flashily',
|
7246 | 'flashing',
|
7247 | 'flashy',
|
7248 | 'flask',
|
7249 | 'flatbed',
|
7250 | 'flatfoot',
|
7251 | 'flatly',
|
7252 | 'flatness',
|
7253 | 'flatten',
|
7254 | 'flattered',
|
7255 | 'flatterer',
|
7256 | 'flattery',
|
7257 | 'flattop',
|
7258 | 'flatware',
|
7259 | 'flatworm',
|
7260 | 'flavored',
|
7261 | 'flavorful',
|
7262 | 'flavoring',
|
7263 | 'flaxseed',
|
7264 | 'fled',
|
7265 | 'fleshed',
|
7266 | 'fleshy',
|
7267 | 'flick',
|
7268 | 'flier',
|
7269 | 'flight',
|
7270 | 'flinch',
|
7271 | 'fling',
|
7272 | 'flint',
|
7273 | 'flip',
|
7274 | 'flirt',
|
7275 | 'float',
|
7276 | 'flock',
|
7277 | 'flogging',
|
7278 | 'flop',
|
7279 | 'floral',
|
7280 | 'florist',
|
7281 | 'floss',
|
7282 | 'flounder',
|
7283 | 'flyable',
|
7284 | 'flyaway',
|
7285 | 'flyer',
|
7286 | 'flying',
|
7287 | 'flyover',
|
7288 | 'flypaper',
|
7289 | 'foam',
|
7290 | 'foe',
|
7291 | 'fog',
|
7292 | 'foil',
|
7293 | 'folic',
|
7294 | 'folk',
|
7295 | 'follicle',
|
7296 | 'follow',
|
7297 | 'fondling',
|
7298 | 'fondly',
|
7299 | 'fondness',
|
7300 | 'fondue',
|
7301 | 'font',
|
7302 | 'food',
|
7303 | 'fool',
|
7304 | 'footage',
|
7305 | 'football',
|
7306 | 'footbath',
|
7307 | 'footboard',
|
7308 | 'footer',
|
7309 | 'footgear',
|
7310 | 'foothill',
|
7311 | 'foothold',
|
7312 | 'footing',
|
7313 | 'footless',
|
7314 | 'footman',
|
7315 | 'footnote',
|
7316 | 'footpad',
|
7317 | 'footpath',
|
7318 | 'footprint',
|
7319 | 'footrest',
|
7320 | 'footsie',
|
7321 | 'footsore',
|
7322 | 'footwear',
|
7323 | 'footwork',
|
7324 | 'fossil',
|
7325 | 'foster',
|
7326 | 'founder',
|
7327 | 'founding',
|
7328 | 'fountain',
|
7329 | 'fox',
|
7330 | 'foyer',
|
7331 | 'fraction',
|
7332 | 'fracture',
|
7333 | 'fragile',
|
7334 | 'fragility',
|
7335 | 'fragment',
|
7336 | 'fragrance',
|
7337 | 'fragrant',
|
7338 | 'frail',
|
7339 | 'frame',
|
7340 | 'framing',
|
7341 | 'frantic',
|
7342 | 'fraternal',
|
7343 | 'frayed',
|
7344 | 'fraying',
|
7345 | 'frays',
|
7346 | 'freckled',
|
7347 | 'freckles',
|
7348 | 'freebase',
|
7349 | 'freebee',
|
7350 | 'freebie',
|
7351 | 'freedom',
|
7352 | 'freefall',
|
7353 | 'freehand',
|
7354 | 'freeing',
|
7355 | 'freeload',
|
7356 | 'freely',
|
7357 | 'freemason',
|
7358 | 'freeness',
|
7359 | 'freestyle',
|
7360 | 'freeware',
|
7361 | 'freeway',
|
7362 | 'freewill',
|
7363 | 'freezable',
|
7364 | 'freezing',
|
7365 | 'freight',
|
7366 | 'french',
|
7367 | 'frenzied',
|
7368 | 'frenzy',
|
7369 | 'frequency',
|
7370 | 'frequent',
|
7371 | 'fresh',
|
7372 | 'fretful',
|
7373 | 'fretted',
|
7374 | 'friction',
|
7375 | 'friday',
|
7376 | 'fridge',
|
7377 | 'fried',
|
7378 | 'friend',
|
7379 | 'frighten',
|
7380 | 'frightful',
|
7381 | 'frigidity',
|
7382 | 'frigidly',
|
7383 | 'frill',
|
7384 | 'fringe',
|
7385 | 'frisbee',
|
7386 | 'frisk',
|
7387 | 'fritter',
|
7388 | 'frivolous',
|
7389 | 'frolic',
|
7390 | 'from',
|
7391 | 'front',
|
7392 | 'frostbite',
|
7393 | 'frosted',
|
7394 | 'frostily',
|
7395 | 'frosting',
|
7396 | 'frostlike',
|
7397 | 'frosty',
|
7398 | 'froth',
|
7399 | 'frown',
|
7400 | 'frozen',
|
7401 | 'fructose',
|
7402 | 'frugality',
|
7403 | 'frugally',
|
7404 | 'fruit',
|
7405 | 'frustrate',
|
7406 | 'frying',
|
7407 | 'gab',
|
7408 | 'gaffe',
|
7409 | 'gag',
|
7410 | 'gainfully',
|
7411 | 'gaining',
|
7412 | 'gains',
|
7413 | 'gala',
|
7414 | 'gallantly',
|
7415 | 'galleria',
|
7416 | 'gallery',
|
7417 | 'galley',
|
7418 | 'gallon',
|
7419 | 'gallows',
|
7420 | 'gallstone',
|
7421 | 'galore',
|
7422 | 'galvanize',
|
7423 | 'gambling',
|
7424 | 'game',
|
7425 | 'gaming',
|
7426 | 'gamma',
|
7427 | 'gander',
|
7428 | 'gangly',
|
7429 | 'gangrene',
|
7430 | 'gangway',
|
7431 | 'gap',
|
7432 | 'garage',
|
7433 | 'garbage',
|
7434 | 'garden',
|
7435 | 'gargle',
|
7436 | 'garland',
|
7437 | 'garlic',
|
7438 | 'garment',
|
7439 | 'garnet',
|
7440 | 'garnish',
|
7441 | 'garter',
|
7442 | 'gas',
|
7443 | 'gatherer',
|
7444 | 'gathering',
|
7445 | 'gating',
|
7446 | 'gauging',
|
7447 | 'gauntlet',
|
7448 | 'gauze',
|
7449 | 'gave',
|
7450 | 'gawk',
|
7451 | 'gazing',
|
7452 | 'gear',
|
7453 | 'gecko',
|
7454 | 'geek',
|
7455 | 'geiger',
|
7456 | 'gem',
|
7457 | 'gender',
|
7458 | 'generic',
|
7459 | 'generous',
|
7460 | 'genetics',
|
7461 | 'genre',
|
7462 | 'gentile',
|
7463 | 'gentleman',
|
7464 | 'gently',
|
7465 | 'gents',
|
7466 | 'geography',
|
7467 | 'geologic',
|
7468 | 'geologist',
|
7469 | 'geology',
|
7470 | 'geometric',
|
7471 | 'geometry',
|
7472 | 'geranium',
|
7473 | 'gerbil',
|
7474 | 'geriatric',
|
7475 | 'germicide',
|
7476 | 'germinate',
|
7477 | 'germless',
|
7478 | 'germproof',
|
7479 | 'gestate',
|
7480 | 'gestation',
|
7481 | 'gesture',
|
7482 | 'getaway',
|
7483 | 'getting',
|
7484 | 'getup',
|
7485 | 'giant',
|
7486 | 'gibberish',
|
7487 | 'giblet',
|
7488 | 'giddily',
|
7489 | 'giddiness',
|
7490 | 'giddy',
|
7491 | 'gift',
|
7492 | 'gigabyte',
|
7493 | 'gigahertz',
|
7494 | 'gigantic',
|
7495 | 'giggle',
|
7496 | 'giggling',
|
7497 | 'giggly',
|
7498 | 'gigolo',
|
7499 | 'gilled',
|
7500 | 'gills',
|
7501 | 'gimmick',
|
7502 | 'girdle',
|
7503 | 'giveaway',
|
7504 | 'given',
|
7505 | 'giver',
|
7506 | 'giving',
|
7507 | 'gizmo',
|
7508 | 'gizzard',
|
7509 | 'glacial',
|
7510 | 'glacier',
|
7511 | 'glade',
|
7512 | 'gladiator',
|
7513 | 'gladly',
|
7514 | 'glamorous',
|
7515 | 'glamour',
|
7516 | 'glance',
|
7517 | 'glancing',
|
7518 | 'glandular',
|
7519 | 'glare',
|
7520 | 'glaring',
|
7521 | 'glass',
|
7522 | 'glaucoma',
|
7523 | 'glazing',
|
7524 | 'gleaming',
|
7525 | 'gleeful',
|
7526 | 'glider',
|
7527 | 'gliding',
|
7528 | 'glimmer',
|
7529 | 'glimpse',
|
7530 | 'glisten',
|
7531 | 'glitch',
|
7532 | 'glitter',
|
7533 | 'glitzy',
|
7534 | 'gloater',
|
7535 | 'gloating',
|
7536 | 'gloomily',
|
7537 | 'gloomy',
|
7538 | 'glorified',
|
7539 | 'glorifier',
|
7540 | 'glorify',
|
7541 | 'glorious',
|
7542 | 'glory',
|
7543 | 'gloss',
|
7544 | 'glove',
|
7545 | 'glowing',
|
7546 | 'glowworm',
|
7547 | 'glucose',
|
7548 | 'glue',
|
7549 | 'gluten',
|
7550 | 'glutinous',
|
7551 | 'glutton',
|
7552 | 'gnarly',
|
7553 | 'gnat',
|
7554 | 'goal',
|
7555 | 'goatskin',
|
7556 | 'goes',
|
7557 | 'goggles',
|
7558 | 'going',
|
7559 | 'goldfish',
|
7560 | 'goldmine',
|
7561 | 'goldsmith',
|
7562 | 'golf',
|
7563 | 'goliath',
|
7564 | 'gonad',
|
7565 | 'gondola',
|
7566 | 'gone',
|
7567 | 'gong',
|
7568 | 'good',
|
7569 | 'gooey',
|
7570 | 'goofball',
|
7571 | 'goofiness',
|
7572 | 'goofy',
|
7573 | 'google',
|
7574 | 'goon',
|
7575 | 'gopher',
|
7576 | 'gore',
|
7577 | 'gorged',
|
7578 | 'gorgeous',
|
7579 | 'gory',
|
7580 | 'gosling',
|
7581 | 'gossip',
|
7582 | 'gothic',
|
7583 | 'gotten',
|
7584 | 'gout',
|
7585 | 'gown',
|
7586 | 'grab',
|
7587 | 'graceful',
|
7588 | 'graceless',
|
7589 | 'gracious',
|
7590 | 'gradation',
|
7591 | 'graded',
|
7592 | 'grader',
|
7593 | 'gradient',
|
7594 | 'grading',
|
7595 | 'gradually',
|
7596 | 'graduate',
|
7597 | 'graffiti',
|
7598 | 'grafted',
|
7599 | 'grafting',
|
7600 | 'grain',
|
7601 | 'granddad',
|
7602 | 'grandkid',
|
7603 | 'grandly',
|
7604 | 'grandma',
|
7605 | 'grandpa',
|
7606 | 'grandson',
|
7607 | 'granite',
|
7608 | 'granny',
|
7609 | 'granola',
|
7610 | 'grant',
|
7611 | 'granular',
|
7612 | 'grape',
|
7613 | 'graph',
|
7614 | 'grapple',
|
7615 | 'grappling',
|
7616 | 'grasp',
|
7617 | 'grass',
|
7618 | 'gratified',
|
7619 | 'gratify',
|
7620 | 'grating',
|
7621 | 'gratitude',
|
7622 | 'gratuity',
|
7623 | 'gravel',
|
7624 | 'graveness',
|
7625 | 'graves',
|
7626 | 'graveyard',
|
7627 | 'gravitate',
|
7628 | 'gravity',
|
7629 | 'gravy',
|
7630 | 'gray',
|
7631 | 'grazing',
|
7632 | 'greasily',
|
7633 | 'greedily',
|
7634 | 'greedless',
|
7635 | 'greedy',
|
7636 | 'green',
|
7637 | 'greeter',
|
7638 | 'greeting',
|
7639 | 'grew',
|
7640 | 'greyhound',
|
7641 | 'grid',
|
7642 | 'grief',
|
7643 | 'grievance',
|
7644 | 'grieving',
|
7645 | 'grievous',
|
7646 | 'grill',
|
7647 | 'grimace',
|
7648 | 'grimacing',
|
7649 | 'grime',
|
7650 | 'griminess',
|
7651 | 'grimy',
|
7652 | 'grinch',
|
7653 | 'grinning',
|
7654 | 'grip',
|
7655 | 'gristle',
|
7656 | 'grit',
|
7657 | 'groggily',
|
7658 | 'groggy',
|
7659 | 'groin',
|
7660 | 'groom',
|
7661 | 'groove',
|
7662 | 'grooving',
|
7663 | 'groovy',
|
7664 | 'grope',
|
7665 | 'ground',
|
7666 | 'grouped',
|
7667 | 'grout',
|
7668 | 'grove',
|
7669 | 'grower',
|
7670 | 'growing',
|
7671 | 'growl',
|
7672 | 'grub',
|
7673 | 'grudge',
|
7674 | 'grudging',
|
7675 | 'grueling',
|
7676 | 'gruffly',
|
7677 | 'grumble',
|
7678 | 'grumbling',
|
7679 | 'grumbly',
|
7680 | 'grumpily',
|
7681 | 'grunge',
|
7682 | 'grunt',
|
7683 | 'guacamole',
|
7684 | 'guidable',
|
7685 | 'guidance',
|
7686 | 'guide',
|
7687 | 'guiding',
|
7688 | 'guileless',
|
7689 | 'guise',
|
7690 | 'gulf',
|
7691 | 'gullible',
|
7692 | 'gully',
|
7693 | 'gulp',
|
7694 | 'gumball',
|
7695 | 'gumdrop',
|
7696 | 'gumminess',
|
7697 | 'gumming',
|
7698 | 'gummy',
|
7699 | 'gurgle',
|
7700 | 'gurgling',
|
7701 | 'guru',
|
7702 | 'gush',
|
7703 | 'gusto',
|
7704 | 'gusty',
|
7705 | 'gutless',
|
7706 | 'guts',
|
7707 | 'gutter',
|
7708 | 'guy',
|
7709 | 'guzzler',
|
7710 | 'gyration',
|
7711 | 'habitable',
|
7712 | 'habitant',
|
7713 | 'habitat',
|
7714 | 'habitual',
|
7715 | 'hacked',
|
7716 | 'hacker',
|
7717 | 'hacking',
|
7718 | 'hacksaw',
|
7719 | 'had',
|
7720 | 'haggler',
|
7721 | 'haiku',
|
7722 | 'half',
|
7723 | 'halogen',
|
7724 | 'halt',
|
7725 | 'halved',
|
7726 | 'halves',
|
7727 | 'hamburger',
|
7728 | 'hamlet',
|
7729 | 'hammock',
|
7730 | 'hamper',
|
7731 | 'hamster',
|
7732 | 'hamstring',
|
7733 | 'handbag',
|
7734 | 'handball',
|
7735 | 'handbook',
|
7736 | 'handbrake',
|
7737 | 'handcart',
|
7738 | 'handclap',
|
7739 | 'handclasp',
|
7740 | 'handcraft',
|
7741 | 'handcuff',
|
7742 | 'handed',
|
7743 | 'handful',
|
7744 | 'handgrip',
|
7745 | 'handgun',
|
7746 | 'handheld',
|
7747 | 'handiness',
|
7748 | 'handiwork',
|
7749 | 'handlebar',
|
7750 | 'handled',
|
7751 | 'handler',
|
7752 | 'handling',
|
7753 | 'handmade',
|
7754 | 'handoff',
|
7755 | 'handpick',
|
7756 | 'handprint',
|
7757 | 'handrail',
|
7758 | 'handsaw',
|
7759 | 'handset',
|
7760 | 'handsfree',
|
7761 | 'handshake',
|
7762 | 'handstand',
|
7763 | 'handwash',
|
7764 | 'handwork',
|
7765 | 'handwoven',
|
7766 | 'handwrite',
|
7767 | 'handyman',
|
7768 | 'hangnail',
|
7769 | 'hangout',
|
7770 | 'hangover',
|
7771 | 'hangup',
|
7772 | 'hankering',
|
7773 | 'hankie',
|
7774 | 'hanky',
|
7775 | 'haphazard',
|
7776 | 'happening',
|
7777 | 'happier',
|
7778 | 'happiest',
|
7779 | 'happily',
|
7780 | 'happiness',
|
7781 | 'happy',
|
7782 | 'harbor',
|
7783 | 'hardcopy',
|
7784 | 'hardcore',
|
7785 | 'hardcover',
|
7786 | 'harddisk',
|
7787 | 'hardened',
|
7788 | 'hardener',
|
7789 | 'hardening',
|
7790 | 'hardhat',
|
7791 | 'hardhead',
|
7792 | 'hardiness',
|
7793 | 'hardly',
|
7794 | 'hardness',
|
7795 | 'hardship',
|
7796 | 'hardware',
|
7797 | 'hardwired',
|
7798 | 'hardwood',
|
7799 | 'hardy',
|
7800 | 'harmful',
|
7801 | 'harmless',
|
7802 | 'harmonica',
|
7803 | 'harmonics',
|
7804 | 'harmonize',
|
7805 | 'harmony',
|
7806 | 'harness',
|
7807 | 'harpist',
|
7808 | 'harsh',
|
7809 | 'harvest',
|
7810 | 'hash',
|
7811 | 'hassle',
|
7812 | 'haste',
|
7813 | 'hastily',
|
7814 | 'hastiness',
|
7815 | 'hasty',
|
7816 | 'hatbox',
|
7817 | 'hatchback',
|
7818 | 'hatchery',
|
7819 | 'hatchet',
|
7820 | 'hatching',
|
7821 | 'hatchling',
|
7822 | 'hate',
|
7823 | 'hatless',
|
7824 | 'hatred',
|
7825 | 'haunt',
|
7826 | 'haven',
|
7827 | 'hazard',
|
7828 | 'hazelnut',
|
7829 | 'hazily',
|
7830 | 'haziness',
|
7831 | 'hazing',
|
7832 | 'hazy',
|
7833 | 'headache',
|
7834 | 'headband',
|
7835 | 'headboard',
|
7836 | 'headcount',
|
7837 | 'headdress',
|
7838 | 'headed',
|
7839 | 'header',
|
7840 | 'headfirst',
|
7841 | 'headgear',
|
7842 | 'heading',
|
7843 | 'headlamp',
|
7844 | 'headless',
|
7845 | 'headlock',
|
7846 | 'headphone',
|
7847 | 'headpiece',
|
7848 | 'headrest',
|
7849 | 'headroom',
|
7850 | 'headscarf',
|
7851 | 'headset',
|
7852 | 'headsman',
|
7853 | 'headstand',
|
7854 | 'headstone',
|
7855 | 'headway',
|
7856 | 'headwear',
|
7857 | 'heap',
|
7858 | 'heat',
|
7859 | 'heave',
|
7860 | 'heavily',
|
7861 | 'heaviness',
|
7862 | 'heaving',
|
7863 | 'hedge',
|
7864 | 'hedging',
|
7865 | 'heftiness',
|
7866 | 'hefty',
|
7867 | 'helium',
|
7868 | 'helmet',
|
7869 | 'helper',
|
7870 | 'helpful',
|
7871 | 'helping',
|
7872 | 'helpless',
|
7873 | 'helpline',
|
7874 | 'hemlock',
|
7875 | 'hemstitch',
|
7876 | 'hence',
|
7877 | 'henchman',
|
7878 | 'henna',
|
7879 | 'herald',
|
7880 | 'herbal',
|
7881 | 'herbicide',
|
7882 | 'herbs',
|
7883 | 'heritage',
|
7884 | 'hermit',
|
7885 | 'heroics',
|
7886 | 'heroism',
|
7887 | 'herring',
|
7888 | 'herself',
|
7889 | 'hertz',
|
7890 | 'hesitancy',
|
7891 | 'hesitant',
|
7892 | 'hesitate',
|
7893 | 'hexagon',
|
7894 | 'hexagram',
|
7895 | 'hubcap',
|
7896 | 'huddle',
|
7897 | 'huddling',
|
7898 | 'huff',
|
7899 | 'hug',
|
7900 | 'hula',
|
7901 | 'hulk',
|
7902 | 'hull',
|
7903 | 'human',
|
7904 | 'humble',
|
7905 | 'humbling',
|
7906 | 'humbly',
|
7907 | 'humid',
|
7908 | 'humiliate',
|
7909 | 'humility',
|
7910 | 'humming',
|
7911 | 'hummus',
|
7912 | 'humongous',
|
7913 | 'humorist',
|
7914 | 'humorless',
|
7915 | 'humorous',
|
7916 | 'humpback',
|
7917 | 'humped',
|
7918 | 'humvee',
|
7919 | 'hunchback',
|
7920 | 'hundredth',
|
7921 | 'hunger',
|
7922 | 'hungrily',
|
7923 | 'hungry',
|
7924 | 'hunk',
|
7925 | 'hunter',
|
7926 | 'hunting',
|
7927 | 'huntress',
|
7928 | 'huntsman',
|
7929 | 'hurdle',
|
7930 | 'hurled',
|
7931 | 'hurler',
|
7932 | 'hurling',
|
7933 | 'hurray',
|
7934 | 'hurricane',
|
7935 | 'hurried',
|
7936 | 'hurry',
|
7937 | 'hurt',
|
7938 | 'husband',
|
7939 | 'hush',
|
7940 | 'husked',
|
7941 | 'huskiness',
|
7942 | 'hut',
|
7943 | 'hybrid',
|
7944 | 'hydrant',
|
7945 | 'hydrated',
|
7946 | 'hydration',
|
7947 | 'hydrogen',
|
7948 | 'hydroxide',
|
7949 | 'hyperlink',
|
7950 | 'hypertext',
|
7951 | 'hyphen',
|
7952 | 'hypnoses',
|
7953 | 'hypnosis',
|
7954 | 'hypnotic',
|
7955 | 'hypnotism',
|
7956 | 'hypnotist',
|
7957 | 'hypnotize',
|
7958 | 'hypocrisy',
|
7959 | 'hypocrite',
|
7960 | 'ibuprofen',
|
7961 | 'ice',
|
7962 | 'iciness',
|
7963 | 'icing',
|
7964 | 'icky',
|
7965 | 'icon',
|
7966 | 'icy',
|
7967 | 'idealism',
|
7968 | 'idealist',
|
7969 | 'idealize',
|
7970 | 'ideally',
|
7971 | 'idealness',
|
7972 | 'identical',
|
7973 | 'identify',
|
7974 | 'identity',
|
7975 | 'ideology',
|
7976 | 'idiocy',
|
7977 | 'idiom',
|
7978 | 'idly',
|
7979 | 'igloo',
|
7980 | 'ignition',
|
7981 | 'ignore',
|
7982 | 'iguana',
|
7983 | 'illicitly',
|
7984 | 'illusion',
|
7985 | 'illusive',
|
7986 | 'image',
|
7987 | 'imaginary',
|
7988 | 'imagines',
|
7989 | 'imaging',
|
7990 | 'imbecile',
|
7991 | 'imitate',
|
7992 | 'imitation',
|
7993 | 'immature',
|
7994 | 'immerse',
|
7995 | 'immersion',
|
7996 | 'imminent',
|
7997 | 'immobile',
|
7998 | 'immodest',
|
7999 | 'immorally',
|
8000 | 'immortal',
|
8001 | 'immovable',
|
8002 | 'immovably',
|
8003 | 'immunity',
|
8004 | 'immunize',
|
8005 | 'impaired',
|
8006 | 'impale',
|
8007 | 'impart',
|
8008 | 'impatient',
|
8009 | 'impeach',
|
8010 | 'impeding',
|
8011 | 'impending',
|
8012 | 'imperfect',
|
8013 | 'imperial',
|
8014 | 'impish',
|
8015 | 'implant',
|
8016 | 'implement',
|
8017 | 'implicate',
|
8018 | 'implicit',
|
8019 | 'implode',
|
8020 | 'implosion',
|
8021 | 'implosive',
|
8022 | 'imply',
|
8023 | 'impolite',
|
8024 | 'important',
|
8025 | 'importer',
|
8026 | 'impose',
|
8027 | 'imposing',
|
8028 | 'impotence',
|
8029 | 'impotency',
|
8030 | 'impotent',
|
8031 | 'impound',
|
8032 | 'imprecise',
|
8033 | 'imprint',
|
8034 | 'imprison',
|
8035 | 'impromptu',
|
8036 | 'improper',
|
8037 | 'improve',
|
8038 | 'improving',
|
8039 | 'improvise',
|
8040 | 'imprudent',
|
8041 | 'impulse',
|
8042 | 'impulsive',
|
8043 | 'impure',
|
8044 | 'impurity',
|
8045 | 'iodine',
|
8046 | 'iodize',
|
8047 | 'ion',
|
8048 | 'ipad',
|
8049 | 'iphone',
|
8050 | 'ipod',
|
8051 | 'irate',
|
8052 | 'irk',
|
8053 | 'iron',
|
8054 | 'irregular',
|
8055 | 'irrigate',
|
8056 | 'irritable',
|
8057 | 'irritably',
|
8058 | 'irritant',
|
8059 | 'irritate',
|
8060 | 'islamic',
|
8061 | 'islamist',
|
8062 | 'isolated',
|
8063 | 'isolating',
|
8064 | 'isolation',
|
8065 | 'isotope',
|
8066 | 'issue',
|
8067 | 'issuing',
|
8068 | 'italicize',
|
8069 | 'italics',
|
8070 | 'item',
|
8071 | 'itinerary',
|
8072 | 'itunes',
|
8073 | 'ivory',
|
8074 | 'ivy',
|
8075 | 'jab',
|
8076 | 'jackal',
|
8077 | 'jacket',
|
8078 | 'jackknife',
|
8079 | 'jackpot',
|
8080 | 'jailbird',
|
8081 | 'jailbreak',
|
8082 | 'jailer',
|
8083 | 'jailhouse',
|
8084 | 'jalapeno',
|
8085 | 'jam',
|
8086 | 'janitor',
|
8087 | 'january',
|
8088 | 'jargon',
|
8089 | 'jarring',
|
8090 | 'jasmine',
|
8091 | 'jaundice',
|
8092 | 'jaunt',
|
8093 | 'java',
|
8094 | 'jawed',
|
8095 | 'jawless',
|
8096 | 'jawline',
|
8097 | 'jaws',
|
8098 | 'jaybird',
|
8099 | 'jaywalker',
|
8100 | 'jazz',
|
8101 | 'jeep',
|
8102 | 'jeeringly',
|
8103 | 'jellied',
|
8104 | 'jelly',
|
8105 | 'jersey',
|
8106 | 'jester',
|
8107 | 'jet',
|
8108 | 'jiffy',
|
8109 | 'jigsaw',
|
8110 | 'jimmy',
|
8111 | 'jingle',
|
8112 | 'jingling',
|
8113 | 'jinx',
|
8114 | 'jitters',
|
8115 | 'jittery',
|
8116 | 'job',
|
8117 | 'jockey',
|
8118 | 'jockstrap',
|
8119 | 'jogger',
|
8120 | 'jogging',
|
8121 | 'john',
|
8122 | 'joining',
|
8123 | 'jokester',
|
8124 | 'jokingly',
|
8125 | 'jolliness',
|
8126 | 'jolly',
|
8127 | 'jolt',
|
8128 | 'jot',
|
8129 | 'jovial',
|
8130 | 'joyfully',
|
8131 | 'joylessly',
|
8132 | 'joyous',
|
8133 | 'joyride',
|
8134 | 'joystick',
|
8135 | 'jubilance',
|
8136 | 'jubilant',
|
8137 | 'judge',
|
8138 | 'judgingly',
|
8139 | 'judicial',
|
8140 | 'judiciary',
|
8141 | 'judo',
|
8142 | 'juggle',
|
8143 | 'juggling',
|
8144 | 'jugular',
|
8145 | 'juice',
|
8146 | 'juiciness',
|
8147 | 'juicy',
|
8148 | 'jujitsu',
|
8149 | 'jukebox',
|
8150 | 'july',
|
8151 | 'jumble',
|
8152 | 'jumbo',
|
8153 | 'jump',
|
8154 | 'junction',
|
8155 | 'juncture',
|
8156 | 'june',
|
8157 | 'junior',
|
8158 | 'juniper',
|
8159 | 'junkie',
|
8160 | 'junkman',
|
8161 | 'junkyard',
|
8162 | 'jurist',
|
8163 | 'juror',
|
8164 | 'jury',
|
8165 | 'justice',
|
8166 | 'justifier',
|
8167 | 'justify',
|
8168 | 'justly',
|
8169 | 'justness',
|
8170 | 'juvenile',
|
8171 | 'kabob',
|
8172 | 'kangaroo',
|
8173 | 'karaoke',
|
8174 | 'karate',
|
8175 | 'karma',
|
8176 | 'kebab',
|
8177 | 'keenly',
|
8178 | 'keenness',
|
8179 | 'keep',
|
8180 | 'keg',
|
8181 | 'kelp',
|
8182 | 'kennel',
|
8183 | 'kept',
|
8184 | 'kerchief',
|
8185 | 'kerosene',
|
8186 | 'kettle',
|
8187 | 'kick',
|
8188 | 'kiln',
|
8189 | 'kilobyte',
|
8190 | 'kilogram',
|
8191 | 'kilometer',
|
8192 | 'kilowatt',
|
8193 | 'kilt',
|
8194 | 'kimono',
|
8195 | 'kindle',
|
8196 | 'kindling',
|
8197 | 'kindly',
|
8198 | 'kindness',
|
8199 | 'kindred',
|
8200 | 'kinetic',
|
8201 | 'kinfolk',
|
8202 | 'king',
|
8203 | 'kinship',
|
8204 | 'kinsman',
|
8205 | 'kinswoman',
|
8206 | 'kissable',
|
8207 | 'kisser',
|
8208 | 'kissing',
|
8209 | 'kitchen',
|
8210 | 'kite',
|
8211 | 'kitten',
|
8212 | 'kitty',
|
8213 | 'kiwi',
|
8214 | 'kleenex',
|
8215 | 'knapsack',
|
8216 | 'knee',
|
8217 | 'knelt',
|
8218 | 'knickers',
|
8219 | 'knoll',
|
8220 | 'koala',
|
8221 | 'kooky',
|
8222 | 'kosher',
|
8223 | 'krypton',
|
8224 | 'kudos',
|
8225 | 'kung',
|
8226 | 'labored',
|
8227 | 'laborer',
|
8228 | 'laboring',
|
8229 | 'laborious',
|
8230 | 'labrador',
|
8231 | 'ladder',
|
8232 | 'ladies',
|
8233 | 'ladle',
|
8234 | 'ladybug',
|
8235 | 'ladylike',
|
8236 | 'lagged',
|
8237 | 'lagging',
|
8238 | 'lagoon',
|
8239 | 'lair',
|
8240 | 'lake',
|
8241 | 'lance',
|
8242 | 'landed',
|
8243 | 'landfall',
|
8244 | 'landfill',
|
8245 | 'landing',
|
8246 | 'landlady',
|
8247 | 'landless',
|
8248 | 'landline',
|
8249 | 'landlord',
|
8250 | 'landmark',
|
8251 | 'landmass',
|
8252 | 'landmine',
|
8253 | 'landowner',
|
8254 | 'landscape',
|
8255 | 'landside',
|
8256 | 'landslide',
|
8257 | 'language',
|
8258 | 'lankiness',
|
8259 | 'lanky',
|
8260 | 'lantern',
|
8261 | 'lapdog',
|
8262 | 'lapel',
|
8263 | 'lapped',
|
8264 | 'lapping',
|
8265 | 'laptop',
|
8266 | 'lard',
|
8267 | 'large',
|
8268 | 'lark',
|
8269 | 'lash',
|
8270 | 'lasso',
|
8271 | 'last',
|
8272 | 'latch',
|
8273 | 'late',
|
8274 | 'lather',
|
8275 | 'latitude',
|
8276 | 'latrine',
|
8277 | 'latter',
|
8278 | 'latticed',
|
8279 | 'launch',
|
8280 | 'launder',
|
8281 | 'laundry',
|
8282 | 'laurel',
|
8283 | 'lavender',
|
8284 | 'lavish',
|
8285 | 'laxative',
|
8286 | 'lazily',
|
8287 | 'laziness',
|
8288 | 'lazy',
|
8289 | 'lecturer',
|
8290 | 'left',
|
8291 | 'legacy',
|
8292 | 'legal',
|
8293 | 'legend',
|
8294 | 'legged',
|
8295 | 'leggings',
|
8296 | 'legible',
|
8297 | 'legibly',
|
8298 | 'legislate',
|
8299 | 'lego',
|
8300 | 'legroom',
|
8301 | 'legume',
|
8302 | 'legwarmer',
|
8303 | 'legwork',
|
8304 | 'lemon',
|
8305 | 'lend',
|
8306 | 'length',
|
8307 | 'lens',
|
8308 | 'lent',
|
8309 | 'leotard',
|
8310 | 'lesser',
|
8311 | 'letdown',
|
8312 | 'lethargic',
|
8313 | 'lethargy',
|
8314 | 'letter',
|
8315 | 'lettuce',
|
8316 | 'level',
|
8317 | 'leverage',
|
8318 | 'levers',
|
8319 | 'levitate',
|
8320 | 'levitator',
|
8321 | 'liability',
|
8322 | 'liable',
|
8323 | 'liberty',
|
8324 | 'librarian',
|
8325 | 'library',
|
8326 | 'licking',
|
8327 | 'licorice',
|
8328 | 'lid',
|
8329 | 'life',
|
8330 | 'lifter',
|
8331 | 'lifting',
|
8332 | 'liftoff',
|
8333 | 'ligament',
|
8334 | 'likely',
|
8335 | 'likeness',
|
8336 | 'likewise',
|
8337 | 'liking',
|
8338 | 'lilac',
|
8339 | 'lilly',
|
8340 | 'lily',
|
8341 | 'limb',
|
8342 | 'limeade',
|
8343 | 'limelight',
|
8344 | 'limes',
|
8345 | 'limit',
|
8346 | 'limping',
|
8347 | 'limpness',
|
8348 | 'line',
|
8349 | 'lingo',
|
8350 | 'linguini',
|
8351 | 'linguist',
|
8352 | 'lining',
|
8353 | 'linked',
|
8354 | 'linoleum',
|
8355 | 'linseed',
|
8356 | 'lint',
|
8357 | 'lion',
|
8358 | 'lip',
|
8359 | 'liquefy',
|
8360 | 'liqueur',
|
8361 | 'liquid',
|
8362 | 'lisp',
|
8363 | 'list',
|
8364 | 'litigate',
|
8365 | 'litigator',
|
8366 | 'litmus',
|
8367 | 'litter',
|
8368 | 'little',
|
8369 | 'livable',
|
8370 | 'lived',
|
8371 | 'lively',
|
8372 | 'liver',
|
8373 | 'livestock',
|
8374 | 'lividly',
|
8375 | 'living',
|
8376 | 'lizard',
|
8377 | 'lubricant',
|
8378 | 'lubricate',
|
8379 | 'lucid',
|
8380 | 'luckily',
|
8381 | 'luckiness',
|
8382 | 'luckless',
|
8383 | 'lucrative',
|
8384 | 'ludicrous',
|
8385 | 'lugged',
|
8386 | 'lukewarm',
|
8387 | 'lullaby',
|
8388 | 'lumber',
|
8389 | 'luminance',
|
8390 | 'luminous',
|
8391 | 'lumpiness',
|
8392 | 'lumping',
|
8393 | 'lumpish',
|
8394 | 'lunacy',
|
8395 | 'lunar',
|
8396 | 'lunchbox',
|
8397 | 'luncheon',
|
8398 | 'lunchroom',
|
8399 | 'lunchtime',
|
8400 | 'lung',
|
8401 | 'lurch',
|
8402 | 'lure',
|
8403 | 'luridness',
|
8404 | 'lurk',
|
8405 | 'lushly',
|
8406 | 'lushness',
|
8407 | 'luster',
|
8408 | 'lustfully',
|
8409 | 'lustily',
|
8410 | 'lustiness',
|
8411 | 'lustrous',
|
8412 | 'lusty',
|
8413 | 'luxurious',
|
8414 | 'luxury',
|
8415 | 'lying',
|
8416 | 'lyrically',
|
8417 | 'lyricism',
|
8418 | 'lyricist',
|
8419 | 'lyrics',
|
8420 | 'macarena',
|
8421 | 'macaroni',
|
8422 | 'macaw',
|
8423 | 'mace',
|
8424 | 'machine',
|
8425 | 'machinist',
|
8426 | 'magazine',
|
8427 | 'magenta',
|
8428 | 'maggot',
|
8429 | 'magical',
|
8430 | 'magician',
|
8431 | 'magma',
|
8432 | 'magnesium',
|
8433 | 'magnetic',
|
8434 | 'magnetism',
|
8435 | 'magnetize',
|
8436 | 'magnifier',
|
8437 | 'magnify',
|
8438 | 'magnitude',
|
8439 | 'magnolia',
|
8440 | 'mahogany',
|
8441 | 'maimed',
|
8442 | 'majestic',
|
8443 | 'majesty',
|
8444 | 'majorette',
|
8445 | 'majority',
|
8446 | 'makeover',
|
8447 | 'maker',
|
8448 | 'makeshift',
|
8449 | 'making',
|
8450 | 'malformed',
|
8451 | 'malt',
|
8452 | 'mama',
|
8453 | 'mammal',
|
8454 | 'mammary',
|
8455 | 'mammogram',
|
8456 | 'manager',
|
8457 | 'managing',
|
8458 | 'manatee',
|
8459 | 'mandarin',
|
8460 | 'mandate',
|
8461 | 'mandatory',
|
8462 | 'mandolin',
|
8463 | 'manger',
|
8464 | 'mangle',
|
8465 | 'mango',
|
8466 | 'mangy',
|
8467 | 'manhandle',
|
8468 | 'manhole',
|
8469 | 'manhood',
|
8470 | 'manhunt',
|
8471 | 'manicotti',
|
8472 | 'manicure',
|
8473 | 'manifesto',
|
8474 | 'manila',
|
8475 | 'mankind',
|
8476 | 'manlike',
|
8477 | 'manliness',
|
8478 | 'manly',
|
8479 | 'manmade',
|
8480 | 'manned',
|
8481 | 'mannish',
|
8482 | 'manor',
|
8483 | 'manpower',
|
8484 | 'mantis',
|
8485 | 'mantra',
|
8486 | 'manual',
|
8487 | 'many',
|
8488 | 'map',
|
8489 | 'marathon',
|
8490 | 'marauding',
|
8491 | 'marbled',
|
8492 | 'marbles',
|
8493 | 'marbling',
|
8494 | 'march',
|
8495 | 'mardi',
|
8496 | 'margarine',
|
8497 | 'margarita',
|
8498 | 'margin',
|
8499 | 'marigold',
|
8500 | 'marina',
|
8501 | 'marine',
|
8502 | 'marital',
|
8503 | 'maritime',
|
8504 | 'marlin',
|
8505 | 'marmalade',
|
8506 | 'maroon',
|
8507 | 'married',
|
8508 | 'marrow',
|
8509 | 'marry',
|
8510 | 'marshland',
|
8511 | 'marshy',
|
8512 | 'marsupial',
|
8513 | 'marvelous',
|
8514 | 'marxism',
|
8515 | 'mascot',
|
8516 | 'masculine',
|
8517 | 'mashed',
|
8518 | 'mashing',
|
8519 | 'massager',
|
8520 | 'masses',
|
8521 | 'massive',
|
8522 | 'mastiff',
|
8523 | 'matador',
|
8524 | 'matchbook',
|
8525 | 'matchbox',
|
8526 | 'matcher',
|
8527 | 'matching',
|
8528 | 'matchless',
|
8529 | 'material',
|
8530 | 'maternal',
|
8531 | 'maternity',
|
8532 | 'math',
|
8533 | 'mating',
|
8534 | 'matriarch',
|
8535 | 'matrimony',
|
8536 | 'matrix',
|
8537 | 'matron',
|
8538 | 'matted',
|
8539 | 'matter',
|
8540 | 'maturely',
|
8541 | 'maturing',
|
8542 | 'maturity',
|
8543 | 'mauve',
|
8544 | 'maverick',
|
8545 | 'maximize',
|
8546 | 'maximum',
|
8547 | 'maybe',
|
8548 | 'mayday',
|
8549 | 'mayflower',
|
8550 | 'moaner',
|
8551 | 'moaning',
|
8552 | 'mobile',
|
8553 | 'mobility',
|
8554 | 'mobilize',
|
8555 | 'mobster',
|
8556 | 'mocha',
|
8557 | 'mocker',
|
8558 | 'mockup',
|
8559 | 'modified',
|
8560 | 'modify',
|
8561 | 'modular',
|
8562 | 'modulator',
|
8563 | 'module',
|
8564 | 'moisten',
|
8565 | 'moistness',
|
8566 | 'moisture',
|
8567 | 'molar',
|
8568 | 'molasses',
|
8569 | 'mold',
|
8570 | 'molecular',
|
8571 | 'molecule',
|
8572 | 'molehill',
|
8573 | 'mollusk',
|
8574 | 'mom',
|
8575 | 'monastery',
|
8576 | 'monday',
|
8577 | 'monetary',
|
8578 | 'monetize',
|
8579 | 'moneybags',
|
8580 | 'moneyless',
|
8581 | 'moneywise',
|
8582 | 'mongoose',
|
8583 | 'mongrel',
|
8584 | 'monitor',
|
8585 | 'monkhood',
|
8586 | 'monogamy',
|
8587 | 'monogram',
|
8588 | 'monologue',
|
8589 | 'monopoly',
|
8590 | 'monorail',
|
8591 | 'monotone',
|
8592 | 'monotype',
|
8593 | 'monoxide',
|
8594 | 'monsieur',
|
8595 | 'monsoon',
|
8596 | 'monstrous',
|
8597 | 'monthly',
|
8598 | 'monument',
|
8599 | 'moocher',
|
8600 | 'moodiness',
|
8601 | 'moody',
|
8602 | 'mooing',
|
8603 | 'moonbeam',
|
8604 | 'mooned',
|
8605 | 'moonlight',
|
8606 | 'moonlike',
|
8607 | 'moonlit',
|
8608 | 'moonrise',
|
8609 | 'moonscape',
|
8610 | 'moonshine',
|
8611 | 'moonstone',
|
8612 | 'moonwalk',
|
8613 | 'mop',
|
8614 | 'morale',
|
8615 | 'morality',
|
8616 | 'morally',
|
8617 | 'morbidity',
|
8618 | 'morbidly',
|
8619 | 'morphine',
|
8620 | 'morphing',
|
8621 | 'morse',
|
8622 | 'mortality',
|
8623 | 'mortally',
|
8624 | 'mortician',
|
8625 | 'mortified',
|
8626 | 'mortify',
|
8627 | 'mortuary',
|
8628 | 'mosaic',
|
8629 | 'mossy',
|
8630 | 'most',
|
8631 | 'mothball',
|
8632 | 'mothproof',
|
8633 | 'motion',
|
8634 | 'motivate',
|
8635 | 'motivator',
|
8636 | 'motive',
|
8637 | 'motocross',
|
8638 | 'motor',
|
8639 | 'motto',
|
8640 | 'mountable',
|
8641 | 'mountain',
|
8642 | 'mounted',
|
8643 | 'mounting',
|
8644 | 'mourner',
|
8645 | 'mournful',
|
8646 | 'mouse',
|
8647 | 'mousiness',
|
8648 | 'moustache',
|
8649 | 'mousy',
|
8650 | 'mouth',
|
8651 | 'movable',
|
8652 | 'move',
|
8653 | 'movie',
|
8654 | 'moving',
|
8655 | 'mower',
|
8656 | 'mowing',
|
8657 | 'much',
|
8658 | 'muck',
|
8659 | 'mud',
|
8660 | 'mug',
|
8661 | 'mulberry',
|
8662 | 'mulch',
|
8663 | 'mule',
|
8664 | 'mulled',
|
8665 | 'mullets',
|
8666 | 'multiple',
|
8667 | 'multiply',
|
8668 | 'multitask',
|
8669 | 'multitude',
|
8670 | 'mumble',
|
8671 | 'mumbling',
|
8672 | 'mumbo',
|
8673 | 'mummified',
|
8674 | 'mummify',
|
8675 | 'mummy',
|
8676 | 'mumps',
|
8677 | 'munchkin',
|
8678 | 'mundane',
|
8679 | 'municipal',
|
8680 | 'muppet',
|
8681 | 'mural',
|
8682 | 'murkiness',
|
8683 | 'murky',
|
8684 | 'murmuring',
|
8685 | 'muscular',
|
8686 | 'museum',
|
8687 | 'mushily',
|
8688 | 'mushiness',
|
8689 | 'mushroom',
|
8690 | 'mushy',
|
8691 | 'music',
|
8692 | 'musket',
|
8693 | 'muskiness',
|
8694 | 'musky',
|
8695 | 'mustang',
|
8696 | 'mustard',
|
8697 | 'muster',
|
8698 | 'mustiness',
|
8699 | 'musty',
|
8700 | 'mutable',
|
8701 | 'mutate',
|
8702 | 'mutation',
|
8703 | 'mute',
|
8704 | 'mutilated',
|
8705 | 'mutilator',
|
8706 | 'mutiny',
|
8707 | 'mutt',
|
8708 | 'mutual',
|
8709 | 'muzzle',
|
8710 | 'myself',
|
8711 | 'myspace',
|
8712 | 'mystified',
|
8713 | 'mystify',
|
8714 | 'myth',
|
8715 | 'nacho',
|
8716 | 'nag',
|
8717 | 'nail',
|
8718 | 'name',
|
8719 | 'naming',
|
8720 | 'nanny',
|
8721 | 'nanometer',
|
8722 | 'nape',
|
8723 | 'napkin',
|
8724 | 'napped',
|
8725 | 'napping',
|
8726 | 'nappy',
|
8727 | 'narrow',
|
8728 | 'nastily',
|
8729 | 'nastiness',
|
8730 | 'national',
|
8731 | 'native',
|
8732 | 'nativity',
|
8733 | 'natural',
|
8734 | 'nature',
|
8735 | 'naturist',
|
8736 | 'nautical',
|
8737 | 'navigate',
|
8738 | 'navigator',
|
8739 | 'navy',
|
8740 | 'nearby',
|
8741 | 'nearest',
|
8742 | 'nearly',
|
8743 | 'nearness',
|
8744 | 'neatly',
|
8745 | 'neatness',
|
8746 | 'nebula',
|
8747 | 'nebulizer',
|
8748 | 'nectar',
|
8749 | 'negate',
|
8750 | 'negation',
|
8751 | 'negative',
|
8752 | 'neglector',
|
8753 | 'negligee',
|
8754 | 'negligent',
|
8755 | 'negotiate',
|
8756 | 'nemeses',
|
8757 | 'nemesis',
|
8758 | 'neon',
|
8759 | 'nephew',
|
8760 | 'nerd',
|
8761 | 'nervous',
|
8762 | 'nervy',
|
8763 | 'nest',
|
8764 | 'net',
|
8765 | 'neurology',
|
8766 | 'neuron',
|
8767 | 'neurosis',
|
8768 | 'neurotic',
|
8769 | 'neuter',
|
8770 | 'neutron',
|
8771 | 'never',
|
8772 | 'next',
|
8773 | 'nibble',
|
8774 | 'nickname',
|
8775 | 'nicotine',
|
8776 | 'niece',
|
8777 | 'nifty',
|
8778 | 'nimble',
|
8779 | 'nimbly',
|
8780 | 'nineteen',
|
8781 | 'ninetieth',
|
8782 | 'ninja',
|
8783 | 'nintendo',
|
8784 | 'ninth',
|
8785 | 'nuclear',
|
8786 | 'nuclei',
|
8787 | 'nucleus',
|
8788 | 'nugget',
|
8789 | 'nullify',
|
8790 | 'number',
|
8791 | 'numbing',
|
8792 | 'numbly',
|
8793 | 'numbness',
|
8794 | 'numeral',
|
8795 | 'numerate',
|
8796 | 'numerator',
|
8797 | 'numeric',
|
8798 | 'numerous',
|
8799 | 'nuptials',
|
8800 | 'nursery',
|
8801 | 'nursing',
|
8802 | 'nurture',
|
8803 | 'nutcase',
|
8804 | 'nutlike',
|
8805 | 'nutmeg',
|
8806 | 'nutrient',
|
8807 | 'nutshell',
|
8808 | 'nuttiness',
|
8809 | 'nutty',
|
8810 | 'nuzzle',
|
8811 | 'nylon',
|
8812 | 'oaf',
|
8813 | 'oak',
|
8814 | 'oasis',
|
8815 | 'oat',
|
8816 | 'obedience',
|
8817 | 'obedient',
|
8818 | 'obituary',
|
8819 | 'object',
|
8820 | 'obligate',
|
8821 | 'obliged',
|
8822 | 'oblivion',
|
8823 | 'oblivious',
|
8824 | 'oblong',
|
8825 | 'obnoxious',
|
8826 | 'oboe',
|
8827 | 'obscure',
|
8828 | 'obscurity',
|
8829 | 'observant',
|
8830 | 'observer',
|
8831 | 'observing',
|
8832 | 'obsessed',
|
8833 | 'obsession',
|
8834 | 'obsessive',
|
8835 | 'obsolete',
|
8836 | 'obstacle',
|
8837 | 'obstinate',
|
8838 | 'obstruct',
|
8839 | 'obtain',
|
8840 | 'obtrusive',
|
8841 | 'obtuse',
|
8842 | 'obvious',
|
8843 | 'occultist',
|
8844 | 'occupancy',
|
8845 | 'occupant',
|
8846 | 'occupier',
|
8847 | 'occupy',
|
8848 | 'ocean',
|
8849 | 'ocelot',
|
8850 | 'octagon',
|
8851 | 'octane',
|
8852 | 'october',
|
8853 | 'octopus',
|
8854 | 'ogle',
|
8855 | 'oil',
|
8856 | 'oink',
|
8857 | 'ointment',
|
8858 | 'okay',
|
8859 | 'old',
|
8860 | 'olive',
|
8861 | 'olympics',
|
8862 | 'omega',
|
8863 | 'omen',
|
8864 | 'ominous',
|
8865 | 'omission',
|
8866 | 'omit',
|
8867 | 'omnivore',
|
8868 | 'onboard',
|
8869 | 'oncoming',
|
8870 | 'ongoing',
|
8871 | 'onion',
|
8872 | 'online',
|
8873 | 'onlooker',
|
8874 | 'only',
|
8875 | 'onscreen',
|
8876 | 'onset',
|
8877 | 'onshore',
|
8878 | 'onslaught',
|
8879 | 'onstage',
|
8880 | 'onto',
|
8881 | 'onward',
|
8882 | 'onyx',
|
8883 | 'oops',
|
8884 | 'ooze',
|
8885 | 'oozy',
|
8886 | 'opacity',
|
8887 | 'opal',
|
8888 | 'open',
|
8889 | 'operable',
|
8890 | 'operate',
|
8891 | 'operating',
|
8892 | 'operation',
|
8893 | 'operative',
|
8894 | 'operator',
|
8895 | 'opium',
|
8896 | 'opossum',
|
8897 | 'opponent',
|
8898 | 'oppose',
|
8899 | 'opposing',
|
8900 | 'opposite',
|
8901 | 'oppressed',
|
8902 | 'oppressor',
|
8903 | 'opt',
|
8904 | 'opulently',
|
8905 | 'osmosis',
|
8906 | 'other',
|
8907 | 'otter',
|
8908 | 'ouch',
|
8909 | 'ought',
|
8910 | 'ounce',
|
8911 | 'outage',
|
8912 | 'outback',
|
8913 | 'outbid',
|
8914 | 'outboard',
|
8915 | 'outbound',
|
8916 | 'outbreak',
|
8917 | 'outburst',
|
8918 | 'outcast',
|
8919 | 'outclass',
|
8920 | 'outcome',
|
8921 | 'outdated',
|
8922 | 'outdoors',
|
8923 | 'outer',
|
8924 | 'outfield',
|
8925 | 'outfit',
|
8926 | 'outflank',
|
8927 | 'outgoing',
|
8928 | 'outgrow',
|
8929 | 'outhouse',
|
8930 | 'outing',
|
8931 | 'outlast',
|
8932 | 'outlet',
|
8933 | 'outline',
|
8934 | 'outlook',
|
8935 | 'outlying',
|
8936 | 'outmatch',
|
8937 | 'outmost',
|
8938 | 'outnumber',
|
8939 | 'outplayed',
|
8940 | 'outpost',
|
8941 | 'outpour',
|
8942 | 'output',
|
8943 | 'outrage',
|
8944 | 'outrank',
|
8945 | 'outreach',
|
8946 | 'outright',
|
8947 | 'outscore',
|
8948 | 'outsell',
|
8949 | 'outshine',
|
8950 | 'outshoot',
|
8951 | 'outsider',
|
8952 | 'outskirts',
|
8953 | 'outsmart',
|
8954 | 'outsource',
|
8955 | 'outspoken',
|
8956 | 'outtakes',
|
8957 | 'outthink',
|
8958 | 'outward',
|
8959 | 'outweigh',
|
8960 | 'outwit',
|
8961 | 'oval',
|
8962 | 'ovary',
|
8963 | 'oven',
|
8964 | 'overact',
|
8965 | 'overall',
|
8966 | 'overarch',
|
8967 | 'overbid',
|
8968 | 'overbill',
|
8969 | 'overbite',
|
8970 | 'overblown',
|
8971 | 'overboard',
|
8972 | 'overbook',
|
8973 | 'overbuilt',
|
8974 | 'overcast',
|
8975 | 'overcoat',
|
8976 | 'overcome',
|
8977 | 'overcook',
|
8978 | 'overcrowd',
|
8979 | 'overdraft',
|
8980 | 'overdrawn',
|
8981 | 'overdress',
|
8982 | 'overdrive',
|
8983 | 'overdue',
|
8984 | 'overeager',
|
8985 | 'overeater',
|
8986 | 'overexert',
|
8987 | 'overfed',
|
8988 | 'overfeed',
|
8989 | 'overfill',
|
8990 | 'overflow',
|
8991 | 'overfull',
|
8992 | 'overgrown',
|
8993 | 'overhand',
|
8994 | 'overhang',
|
8995 | 'overhaul',
|
8996 | 'overhead',
|
8997 | 'overhear',
|
8998 | 'overheat',
|
8999 | 'overhung',
|
9000 | 'overjoyed',
|
9001 | 'overkill',
|
9002 | 'overlabor',
|
9003 | 'overlaid',
|
9004 | 'overlap',
|
9005 | 'overlay',
|
9006 | 'overload',
|
9007 | 'overlook',
|
9008 | 'overlord',
|
9009 | 'overlying',
|
9010 | 'overnight',
|
9011 | 'overpass',
|
9012 | 'overpay',
|
9013 | 'overplant',
|
9014 | 'overplay',
|
9015 | 'overpower',
|
9016 | 'overprice',
|
9017 | 'overrate',
|
9018 | 'overreach',
|
9019 | 'overreact',
|
9020 | 'override',
|
9021 | 'overripe',
|
9022 | 'overrule',
|
9023 | 'overrun',
|
9024 | 'overshoot',
|
9025 | 'overshot',
|
9026 | 'oversight',
|
9027 | 'oversized',
|
9028 | 'oversleep',
|
9029 | 'oversold',
|
9030 | 'overspend',
|
9031 | 'overstate',
|
9032 | 'overstay',
|
9033 | 'overstep',
|
9034 | 'overstock',
|
9035 | 'overstuff',
|
9036 | 'oversweet',
|
9037 | 'overtake',
|
9038 | 'overthrow',
|
9039 | 'overtime',
|
9040 | 'overtly',
|
9041 | 'overtone',
|
9042 | 'overture',
|
9043 | 'overturn',
|
9044 | 'overuse',
|
9045 | 'overvalue',
|
9046 | 'overview',
|
9047 | 'overwrite',
|
9048 | 'owl',
|
9049 | 'oxford',
|
9050 | 'oxidant',
|
9051 | 'oxidation',
|
9052 | 'oxidize',
|
9053 | 'oxidizing',
|
9054 | 'oxygen',
|
9055 | 'oxymoron',
|
9056 | 'oyster',
|
9057 | 'ozone',
|
9058 | 'paced',
|
9059 | 'pacemaker',
|
9060 | 'pacific',
|
9061 | 'pacifier',
|
9062 | 'pacifism',
|
9063 | 'pacifist',
|
9064 | 'pacify',
|
9065 | 'padded',
|
9066 | 'padding',
|
9067 | 'paddle',
|
9068 | 'paddling',
|
9069 | 'padlock',
|
9070 | 'pagan',
|
9071 | 'pager',
|
9072 | 'paging',
|
9073 | 'pajamas',
|
9074 | 'palace',
|
9075 | 'palatable',
|
9076 | 'palm',
|
9077 | 'palpable',
|
9078 | 'palpitate',
|
9079 | 'paltry',
|
9080 | 'pampered',
|
9081 | 'pamperer',
|
9082 | 'pampers',
|
9083 | 'pamphlet',
|
9084 | 'panama',
|
9085 | 'pancake',
|
9086 | 'pancreas',
|
9087 | 'panda',
|
9088 | 'pandemic',
|
9089 | 'pang',
|
9090 | 'panhandle',
|
9091 | 'panic',
|
9092 | 'panning',
|
9093 | 'panorama',
|
9094 | 'panoramic',
|
9095 | 'panther',
|
9096 | 'pantomime',
|
9097 | 'pantry',
|
9098 | 'pants',
|
9099 | 'pantyhose',
|
9100 | 'paparazzi',
|
9101 | 'papaya',
|
9102 | 'paper',
|
9103 | 'paprika',
|
9104 | 'papyrus',
|
9105 | 'parabola',
|
9106 | 'parachute',
|
9107 | 'parade',
|
9108 | 'paradox',
|
9109 | 'paragraph',
|
9110 | 'parakeet',
|
9111 | 'paralegal',
|
9112 | 'paralyses',
|
9113 | 'paralysis',
|
9114 | 'paralyze',
|
9115 | 'paramedic',
|
9116 | 'parameter',
|
9117 | 'paramount',
|
9118 | 'parasail',
|
9119 | 'parasite',
|
9120 | 'parasitic',
|
9121 | 'parcel',
|
9122 | 'parched',
|
9123 | 'parchment',
|
9124 | 'pardon',
|
9125 | 'parish',
|
9126 | 'parka',
|
9127 | 'parking',
|
9128 | 'parkway',
|
9129 | 'parlor',
|
9130 | 'parmesan',
|
9131 | 'parole',
|
9132 | 'parrot',
|
9133 | 'parsley',
|
9134 | 'parsnip',
|
9135 | 'partake',
|
9136 | 'parted',
|
9137 | 'parting',
|
9138 | 'partition',
|
9139 | 'partly',
|
9140 | 'partner',
|
9141 | 'partridge',
|
9142 | 'party',
|
9143 | 'passable',
|
9144 | 'passably',
|
9145 | 'passage',
|
9146 | 'passcode',
|
9147 | 'passenger',
|
9148 | 'passerby',
|
9149 | 'passing',
|
9150 | 'passion',
|
9151 | 'passive',
|
9152 | 'passivism',
|
9153 | 'passover',
|
9154 | 'passport',
|
9155 | 'password',
|
9156 | 'pasta',
|
9157 | 'pasted',
|
9158 | 'pastel',
|
9159 | 'pastime',
|
9160 | 'pastor',
|
9161 | 'pastrami',
|
9162 | 'pasture',
|
9163 | 'pasty',
|
9164 | 'patchwork',
|
9165 | 'patchy',
|
9166 | 'paternal',
|
9167 | 'paternity',
|
9168 | 'path',
|
9169 | 'patience',
|
9170 | 'patient',
|
9171 | 'patio',
|
9172 | 'patriarch',
|
9173 | 'patriot',
|
9174 | 'patrol',
|
9175 | 'patronage',
|
9176 | 'patronize',
|
9177 | 'pauper',
|
9178 | 'pavement',
|
9179 | 'paver',
|
9180 | 'pavestone',
|
9181 | 'pavilion',
|
9182 | 'paving',
|
9183 | 'pawing',
|
9184 | 'payable',
|
9185 | 'payback',
|
9186 | 'paycheck',
|
9187 | 'payday',
|
9188 | 'payee',
|
9189 | 'payer',
|
9190 | 'paying',
|
9191 | 'payment',
|
9192 | 'payphone',
|
9193 | 'payroll',
|
9194 | 'pebble',
|
9195 | 'pebbly',
|
9196 | 'pecan',
|
9197 | 'pectin',
|
9198 | 'peculiar',
|
9199 | 'peddling',
|
9200 | 'pediatric',
|
9201 | 'pedicure',
|
9202 | 'pedigree',
|
9203 | 'pedometer',
|
9204 | 'pegboard',
|
9205 | 'pelican',
|
9206 | 'pellet',
|
9207 | 'pelt',
|
9208 | 'pelvis',
|
9209 | 'penalize',
|
9210 | 'penalty',
|
9211 | 'pencil',
|
9212 | 'pendant',
|
9213 | 'pending',
|
9214 | 'penholder',
|
9215 | 'penknife',
|
9216 | 'pennant',
|
9217 | 'penniless',
|
9218 | 'penny',
|
9219 | 'penpal',
|
9220 | 'pension',
|
9221 | 'pentagon',
|
9222 | 'pentagram',
|
9223 | 'pep',
|
9224 | 'perceive',
|
9225 | 'percent',
|
9226 | 'perch',
|
9227 | 'percolate',
|
9228 | 'perennial',
|
9229 | 'perfected',
|
9230 | 'perfectly',
|
9231 | 'perfume',
|
9232 | 'periscope',
|
9233 | 'perish',
|
9234 | 'perjurer',
|
9235 | 'perjury',
|
9236 | 'perkiness',
|
9237 | 'perky',
|
9238 | 'perm',
|
9239 | 'peroxide',
|
9240 | 'perpetual',
|
9241 | 'perplexed',
|
9242 | 'persecute',
|
9243 | 'persevere',
|
9244 | 'persuaded',
|
9245 | 'persuader',
|
9246 | 'pesky',
|
9247 | 'peso',
|
9248 | 'pessimism',
|
9249 | 'pessimist',
|
9250 | 'pester',
|
9251 | 'pesticide',
|
9252 | 'petal',
|
9253 | 'petite',
|
9254 | 'petition',
|
9255 | 'petri',
|
9256 | 'petroleum',
|
9257 | 'petted',
|
9258 | 'petticoat',
|
9259 | 'pettiness',
|
9260 | 'petty',
|
9261 | 'petunia',
|
9262 | 'phantom',
|
9263 | 'phobia',
|
9264 | 'phoenix',
|
9265 | 'phonebook',
|
9266 | 'phoney',
|
9267 | 'phonics',
|
9268 | 'phoniness',
|
9269 | 'phony',
|
9270 | 'phosphate',
|
9271 | 'photo',
|
9272 | 'phrase',
|
9273 | 'phrasing',
|
9274 | 'placard',
|
9275 | 'placate',
|
9276 | 'placidly',
|
9277 | 'plank',
|
9278 | 'planner',
|
9279 | 'plant',
|
9280 | 'plasma',
|
9281 | 'plaster',
|
9282 | 'plastic',
|
9283 | 'plated',
|
9284 | 'platform',
|
9285 | 'plating',
|
9286 | 'platinum',
|
9287 | 'platonic',
|
9288 | 'platter',
|
9289 | 'platypus',
|
9290 | 'plausible',
|
9291 | 'plausibly',
|
9292 | 'playable',
|
9293 | 'playback',
|
9294 | 'player',
|
9295 | 'playful',
|
9296 | 'playgroup',
|
9297 | 'playhouse',
|
9298 | 'playing',
|
9299 | 'playlist',
|
9300 | 'playmaker',
|
9301 | 'playmate',
|
9302 | 'playoff',
|
9303 | 'playpen',
|
9304 | 'playroom',
|
9305 | 'playset',
|
9306 | 'plaything',
|
9307 | 'playtime',
|
9308 | 'plaza',
|
9309 | 'pleading',
|
9310 | 'pleat',
|
9311 | 'pledge',
|
9312 | 'plentiful',
|
9313 | 'plenty',
|
9314 | 'plethora',
|
9315 | 'plexiglas',
|
9316 | 'pliable',
|
9317 | 'plod',
|
9318 | 'plop',
|
9319 | 'plot',
|
9320 | 'plow',
|
9321 | 'ploy',
|
9322 | 'pluck',
|
9323 | 'plug',
|
9324 | 'plunder',
|
9325 | 'plunging',
|
9326 | 'plural',
|
9327 | 'plus',
|
9328 | 'plutonium',
|
9329 | 'plywood',
|
9330 | 'poach',
|
9331 | 'pod',
|
9332 | 'poem',
|
9333 | 'poet',
|
9334 | 'pogo',
|
9335 | 'pointed',
|
9336 | 'pointer',
|
9337 | 'pointing',
|
9338 | 'pointless',
|
9339 | 'pointy',
|
9340 | 'poise',
|
9341 | 'poison',
|
9342 | 'poker',
|
9343 | 'poking',
|
9344 | 'polar',
|
9345 | 'police',
|
9346 | 'policy',
|
9347 | 'polio',
|
9348 | 'polish',
|
9349 | 'politely',
|
9350 | 'polka',
|
9351 | 'polo',
|
9352 | 'polyester',
|
9353 | 'polygon',
|
9354 | 'polygraph',
|
9355 | 'polymer',
|
9356 | 'poncho',
|
9357 | 'pond',
|
9358 | 'pony',
|
9359 | 'popcorn',
|
9360 | 'pope',
|
9361 | 'poplar',
|
9362 | 'popper',
|
9363 | 'poppy',
|
9364 | 'popsicle',
|
9365 | 'populace',
|
9366 | 'popular',
|
9367 | 'populate',
|
9368 | 'porcupine',
|
9369 | 'pork',
|
9370 | 'porous',
|
9371 | 'porridge',
|
9372 | 'portable',
|
9373 | 'portal',
|
9374 | 'portfolio',
|
9375 | 'porthole',
|
9376 | 'portion',
|
9377 | 'portly',
|
9378 | 'portside',
|
9379 | 'poser',
|
9380 | 'posh',
|
9381 | 'posing',
|
9382 | 'possible',
|
9383 | 'possibly',
|
9384 | 'possum',
|
9385 | 'postage',
|
9386 | 'postal',
|
9387 | 'postbox',
|
9388 | 'postcard',
|
9389 | 'posted',
|
9390 | 'poster',
|
9391 | 'posting',
|
9392 | 'postnasal',
|
9393 | 'posture',
|
9394 | 'postwar',
|
9395 | 'pouch',
|
9396 | 'pounce',
|
9397 | 'pouncing',
|
9398 | 'pound',
|
9399 | 'pouring',
|
9400 | 'pout',
|
9401 | 'powdered',
|
9402 | 'powdering',
|
9403 | 'powdery',
|
9404 | 'power',
|
9405 | 'powwow',
|
9406 | 'pox',
|
9407 | 'praising',
|
9408 | 'prance',
|
9409 | 'prancing',
|
9410 | 'pranker',
|
9411 | 'prankish',
|
9412 | 'prankster',
|
9413 | 'prayer',
|
9414 | 'praying',
|
9415 | 'preacher',
|
9416 | 'preaching',
|
9417 | 'preachy',
|
9418 | 'preamble',
|
9419 | 'precinct',
|
9420 | 'precise',
|
9421 | 'precision',
|
9422 | 'precook',
|
9423 | 'precut',
|
9424 | 'predator',
|
9425 | 'predefine',
|
9426 | 'predict',
|
9427 | 'preface',
|
9428 | 'prefix',
|
9429 | 'preflight',
|
9430 | 'preformed',
|
9431 | 'pregame',
|
9432 | 'pregnancy',
|
9433 | 'pregnant',
|
9434 | 'preheated',
|
9435 | 'prelaunch',
|
9436 | 'prelaw',
|
9437 | 'prelude',
|
9438 | 'premiere',
|
9439 | 'premises',
|
9440 | 'premium',
|
9441 | 'prenatal',
|
9442 | 'preoccupy',
|
9443 | 'preorder',
|
9444 | 'prepaid',
|
9445 | 'prepay',
|
9446 | 'preplan',
|
9447 | 'preppy',
|
9448 | 'preschool',
|
9449 | 'prescribe',
|
9450 | 'preseason',
|
9451 | 'preset',
|
9452 | 'preshow',
|
9453 | 'president',
|
9454 | 'presoak',
|
9455 | 'press',
|
9456 | 'presume',
|
9457 | 'presuming',
|
9458 | 'preteen',
|
9459 | 'pretended',
|
9460 | 'pretender',
|
9461 | 'pretense',
|
9462 | 'pretext',
|
9463 | 'pretty',
|
9464 | 'pretzel',
|
9465 | 'prevail',
|
9466 | 'prevalent',
|
9467 | 'prevent',
|
9468 | 'preview',
|
9469 | 'previous',
|
9470 | 'prewar',
|
9471 | 'prewashed',
|
9472 | 'prideful',
|
9473 | 'pried',
|
9474 | 'primal',
|
9475 | 'primarily',
|
9476 | 'primary',
|
9477 | 'primate',
|
9478 | 'primer',
|
9479 | 'primp',
|
9480 | 'princess',
|
9481 | 'print',
|
9482 | 'prior',
|
9483 | 'prism',
|
9484 | 'prison',
|
9485 | 'prissy',
|
9486 | 'pristine',
|
9487 | 'privacy',
|
9488 | 'private',
|
9489 | 'privatize',
|
9490 | 'prize',
|
9491 | 'proactive',
|
9492 | 'probable',
|
9493 | 'probably',
|
9494 | 'probation',
|
9495 | 'probe',
|
9496 | 'probing',
|
9497 | 'probiotic',
|
9498 | 'problem',
|
9499 | 'procedure',
|
9500 | 'process',
|
9501 | 'proclaim',
|
9502 | 'procreate',
|
9503 | 'procurer',
|
9504 | 'prodigal',
|
9505 | 'prodigy',
|
9506 | 'produce',
|
9507 | 'product',
|
9508 | 'profane',
|
9509 | 'profanity',
|
9510 | 'professed',
|
9511 | 'professor',
|
9512 | 'profile',
|
9513 | 'profound',
|
9514 | 'profusely',
|
9515 | 'progeny',
|
9516 | 'prognosis',
|
9517 | 'program',
|
9518 | 'progress',
|
9519 | 'projector',
|
9520 | 'prologue',
|
9521 | 'prolonged',
|
9522 | 'promenade',
|
9523 | 'prominent',
|
9524 | 'promoter',
|
9525 | 'promotion',
|
9526 | 'prompter',
|
9527 | 'promptly',
|
9528 | 'prone',
|
9529 | 'prong',
|
9530 | 'pronounce',
|
9531 | 'pronto',
|
9532 | 'proofing',
|
9533 | 'proofread',
|
9534 | 'proofs',
|
9535 | 'propeller',
|
9536 | 'properly',
|
9537 | 'property',
|
9538 | 'proponent',
|
9539 | 'proposal',
|
9540 | 'propose',
|
9541 | 'props',
|
9542 | 'prorate',
|
9543 | 'protector',
|
9544 | 'protegee',
|
9545 | 'proton',
|
9546 | 'prototype',
|
9547 | 'protozoan',
|
9548 | 'protract',
|
9549 | 'protrude',
|
9550 | 'proud',
|
9551 | 'provable',
|
9552 | 'proved',
|
9553 | 'proven',
|
9554 | 'provided',
|
9555 | 'provider',
|
9556 | 'providing',
|
9557 | 'province',
|
9558 | 'proving',
|
9559 | 'provoke',
|
9560 | 'provoking',
|
9561 | 'provolone',
|
9562 | 'prowess',
|
9563 | 'prowler',
|
9564 | 'prowling',
|
9565 | 'proximity',
|
9566 | 'proxy',
|
9567 | 'prozac',
|
9568 | 'prude',
|
9569 | 'prudishly',
|
9570 | 'prune',
|
9571 | 'pruning',
|
9572 | 'pry',
|
9573 | 'psychic',
|
9574 | 'public',
|
9575 | 'publisher',
|
9576 | 'pucker',
|
9577 | 'pueblo',
|
9578 | 'pug',
|
9579 | 'pull',
|
9580 | 'pulmonary',
|
9581 | 'pulp',
|
9582 | 'pulsate',
|
9583 | 'pulse',
|
9584 | 'pulverize',
|
9585 | 'puma',
|
9586 | 'pumice',
|
9587 | 'pummel',
|
9588 | 'punch',
|
9589 | 'punctual',
|
9590 | 'punctuate',
|
9591 | 'punctured',
|
9592 | 'pungent',
|
9593 | 'punisher',
|
9594 | 'punk',
|
9595 | 'pupil',
|
9596 | 'puppet',
|
9597 | 'puppy',
|
9598 | 'purchase',
|
9599 | 'pureblood',
|
9600 | 'purebred',
|
9601 | 'purely',
|
9602 | 'pureness',
|
9603 | 'purgatory',
|
9604 | 'purge',
|
9605 | 'purging',
|
9606 | 'purifier',
|
9607 | 'purify',
|
9608 | 'purist',
|
9609 | 'puritan',
|
9610 | 'purity',
|
9611 | 'purple',
|
9612 | 'purplish',
|
9613 | 'purposely',
|
9614 | 'purr',
|
9615 | 'purse',
|
9616 | 'pursuable',
|
9617 | 'pursuant',
|
9618 | 'pursuit',
|
9619 | 'purveyor',
|
9620 | 'pushcart',
|
9621 | 'pushchair',
|
9622 | 'pusher',
|
9623 | 'pushiness',
|
9624 | 'pushing',
|
9625 | 'pushover',
|
9626 | 'pushpin',
|
9627 | 'pushup',
|
9628 | 'pushy',
|
9629 | 'putdown',
|
9630 | 'putt',
|
9631 | 'puzzle',
|
9632 | 'puzzling',
|
9633 | 'pyramid',
|
9634 | 'pyromania',
|
9635 | 'python',
|
9636 | 'quack',
|
9637 | 'quadrant',
|
9638 | 'quail',
|
9639 | 'quaintly',
|
9640 | 'quake',
|
9641 | 'quaking',
|
9642 | 'qualified',
|
9643 | 'qualifier',
|
9644 | 'qualify',
|
9645 | 'quality',
|
9646 | 'qualm',
|
9647 | 'quantum',
|
9648 | 'quarrel',
|
9649 | 'quarry',
|
9650 | 'quartered',
|
9651 | 'quarterly',
|
9652 | 'quarters',
|
9653 | 'quartet',
|
9654 | 'quench',
|
9655 | 'query',
|
9656 | 'quicken',
|
9657 | 'quickly',
|
9658 | 'quickness',
|
9659 | 'quicksand',
|
9660 | 'quickstep',
|
9661 | 'quiet',
|
9662 | 'quill',
|
9663 | 'quilt',
|
9664 | 'quintet',
|
9665 | 'quintuple',
|
9666 | 'quirk',
|
9667 | 'quit',
|
9668 | 'quiver',
|
9669 | 'quizzical',
|
9670 | 'quotable',
|
9671 | 'quotation',
|
9672 | 'quote',
|
9673 | 'rabid',
|
9674 | 'race',
|
9675 | 'racing',
|
9676 | 'racism',
|
9677 | 'rack',
|
9678 | 'racoon',
|
9679 | 'radar',
|
9680 | 'radial',
|
9681 | 'radiance',
|
9682 | 'radiantly',
|
9683 | 'radiated',
|
9684 | 'radiation',
|
9685 | 'radiator',
|
9686 | 'radio',
|
9687 | 'radish',
|
9688 | 'raffle',
|
9689 | 'raft',
|
9690 | 'rage',
|
9691 | 'ragged',
|
9692 | 'raging',
|
9693 | 'ragweed',
|
9694 | 'raider',
|
9695 | 'railcar',
|
9696 | 'railing',
|
9697 | 'railroad',
|
9698 | 'railway',
|
9699 | 'raisin',
|
9700 | 'rake',
|
9701 | 'raking',
|
9702 | 'rally',
|
9703 | 'ramble',
|
9704 | 'rambling',
|
9705 | 'ramp',
|
9706 | 'ramrod',
|
9707 | 'ranch',
|
9708 | 'rancidity',
|
9709 | 'random',
|
9710 | 'ranged',
|
9711 | 'ranger',
|
9712 | 'ranging',
|
9713 | 'ranked',
|
9714 | 'ranking',
|
9715 | 'ransack',
|
9716 | 'ranting',
|
9717 | 'rants',
|
9718 | 'rare',
|
9719 | 'rarity',
|
9720 | 'rascal',
|
9721 | 'rash',
|
9722 | 'rasping',
|
9723 | 'ravage',
|
9724 | 'raven',
|
9725 | 'ravine',
|
9726 | 'raving',
|
9727 | 'ravioli',
|
9728 | 'ravishing',
|
9729 | 'reabsorb',
|
9730 | 'reach',
|
9731 | 'reacquire',
|
9732 | 'reaction',
|
9733 | 'reactive',
|
9734 | 'reactor',
|
9735 | 'reaffirm',
|
9736 | 'ream',
|
9737 | 'reanalyze',
|
9738 | 'reappear',
|
9739 | 'reapply',
|
9740 | 'reappoint',
|
9741 | 'reapprove',
|
9742 | 'rearrange',
|
9743 | 'rearview',
|
9744 | 'reason',
|
9745 | 'reassign',
|
9746 | 'reassure',
|
9747 | 'reattach',
|
9748 | 'reawake',
|
9749 | 'rebalance',
|
9750 | 'rebate',
|
9751 | 'rebel',
|
9752 | 'rebirth',
|
9753 | 'reboot',
|
9754 | 'reborn',
|
9755 | 'rebound',
|
9756 | 'rebuff',
|
9757 | 'rebuild',
|
9758 | 'rebuilt',
|
9759 | 'reburial',
|
9760 | 'rebuttal',
|
9761 | 'recall',
|
9762 | 'recant',
|
9763 | 'recapture',
|
9764 | 'recast',
|
9765 | 'recede',
|
9766 | 'recent',
|
9767 | 'recess',
|
9768 | 'recharger',
|
9769 | 'recipient',
|
9770 | 'recital',
|
9771 | 'recite',
|
9772 | 'reckless',
|
9773 | 'reclaim',
|
9774 | 'recliner',
|
9775 | 'reclining',
|
9776 | 'recluse',
|
9777 | 'reclusive',
|
9778 | 'recognize',
|
9779 | 'recoil',
|
9780 | 'recollect',
|
9781 | 'recolor',
|
9782 | 'reconcile',
|
9783 | 'reconfirm',
|
9784 | 'reconvene',
|
9785 | 'recopy',
|
9786 | 'record',
|
9787 | 'recount',
|
9788 | 'recoup',
|
9789 | 'recovery',
|
9790 | 'recreate',
|
9791 | 'rectal',
|
9792 | 'rectangle',
|
9793 | 'rectified',
|
9794 | 'rectify',
|
9795 | 'recycled',
|
9796 | 'recycler',
|
9797 | 'recycling',
|
9798 | 'reemerge',
|
9799 | 'reenact',
|
9800 | 'reenter',
|
9801 | 'reentry',
|
9802 | 'reexamine',
|
9803 | 'referable',
|
9804 | 'referee',
|
9805 | 'reference',
|
9806 | 'refill',
|
9807 | 'refinance',
|
9808 | 'refined',
|
9809 | 'refinery',
|
9810 | 'refining',
|
9811 | 'refinish',
|
9812 | 'reflected',
|
9813 | 'reflector',
|
9814 | 'reflex',
|
9815 | 'reflux',
|
9816 | 'refocus',
|
9817 | 'refold',
|
9818 | 'reforest',
|
9819 | 'reformat',
|
9820 | 'reformed',
|
9821 | 'reformer',
|
9822 | 'reformist',
|
9823 | 'refract',
|
9824 | 'refrain',
|
9825 | 'refreeze',
|
9826 | 'refresh',
|
9827 | 'refried',
|
9828 | 'refueling',
|
9829 | 'refund',
|
9830 | 'refurbish',
|
9831 | 'refurnish',
|
9832 | 'refusal',
|
9833 | 'refuse',
|
9834 | 'refusing',
|
9835 | 'refutable',
|
9836 | 'refute',
|
9837 | 'regain',
|
9838 | 'regalia',
|
9839 | 'regally',
|
9840 | 'reggae',
|
9841 | 'regime',
|
9842 | 'region',
|
9843 | 'register',
|
9844 | 'registrar',
|
9845 | 'registry',
|
9846 | 'regress',
|
9847 | 'regretful',
|
9848 | 'regroup',
|
9849 | 'regular',
|
9850 | 'regulate',
|
9851 | 'regulator',
|
9852 | 'rehab',
|
9853 | 'reheat',
|
9854 | 'rehire',
|
9855 | 'rehydrate',
|
9856 | 'reimburse',
|
9857 | 'reissue',
|
9858 | 'reiterate',
|
9859 | 'rejoice',
|
9860 | 'rejoicing',
|
9861 | 'rejoin',
|
9862 | 'rekindle',
|
9863 | 'relapse',
|
9864 | 'relapsing',
|
9865 | 'relatable',
|
9866 | 'related',
|
9867 | 'relation',
|
9868 | 'relative',
|
9869 | 'relax',
|
9870 | 'relay',
|
9871 | 'relearn',
|
9872 | 'release',
|
9873 | 'relenting',
|
9874 | 'reliable',
|
9875 | 'reliably',
|
9876 | 'reliance',
|
9877 | 'reliant',
|
9878 | 'relic',
|
9879 | 'relieve',
|
9880 | 'relieving',
|
9881 | 'relight',
|
9882 | 'relish',
|
9883 | 'relive',
|
9884 | 'reload',
|
9885 | 'relocate',
|
9886 | 'relock',
|
9887 | 'reluctant',
|
9888 | 'rely',
|
9889 | 'remake',
|
9890 | 'remark',
|
9891 | 'remarry',
|
9892 | 'rematch',
|
9893 | 'remedial',
|
9894 | 'remedy',
|
9895 | 'remember',
|
9896 | 'reminder',
|
9897 | 'remindful',
|
9898 | 'remission',
|
9899 | 'remix',
|
9900 | 'remnant',
|
9901 | 'remodeler',
|
9902 | 'remold',
|
9903 | 'remorse',
|
9904 | 'remote',
|
9905 | 'removable',
|
9906 | 'removal',
|
9907 | 'removed',
|
9908 | 'remover',
|
9909 | 'removing',
|
9910 | 'rename',
|
9911 | 'renderer',
|
9912 | 'rendering',
|
9913 | 'rendition',
|
9914 | 'renegade',
|
9915 | 'renewable',
|
9916 | 'renewably',
|
9917 | 'renewal',
|
9918 | 'renewed',
|
9919 | 'renounce',
|
9920 | 'renovate',
|
9921 | 'renovator',
|
9922 | 'rentable',
|
9923 | 'rental',
|
9924 | 'rented',
|
9925 | 'renter',
|
9926 | 'reoccupy',
|
9927 | 'reoccur',
|
9928 | 'reopen',
|
9929 | 'reorder',
|
9930 | 'repackage',
|
9931 | 'repacking',
|
9932 | 'repaint',
|
9933 | 'repair',
|
9934 | 'repave',
|
9935 | 'repaying',
|
9936 | 'repayment',
|
9937 | 'repeal',
|
9938 | 'repeated',
|
9939 | 'repeater',
|
9940 | 'repent',
|
9941 | 'rephrase',
|
9942 | 'replace',
|
9943 | 'replay',
|
9944 | 'replica',
|
9945 | 'reply',
|
9946 | 'reporter',
|
9947 | 'repose',
|
9948 | 'repossess',
|
9949 | 'repost',
|
9950 | 'repressed',
|
9951 | 'reprimand',
|
9952 | 'reprint',
|
9953 | 'reprise',
|
9954 | 'reproach',
|
9955 | 'reprocess',
|
9956 | 'reproduce',
|
9957 | 'reprogram',
|
9958 | 'reps',
|
9959 | 'reptile',
|
9960 | 'reptilian',
|
9961 | 'repugnant',
|
9962 | 'repulsion',
|
9963 | 'repulsive',
|
9964 | 'repurpose',
|
9965 | 'reputable',
|
9966 | 'reputably',
|
9967 | 'request',
|
9968 | 'require',
|
9969 | 'requisite',
|
9970 | 'reroute',
|
9971 | 'rerun',
|
9972 | 'resale',
|
9973 | 'resample',
|
9974 | 'rescuer',
|
9975 | 'reseal',
|
9976 | 'research',
|
9977 | 'reselect',
|
9978 | 'reseller',
|
9979 | 'resemble',
|
9980 | 'resend',
|
9981 | 'resent',
|
9982 | 'reset',
|
9983 | 'reshape',
|
9984 | 'reshoot',
|
9985 | 'reshuffle',
|
9986 | 'residence',
|
9987 | 'residency',
|
9988 | 'resident',
|
9989 | 'residual',
|
9990 | 'residue',
|
9991 | 'resigned',
|
9992 | 'resilient',
|
9993 | 'resistant',
|
9994 | 'resisting',
|
9995 | 'resize',
|
9996 | 'resolute',
|
9997 | 'resolved',
|
9998 | 'resonant',
|
9999 | 'resonate',
|
10000 | 'resort',
|
10001 | 'resource',
|
10002 | 'respect',
|
10003 | 'resubmit',
|
10004 | 'result',
|
10005 | 'resume',
|
10006 | 'resupply',
|
10007 | 'resurface',
|
10008 | 'resurrect',
|
10009 | 'retail',
|
10010 | 'retainer',
|
10011 | 'retaining',
|
10012 | 'retake',
|
10013 | 'retaliate',
|
10014 | 'retention',
|
10015 | 'rethink',
|
10016 | 'retinal',
|
10017 | 'retired',
|
10018 | 'retiree',
|
10019 | 'retiring',
|
10020 | 'retold',
|
10021 | 'retool',
|
10022 | 'retorted',
|
10023 | 'retouch',
|
10024 | 'retrace',
|
10025 | 'retract',
|
10026 | 'retrain',
|
10027 | 'retread',
|
10028 | 'retreat',
|
10029 | 'retrial',
|
10030 | 'retrieval',
|
10031 | 'retriever',
|
10032 | 'retry',
|
10033 | 'return',
|
10034 | 'retying',
|
10035 | 'retype',
|
10036 | 'reunion',
|
10037 | 'reunite',
|
10038 | 'reusable',
|
10039 | 'reuse',
|
10040 | 'reveal',
|
10041 | 'reveler',
|
10042 | 'revenge',
|
10043 | 'revenue',
|
10044 | 'reverb',
|
10045 | 'revered',
|
10046 | 'reverence',
|
10047 | 'reverend',
|
10048 | 'reversal',
|
10049 | 'reverse',
|
10050 | 'reversing',
|
10051 | 'reversion',
|
10052 | 'revert',
|
10053 | 'revisable',
|
10054 | 'revise',
|
10055 | 'revision',
|
10056 | 'revisit',
|
10057 | 'revivable',
|
10058 | 'revival',
|
10059 | 'reviver',
|
10060 | 'reviving',
|
10061 | 'revocable',
|
10062 | 'revoke',
|
10063 | 'revolt',
|
10064 | 'revolver',
|
10065 | 'revolving',
|
10066 | 'reward',
|
10067 | 'rewash',
|
10068 | 'rewind',
|
10069 | 'rewire',
|
10070 | 'reword',
|
10071 | 'rework',
|
10072 | 'rewrap',
|
10073 | 'rewrite',
|
10074 | 'rhyme',
|
10075 | 'ribbon',
|
10076 | 'ribcage',
|
10077 | 'rice',
|
10078 | 'riches',
|
10079 | 'richly',
|
10080 | 'richness',
|
10081 | 'rickety',
|
10082 | 'ricotta',
|
10083 | 'riddance',
|
10084 | 'ridden',
|
10085 | 'ride',
|
10086 | 'riding',
|
10087 | 'rifling',
|
10088 | 'rift',
|
10089 | 'rigging',
|
10090 | 'rigid',
|
10091 | 'rigor',
|
10092 | 'rimless',
|
10093 | 'rimmed',
|
10094 | 'rind',
|
10095 | 'rink',
|
10096 | 'rinse',
|
10097 | 'rinsing',
|
10098 | 'riot',
|
10099 | 'ripcord',
|
10100 | 'ripeness',
|
10101 | 'ripening',
|
10102 | 'ripping',
|
10103 | 'ripple',
|
10104 | 'rippling',
|
10105 | 'riptide',
|
10106 | 'rise',
|
10107 | 'rising',
|
10108 | 'risk',
|
10109 | 'risotto',
|
10110 | 'ritalin',
|
10111 | 'ritzy',
|
10112 | 'rival',
|
10113 | 'riverbank',
|
10114 | 'riverbed',
|
10115 | 'riverboat',
|
10116 | 'riverside',
|
10117 | 'riveter',
|
10118 | 'riveting',
|
10119 | 'roamer',
|
10120 | 'roaming',
|
10121 | 'roast',
|
10122 | 'robbing',
|
10123 | 'robe',
|
10124 | 'robin',
|
10125 | 'robotics',
|
10126 | 'robust',
|
10127 | 'rockband',
|
10128 | 'rocker',
|
10129 | 'rocket',
|
10130 | 'rockfish',
|
10131 | 'rockiness',
|
10132 | 'rocking',
|
10133 | 'rocklike',
|
10134 | 'rockslide',
|
10135 | 'rockstar',
|
10136 | 'rocky',
|
10137 | 'rogue',
|
10138 | 'roman',
|
10139 | 'romp',
|
10140 | 'rope',
|
10141 | 'roping',
|
10142 | 'roster',
|
10143 | 'rosy',
|
10144 | 'rotten',
|
10145 | 'rotting',
|
10146 | 'rotunda',
|
10147 | 'roulette',
|
10148 | 'rounding',
|
10149 | 'roundish',
|
10150 | 'roundness',
|
10151 | 'roundup',
|
10152 | 'roundworm',
|
10153 | 'routine',
|
10154 | 'routing',
|
10155 | 'rover',
|
10156 | 'roving',
|
10157 | 'royal',
|
10158 | 'rubbed',
|
10159 | 'rubber',
|
10160 | 'rubbing',
|
10161 | 'rubble',
|
10162 | 'rubdown',
|
10163 | 'ruby',
|
10164 | 'ruckus',
|
10165 | 'rudder',
|
10166 | 'rug',
|
10167 | 'ruined',
|
10168 | 'rule',
|
10169 | 'rumble',
|
10170 | 'rumbling',
|
10171 | 'rummage',
|
10172 | 'rumor',
|
10173 | 'runaround',
|
10174 | 'rundown',
|
10175 | 'runner',
|
10176 | 'running',
|
10177 | 'runny',
|
10178 | 'runt',
|
10179 | 'runway',
|
10180 | 'rupture',
|
10181 | 'rural',
|
10182 | 'ruse',
|
10183 | 'rush',
|
10184 | 'rust',
|
10185 | 'rut',
|
10186 | 'sabbath',
|
10187 | 'sabotage',
|
10188 | 'sacrament',
|
10189 | 'sacred',
|
10190 | 'sacrifice',
|
10191 | 'sadden',
|
10192 | 'saddlebag',
|
10193 | 'saddled',
|
10194 | 'saddling',
|
10195 | 'sadly',
|
10196 | 'sadness',
|
10197 | 'safari',
|
10198 | 'safeguard',
|
10199 | 'safehouse',
|
10200 | 'safely',
|
10201 | 'safeness',
|
10202 | 'saffron',
|
10203 | 'saga',
|
10204 | 'sage',
|
10205 | 'sagging',
|
10206 | 'saggy',
|
10207 | 'said',
|
10208 | 'saint',
|
10209 | 'sake',
|
10210 | 'salad',
|
10211 | 'salami',
|
10212 | 'salaried',
|
10213 | 'salary',
|
10214 | 'saline',
|
10215 | 'salon',
|
10216 | 'saloon',
|
10217 | 'salsa',
|
10218 | 'salt',
|
10219 | 'salutary',
|
10220 | 'salute',
|
10221 | 'salvage',
|
10222 | 'salvaging',
|
10223 | 'salvation',
|
10224 | 'same',
|
10225 | 'sample',
|
10226 | 'sampling',
|
10227 | 'sanction',
|
10228 | 'sanctity',
|
10229 | 'sanctuary',
|
10230 | 'sandal',
|
10231 | 'sandbag',
|
10232 | 'sandbank',
|
10233 | 'sandbar',
|
10234 | 'sandblast',
|
10235 | 'sandbox',
|
10236 | 'sanded',
|
10237 | 'sandfish',
|
10238 | 'sanding',
|
10239 | 'sandlot',
|
10240 | 'sandpaper',
|
10241 | 'sandpit',
|
10242 | 'sandstone',
|
10243 | 'sandstorm',
|
10244 | 'sandworm',
|
10245 | 'sandy',
|
10246 | 'sanitary',
|
10247 | 'sanitizer',
|
10248 | 'sank',
|
10249 | 'santa',
|
10250 | 'sapling',
|
10251 | 'sappiness',
|
10252 | 'sappy',
|
10253 | 'sarcasm',
|
10254 | 'sarcastic',
|
10255 | 'sardine',
|
10256 | 'sash',
|
10257 | 'sasquatch',
|
10258 | 'sassy',
|
10259 | 'satchel',
|
10260 | 'satiable',
|
10261 | 'satin',
|
10262 | 'satirical',
|
10263 | 'satisfied',
|
10264 | 'satisfy',
|
10265 | 'saturate',
|
10266 | 'saturday',
|
10267 | 'sauciness',
|
10268 | 'saucy',
|
10269 | 'sauna',
|
10270 | 'savage',
|
10271 | 'savanna',
|
10272 | 'saved',
|
10273 | 'savings',
|
10274 | 'savior',
|
10275 | 'savor',
|
10276 | 'saxophone',
|
10277 | 'say',
|
10278 | 'scabbed',
|
10279 | 'scabby',
|
10280 | 'scalded',
|
10281 | 'scalding',
|
10282 | 'scale',
|
10283 | 'scaling',
|
10284 | 'scallion',
|
10285 | 'scallop',
|
10286 | 'scalping',
|
10287 | 'scam',
|
10288 | 'scandal',
|
10289 | 'scanner',
|
10290 | 'scanning',
|
10291 | 'scant',
|
10292 | 'scapegoat',
|
10293 | 'scarce',
|
10294 | 'scarcity',
|
10295 | 'scarecrow',
|
10296 | 'scared',
|
10297 | 'scarf',
|
10298 | 'scarily',
|
10299 | 'scariness',
|
10300 | 'scarring',
|
10301 | 'scary',
|
10302 | 'scavenger',
|
10303 | 'scenic',
|
10304 | 'schedule',
|
10305 | 'schematic',
|
10306 | 'scheme',
|
10307 | 'scheming',
|
10308 | 'schilling',
|
10309 | 'schnapps',
|
10310 | 'scholar',
|
10311 | 'science',
|
10312 | 'scientist',
|
10313 | 'scion',
|
10314 | 'scoff',
|
10315 | 'scolding',
|
10316 | 'scone',
|
10317 | 'scoop',
|
10318 | 'scooter',
|
10319 | 'scope',
|
10320 | 'scorch',
|
10321 | 'scorebook',
|
10322 | 'scorecard',
|
10323 | 'scored',
|
10324 | 'scoreless',
|
10325 | 'scorer',
|
10326 | 'scoring',
|
10327 | 'scorn',
|
10328 | 'scorpion',
|
10329 | 'scotch',
|
10330 | 'scoundrel',
|
10331 | 'scoured',
|
10332 | 'scouring',
|
10333 | 'scouting',
|
10334 | 'scouts',
|
10335 | 'scowling',
|
10336 | 'scrabble',
|
10337 | 'scraggly',
|
10338 | 'scrambled',
|
10339 | 'scrambler',
|
10340 | 'scrap',
|
10341 | 'scratch',
|
10342 | 'scrawny',
|
10343 | 'screen',
|
10344 | 'scribble',
|
10345 | 'scribe',
|
10346 | 'scribing',
|
10347 | 'scrimmage',
|
10348 | 'script',
|
10349 | 'scroll',
|
10350 | 'scrooge',
|
10351 | 'scrounger',
|
10352 | 'scrubbed',
|
10353 | 'scrubber',
|
10354 | 'scruffy',
|
10355 | 'scrunch',
|
10356 | 'scrutiny',
|
10357 | 'scuba',
|
10358 | 'scuff',
|
10359 | 'sculptor',
|
10360 | 'sculpture',
|
10361 | 'scurvy',
|
10362 | 'scuttle',
|
10363 | 'secluded',
|
10364 | 'secluding',
|
10365 | 'seclusion',
|
10366 | 'second',
|
10367 | 'secrecy',
|
10368 | 'secret',
|
10369 | 'sectional',
|
10370 | 'sector',
|
10371 | 'secular',
|
10372 | 'securely',
|
10373 | 'security',
|
10374 | 'sedan',
|
10375 | 'sedate',
|
10376 | 'sedation',
|
10377 | 'sedative',
|
10378 | 'sediment',
|
10379 | 'seduce',
|
10380 | 'seducing',
|
10381 | 'segment',
|
10382 | 'seismic',
|
10383 | 'seizing',
|
10384 | 'seldom',
|
10385 | 'selected',
|
10386 | 'selection',
|
10387 | 'selective',
|
10388 | 'selector',
|
10389 | 'self',
|
10390 | 'seltzer',
|
10391 | 'semantic',
|
10392 | 'semester',
|
10393 | 'semicolon',
|
10394 | 'semifinal',
|
10395 | 'seminar',
|
10396 | 'semisoft',
|
10397 | 'semisweet',
|
10398 | 'senate',
|
10399 | 'senator',
|
10400 | 'send',
|
10401 | 'senior',
|
10402 | 'senorita',
|
10403 | 'sensation',
|
10404 | 'sensitive',
|
10405 | 'sensitize',
|
10406 | 'sensually',
|
10407 | 'sensuous',
|
10408 | 'sepia',
|
10409 | 'september',
|
10410 | 'septic',
|
10411 | 'septum',
|
10412 | 'sequel',
|
10413 | 'sequence',
|
10414 | 'sequester',
|
10415 | 'series',
|
10416 | 'sermon',
|
10417 | 'serotonin',
|
10418 | 'serpent',
|
10419 | 'serrated',
|
10420 | 'serve',
|
10421 | 'service',
|
10422 | 'serving',
|
10423 | 'sesame',
|
10424 | 'sessions',
|
10425 | 'setback',
|
10426 | 'setting',
|
10427 | 'settle',
|
10428 | 'settling',
|
10429 | 'setup',
|
10430 | 'sevenfold',
|
10431 | 'seventeen',
|
10432 | 'seventh',
|
10433 | 'seventy',
|
10434 | 'severity',
|
10435 | 'shabby',
|
10436 | 'shack',
|
10437 | 'shaded',
|
10438 | 'shadily',
|
10439 | 'shadiness',
|
10440 | 'shading',
|
10441 | 'shadow',
|
10442 | 'shady',
|
10443 | 'shaft',
|
10444 | 'shakable',
|
10445 | 'shakily',
|
10446 | 'shakiness',
|
10447 | 'shaking',
|
10448 | 'shaky',
|
10449 | 'shale',
|
10450 | 'shallot',
|
10451 | 'shallow',
|
10452 | 'shame',
|
10453 | 'shampoo',
|
10454 | 'shamrock',
|
10455 | 'shank',
|
10456 | 'shanty',
|
10457 | 'shape',
|
10458 | 'shaping',
|
10459 | 'share',
|
10460 | 'sharpener',
|
10461 | 'sharper',
|
10462 | 'sharpie',
|
10463 | 'sharply',
|
10464 | 'sharpness',
|
10465 | 'shawl',
|
10466 | 'sheath',
|
10467 | 'shed',
|
10468 | 'sheep',
|
10469 | 'sheet',
|
10470 | 'shelf',
|
10471 | 'shell',
|
10472 | 'shelter',
|
10473 | 'shelve',
|
10474 | 'shelving',
|
10475 | 'sherry',
|
10476 | 'shield',
|
10477 | 'shifter',
|
10478 | 'shifting',
|
10479 | 'shiftless',
|
10480 | 'shifty',
|
10481 | 'shimmer',
|
10482 | 'shimmy',
|
10483 | 'shindig',
|
10484 | 'shine',
|
10485 | 'shingle',
|
10486 | 'shininess',
|
10487 | 'shining',
|
10488 | 'shiny',
|
10489 | 'ship',
|
10490 | 'shirt',
|
10491 | 'shivering',
|
10492 | 'shock',
|
10493 | 'shone',
|
10494 | 'shoplift',
|
10495 | 'shopper',
|
10496 | 'shopping',
|
10497 | 'shoptalk',
|
10498 | 'shore',
|
10499 | 'shortage',
|
10500 | 'shortcake',
|
10501 | 'shortcut',
|
10502 | 'shorten',
|
10503 | 'shorter',
|
10504 | 'shorthand',
|
10505 | 'shortlist',
|
10506 | 'shortly',
|
10507 | 'shortness',
|
10508 | 'shorts',
|
10509 | 'shortwave',
|
10510 | 'shorty',
|
10511 | 'shout',
|
10512 | 'shove',
|
10513 | 'showbiz',
|
10514 | 'showcase',
|
10515 | 'showdown',
|
10516 | 'shower',
|
10517 | 'showgirl',
|
10518 | 'showing',
|
10519 | 'showman',
|
10520 | 'shown',
|
10521 | 'showoff',
|
10522 | 'showpiece',
|
10523 | 'showplace',
|
10524 | 'showroom',
|
10525 | 'showy',
|
10526 | 'shrank',
|
10527 | 'shrapnel',
|
10528 | 'shredder',
|
10529 | 'shredding',
|
10530 | 'shrewdly',
|
10531 | 'shriek',
|
10532 | 'shrill',
|
10533 | 'shrimp',
|
10534 | 'shrine',
|
10535 | 'shrink',
|
10536 | 'shrivel',
|
10537 | 'shrouded',
|
10538 | 'shrubbery',
|
10539 | 'shrubs',
|
10540 | 'shrug',
|
10541 | 'shrunk',
|
10542 | 'shucking',
|
10543 | 'shudder',
|
10544 | 'shuffle',
|
10545 | 'shuffling',
|
10546 | 'shun',
|
10547 | 'shush',
|
10548 | 'shut',
|
10549 | 'shy',
|
10550 | 'siamese',
|
10551 | 'siberian',
|
10552 | 'sibling',
|
10553 | 'siding',
|
10554 | 'sierra',
|
10555 | 'siesta',
|
10556 | 'sift',
|
10557 | 'sighing',
|
10558 | 'silenced',
|
10559 | 'silencer',
|
10560 | 'silent',
|
10561 | 'silica',
|
10562 | 'silicon',
|
10563 | 'silk',
|
10564 | 'silliness',
|
10565 | 'silly',
|
10566 | 'silo',
|
10567 | 'silt',
|
10568 | 'silver',
|
10569 | 'similarly',
|
10570 | 'simile',
|
10571 | 'simmering',
|
10572 | 'simple',
|
10573 | 'simplify',
|
10574 | 'simply',
|
10575 | 'sincere',
|
10576 | 'sincerity',
|
10577 | 'singer',
|
10578 | 'singing',
|
10579 | 'single',
|
10580 | 'singular',
|
10581 | 'sinister',
|
10582 | 'sinless',
|
10583 | 'sinner',
|
10584 | 'sinuous',
|
10585 | 'sip',
|
10586 | 'siren',
|
10587 | 'sister',
|
10588 | 'sitcom',
|
10589 | 'sitter',
|
10590 | 'sitting',
|
10591 | 'situated',
|
10592 | 'situation',
|
10593 | 'sixfold',
|
10594 | 'sixteen',
|
10595 | 'sixth',
|
10596 | 'sixties',
|
10597 | 'sixtieth',
|
10598 | 'sixtyfold',
|
10599 | 'sizable',
|
10600 | 'sizably',
|
10601 | 'size',
|
10602 | 'sizing',
|
10603 | 'sizzle',
|
10604 | 'sizzling',
|
10605 | 'skater',
|
10606 | 'skating',
|
10607 | 'skedaddle',
|
10608 | 'skeletal',
|
10609 | 'skeleton',
|
10610 | 'skeptic',
|
10611 | 'sketch',
|
10612 | 'skewed',
|
10613 | 'skewer',
|
10614 | 'skid',
|
10615 | 'skied',
|
10616 | 'skier',
|
10617 | 'skies',
|
10618 | 'skiing',
|
10619 | 'skilled',
|
10620 | 'skillet',
|
10621 | 'skillful',
|
10622 | 'skimmed',
|
10623 | 'skimmer',
|
10624 | 'skimming',
|
10625 | 'skimpily',
|
10626 | 'skincare',
|
10627 | 'skinhead',
|
10628 | 'skinless',
|
10629 | 'skinning',
|
10630 | 'skinny',
|
10631 | 'skintight',
|
10632 | 'skipper',
|
10633 | 'skipping',
|
10634 | 'skirmish',
|
10635 | 'skirt',
|
10636 | 'skittle',
|
10637 | 'skydiver',
|
10638 | 'skylight',
|
10639 | 'skyline',
|
10640 | 'skype',
|
10641 | 'skyrocket',
|
10642 | 'skyward',
|
10643 | 'slab',
|
10644 | 'slacked',
|
10645 | 'slacker',
|
10646 | 'slacking',
|
10647 | 'slackness',
|
10648 | 'slacks',
|
10649 | 'slain',
|
10650 | 'slam',
|
10651 | 'slander',
|
10652 | 'slang',
|
10653 | 'slapping',
|
10654 | 'slapstick',
|
10655 | 'slashed',
|
10656 | 'slashing',
|
10657 | 'slate',
|
10658 | 'slather',
|
10659 | 'slaw',
|
10660 | 'sled',
|
10661 | 'sleek',
|
10662 | 'sleep',
|
10663 | 'sleet',
|
10664 | 'sleeve',
|
10665 | 'slept',
|
10666 | 'sliceable',
|
10667 | 'sliced',
|
10668 | 'slicer',
|
10669 | 'slicing',
|
10670 | 'slick',
|
10671 | 'slider',
|
10672 | 'slideshow',
|
10673 | 'sliding',
|
10674 | 'slighted',
|
10675 | 'slighting',
|
10676 | 'slightly',
|
10677 | 'slimness',
|
10678 | 'slimy',
|
10679 | 'slinging',
|
10680 | 'slingshot',
|
10681 | 'slinky',
|
10682 | 'slip',
|
10683 | 'slit',
|
10684 | 'sliver',
|
10685 | 'slobbery',
|
10686 | 'slogan',
|
10687 | 'sloped',
|
10688 | 'sloping',
|
10689 | 'sloppily',
|
10690 | 'sloppy',
|
10691 | 'slot',
|
10692 | 'slouching',
|
10693 | 'slouchy',
|
10694 | 'sludge',
|
10695 | 'slug',
|
10696 | 'slum',
|
10697 | 'slurp',
|
10698 | 'slush',
|
10699 | 'sly',
|
10700 | 'small',
|
10701 | 'smartly',
|
10702 | 'smartness',
|
10703 | 'smasher',
|
10704 | 'smashing',
|
10705 | 'smashup',
|
10706 | 'smell',
|
10707 | 'smelting',
|
10708 | 'smile',
|
10709 | 'smilingly',
|
10710 | 'smirk',
|
10711 | 'smite',
|
10712 | 'smith',
|
10713 | 'smitten',
|
10714 | 'smock',
|
10715 | 'smog',
|
10716 | 'smoked',
|
10717 | 'smokeless',
|
10718 | 'smokiness',
|
10719 | 'smoking',
|
10720 | 'smoky',
|
10721 | 'smolder',
|
10722 | 'smooth',
|
10723 | 'smother',
|
10724 | 'smudge',
|
10725 | 'smudgy',
|
10726 | 'smuggler',
|
10727 | 'smuggling',
|
10728 | 'smugly',
|
10729 | 'smugness',
|
10730 | 'snack',
|
10731 | 'snagged',
|
10732 | 'snaking',
|
10733 | 'snap',
|
10734 | 'snare',
|
10735 | 'snarl',
|
10736 | 'snazzy',
|
10737 | 'sneak',
|
10738 | 'sneer',
|
10739 | 'sneeze',
|
10740 | 'sneezing',
|
10741 | 'snide',
|
10742 | 'sniff',
|
10743 | 'snippet',
|
10744 | 'snipping',
|
10745 | 'snitch',
|
10746 | 'snooper',
|
10747 | 'snooze',
|
10748 | 'snore',
|
10749 | 'snoring',
|
10750 | 'snorkel',
|
10751 | 'snort',
|
10752 | 'snout',
|
10753 | 'snowbird',
|
10754 | 'snowboard',
|
10755 | 'snowbound',
|
10756 | 'snowcap',
|
10757 | 'snowdrift',
|
10758 | 'snowdrop',
|
10759 | 'snowfall',
|
10760 | 'snowfield',
|
10761 | 'snowflake',
|
10762 | 'snowiness',
|
10763 | 'snowless',
|
10764 | 'snowman',
|
10765 | 'snowplow',
|
10766 | 'snowshoe',
|
10767 | 'snowstorm',
|
10768 | 'snowsuit',
|
10769 | 'snowy',
|
10770 | 'snub',
|
10771 | 'snuff',
|
10772 | 'snuggle',
|
10773 | 'snugly',
|
10774 | 'snugness',
|
10775 | 'speak',
|
10776 | 'spearfish',
|
10777 | 'spearhead',
|
10778 | 'spearman',
|
10779 | 'spearmint',
|
10780 | 'species',
|
10781 | 'specimen',
|
10782 | 'specked',
|
10783 | 'speckled',
|
10784 | 'specks',
|
10785 | 'spectacle',
|
10786 | 'spectator',
|
10787 | 'spectrum',
|
10788 | 'speculate',
|
10789 | 'speech',
|
10790 | 'speed',
|
10791 | 'spellbind',
|
10792 | 'speller',
|
10793 | 'spelling',
|
10794 | 'spendable',
|
10795 | 'spender',
|
10796 | 'spending',
|
10797 | 'spent',
|
10798 | 'spew',
|
10799 | 'sphere',
|
10800 | 'spherical',
|
10801 | 'sphinx',
|
10802 | 'spider',
|
10803 | 'spied',
|
10804 | 'spiffy',
|
10805 | 'spill',
|
10806 | 'spilt',
|
10807 | 'spinach',
|
10808 | 'spinal',
|
10809 | 'spindle',
|
10810 | 'spinner',
|
10811 | 'spinning',
|
10812 | 'spinout',
|
10813 | 'spinster',
|
10814 | 'spiny',
|
10815 | 'spiral',
|
10816 | 'spirited',
|
10817 | 'spiritism',
|
10818 | 'spirits',
|
10819 | 'spiritual',
|
10820 | 'splashed',
|
10821 | 'splashing',
|
10822 | 'splashy',
|
10823 | 'splatter',
|
10824 | 'spleen',
|
10825 | 'splendid',
|
10826 | 'splendor',
|
10827 | 'splice',
|
10828 | 'splicing',
|
10829 | 'splinter',
|
10830 | 'splotchy',
|
10831 | 'splurge',
|
10832 | 'spoilage',
|
10833 | 'spoiled',
|
10834 | 'spoiler',
|
10835 | 'spoiling',
|
10836 | 'spoils',
|
10837 | 'spoken',
|
10838 | 'spokesman',
|
10839 | 'sponge',
|
10840 | 'spongy',
|
10841 | 'sponsor',
|
10842 | 'spoof',
|
10843 | 'spookily',
|
10844 | 'spooky',
|
10845 | 'spool',
|
10846 | 'spoon',
|
10847 | 'spore',
|
10848 | 'sporting',
|
10849 | 'sports',
|
10850 | 'sporty',
|
10851 | 'spotless',
|
10852 | 'spotlight',
|
10853 | 'spotted',
|
10854 | 'spotter',
|
10855 | 'spotting',
|
10856 | 'spotty',
|
10857 | 'spousal',
|
10858 | 'spouse',
|
10859 | 'spout',
|
10860 | 'sprain',
|
10861 | 'sprang',
|
10862 | 'sprawl',
|
10863 | 'spray',
|
10864 | 'spree',
|
10865 | 'sprig',
|
10866 | 'spring',
|
10867 | 'sprinkled',
|
10868 | 'sprinkler',
|
10869 | 'sprint',
|
10870 | 'sprite',
|
10871 | 'sprout',
|
10872 | 'spruce',
|
10873 | 'sprung',
|
10874 | 'spry',
|
10875 | 'spud',
|
10876 | 'spur',
|
10877 | 'sputter',
|
10878 | 'spyglass',
|
10879 | 'squabble',
|
10880 | 'squad',
|
10881 | 'squall',
|
10882 | 'squander',
|
10883 | 'squash',
|
10884 | 'squatted',
|
10885 | 'squatter',
|
10886 | 'squatting',
|
10887 | 'squeak',
|
10888 | 'squealer',
|
10889 | 'squealing',
|
10890 | 'squeamish',
|
10891 | 'squeegee',
|
10892 | 'squeeze',
|
10893 | 'squeezing',
|
10894 | 'squid',
|
10895 | 'squiggle',
|
10896 | 'squiggly',
|
10897 | 'squint',
|
10898 | 'squire',
|
10899 | 'squirt',
|
10900 | 'squishier',
|
10901 | 'squishy',
|
10902 | 'stability',
|
10903 | 'stabilize',
|
10904 | 'stable',
|
10905 | 'stack',
|
10906 | 'stadium',
|
10907 | 'staff',
|
10908 | 'stage',
|
10909 | 'staging',
|
10910 | 'stagnant',
|
10911 | 'stagnate',
|
10912 | 'stainable',
|
10913 | 'stained',
|
10914 | 'staining',
|
10915 | 'stainless',
|
10916 | 'stalemate',
|
10917 | 'staleness',
|
10918 | 'stalling',
|
10919 | 'stallion',
|
10920 | 'stamina',
|
10921 | 'stammer',
|
10922 | 'stamp',
|
10923 | 'stand',
|
10924 | 'stank',
|
10925 | 'staple',
|
10926 | 'stapling',
|
10927 | 'starboard',
|
10928 | 'starch',
|
10929 | 'stardom',
|
10930 | 'stardust',
|
10931 | 'starfish',
|
10932 | 'stargazer',
|
10933 | 'staring',
|
10934 | 'stark',
|
10935 | 'starless',
|
10936 | 'starlet',
|
10937 | 'starlight',
|
10938 | 'starlit',
|
10939 | 'starring',
|
10940 | 'starry',
|
10941 | 'starship',
|
10942 | 'starter',
|
10943 | 'starting',
|
10944 | 'startle',
|
10945 | 'startling',
|
10946 | 'startup',
|
10947 | 'starved',
|
10948 | 'starving',
|
10949 | 'stash',
|
10950 | 'state',
|
10951 | 'static',
|
10952 | 'statistic',
|
10953 | 'statue',
|
10954 | 'stature',
|
10955 | 'status',
|
10956 | 'statute',
|
10957 | 'statutory',
|
10958 | 'staunch',
|
10959 | 'stays',
|
10960 | 'steadfast',
|
10961 | 'steadier',
|
10962 | 'steadily',
|
10963 | 'steadying',
|
10964 | 'steam',
|
10965 | 'steed',
|
10966 | 'steep',
|
10967 | 'steerable',
|
10968 | 'steering',
|
10969 | 'steersman',
|
10970 | 'stegosaur',
|
10971 | 'stellar',
|
10972 | 'stem',
|
10973 | 'stench',
|
10974 | 'stencil',
|
10975 | 'step',
|
10976 | 'stereo',
|
10977 | 'sterile',
|
10978 | 'sterility',
|
10979 | 'sterilize',
|
10980 | 'sterling',
|
10981 | 'sternness',
|
10982 | 'sternum',
|
10983 | 'stew',
|
10984 | 'stick',
|
10985 | 'stiffen',
|
10986 | 'stiffly',
|
10987 | 'stiffness',
|
10988 | 'stifle',
|
10989 | 'stifling',
|
10990 | 'stillness',
|
10991 | 'stilt',
|
10992 | 'stimulant',
|
10993 | 'stimulate',
|
10994 | 'stimuli',
|
10995 | 'stimulus',
|
10996 | 'stinger',
|
10997 | 'stingily',
|
10998 | 'stinging',
|
10999 | 'stingray',
|
11000 | 'stingy',
|
11001 | 'stinking',
|
11002 | 'stinky',
|
11003 | 'stipend',
|
11004 | 'stipulate',
|
11005 | 'stir',
|
11006 | 'stitch',
|
11007 | 'stock',
|
11008 | 'stoic',
|
11009 | 'stoke',
|
11010 | 'stole',
|
11011 | 'stomp',
|
11012 | 'stonewall',
|
11013 | 'stoneware',
|
11014 | 'stonework',
|
11015 | 'stoning',
|
11016 | 'stony',
|
11017 | 'stood',
|
11018 | 'stooge',
|
11019 | 'stool',
|
11020 | 'stoop',
|
11021 | 'stoplight',
|
11022 | 'stoppable',
|
11023 | 'stoppage',
|
11024 | 'stopped',
|
11025 | 'stopper',
|
11026 | 'stopping',
|
11027 | 'stopwatch',
|
11028 | 'storable',
|
11029 | 'storage',
|
11030 | 'storeroom',
|
11031 | 'storewide',
|
11032 | 'storm',
|
11033 | 'stout',
|
11034 | 'stove',
|
11035 | 'stowaway',
|
11036 | 'stowing',
|
11037 | 'straddle',
|
11038 | 'straggler',
|
11039 | 'strained',
|
11040 | 'strainer',
|
11041 | 'straining',
|
11042 | 'strangely',
|
11043 | 'stranger',
|
11044 | 'strangle',
|
11045 | 'strategic',
|
11046 | 'strategy',
|
11047 | 'stratus',
|
11048 | 'straw',
|
11049 | 'stray',
|
11050 | 'streak',
|
11051 | 'stream',
|
11052 | 'street',
|
11053 | 'strength',
|
11054 | 'strenuous',
|
11055 | 'strep',
|
11056 | 'stress',
|
11057 | 'stretch',
|
11058 | 'strewn',
|
11059 | 'stricken',
|
11060 | 'strict',
|
11061 | 'stride',
|
11062 | 'strife',
|
11063 | 'strike',
|
11064 | 'striking',
|
11065 | 'strive',
|
11066 | 'striving',
|
11067 | 'strobe',
|
11068 | 'strode',
|
11069 | 'stroller',
|
11070 | 'strongbox',
|
11071 | 'strongly',
|
11072 | 'strongman',
|
11073 | 'struck',
|
11074 | 'structure',
|
11075 | 'strudel',
|
11076 | 'struggle',
|
11077 | 'strum',
|
11078 | 'strung',
|
11079 | 'strut',
|
11080 | 'stubbed',
|
11081 | 'stubble',
|
11082 | 'stubbly',
|
11083 | 'stubborn',
|
11084 | 'stucco',
|
11085 | 'stuck',
|
11086 | 'student',
|
11087 | 'studied',
|
11088 | 'studio',
|
11089 | 'study',
|
11090 | 'stuffed',
|
11091 | 'stuffing',
|
11092 | 'stuffy',
|
11093 | 'stumble',
|
11094 | 'stumbling',
|
11095 | 'stump',
|
11096 | 'stung',
|
11097 | 'stunned',
|
11098 | 'stunner',
|
11099 | 'stunning',
|
11100 | 'stunt',
|
11101 | 'stupor',
|
11102 | 'sturdily',
|
11103 | 'sturdy',
|
11104 | 'styling',
|
11105 | 'stylishly',
|
11106 | 'stylist',
|
11107 | 'stylized',
|
11108 | 'stylus',
|
11109 | 'suave',
|
11110 | 'subarctic',
|
11111 | 'subatomic',
|
11112 | 'subdivide',
|
11113 | 'subdued',
|
11114 | 'subduing',
|
11115 | 'subfloor',
|
11116 | 'subgroup',
|
11117 | 'subheader',
|
11118 | 'subject',
|
11119 | 'sublease',
|
11120 | 'sublet',
|
11121 | 'sublevel',
|
11122 | 'sublime',
|
11123 | 'submarine',
|
11124 | 'submerge',
|
11125 | 'submersed',
|
11126 | 'submitter',
|
11127 | 'subpanel',
|
11128 | 'subpar',
|
11129 | 'subplot',
|
11130 | 'subprime',
|
11131 | 'subscribe',
|
11132 | 'subscript',
|
11133 | 'subsector',
|
11134 | 'subside',
|
11135 | 'subsiding',
|
11136 | 'subsidize',
|
11137 | 'subsidy',
|
11138 | 'subsoil',
|
11139 | 'subsonic',
|
11140 | 'substance',
|
11141 | 'subsystem',
|
11142 | 'subtext',
|
11143 | 'subtitle',
|
11144 | 'subtly',
|
11145 | 'subtotal',
|
11146 | 'subtract',
|
11147 | 'subtype',
|
11148 | 'suburb',
|
11149 | 'subway',
|
11150 | 'subwoofer',
|
11151 | 'subzero',
|
11152 | 'succulent',
|
11153 | 'such',
|
11154 | 'suction',
|
11155 | 'sudden',
|
11156 | 'sudoku',
|
11157 | 'suds',
|
11158 | 'sufferer',
|
11159 | 'suffering',
|
11160 | 'suffice',
|
11161 | 'suffix',
|
11162 | 'suffocate',
|
11163 | 'suffrage',
|
11164 | 'sugar',
|
11165 | 'suggest',
|
11166 | 'suing',
|
11167 | 'suitable',
|
11168 | 'suitably',
|
11169 | 'suitcase',
|
11170 | 'suitor',
|
11171 | 'sulfate',
|
11172 | 'sulfide',
|
11173 | 'sulfite',
|
11174 | 'sulfur',
|
11175 | 'sulk',
|
11176 | 'sullen',
|
11177 | 'sulphate',
|
11178 | 'sulphuric',
|
11179 | 'sultry',
|
11180 | 'superbowl',
|
11181 | 'superglue',
|
11182 | 'superhero',
|
11183 | 'superior',
|
11184 | 'superjet',
|
11185 | 'superman',
|
11186 | 'supermom',
|
11187 | 'supernova',
|
11188 | 'supervise',
|
11189 | 'supper',
|
11190 | 'supplier',
|
11191 | 'supply',
|
11192 | 'support',
|
11193 | 'supremacy',
|
11194 | 'supreme',
|
11195 | 'surcharge',
|
11196 | 'surely',
|
11197 | 'sureness',
|
11198 | 'surface',
|
11199 | 'surfacing',
|
11200 | 'surfboard',
|
11201 | 'surfer',
|
11202 | 'surgery',
|
11203 | 'surgical',
|
11204 | 'surging',
|
11205 | 'surname',
|
11206 | 'surpass',
|
11207 | 'surplus',
|
11208 | 'surprise',
|
11209 | 'surreal',
|
11210 | 'surrender',
|
11211 | 'surrogate',
|
11212 | 'surround',
|
11213 | 'survey',
|
11214 | 'survival',
|
11215 | 'survive',
|
11216 | 'surviving',
|
11217 | 'survivor',
|
11218 | 'sushi',
|
11219 | 'suspect',
|
11220 | 'suspend',
|
11221 | 'suspense',
|
11222 | 'sustained',
|
11223 | 'sustainer',
|
11224 | 'swab',
|
11225 | 'swaddling',
|
11226 | 'swagger',
|
11227 | 'swampland',
|
11228 | 'swan',
|
11229 | 'swapping',
|
11230 | 'swarm',
|
11231 | 'sway',
|
11232 | 'swear',
|
11233 | 'sweat',
|
11234 | 'sweep',
|
11235 | 'swell',
|
11236 | 'swept',
|
11237 | 'swerve',
|
11238 | 'swifter',
|
11239 | 'swiftly',
|
11240 | 'swiftness',
|
11241 | 'swimmable',
|
11242 | 'swimmer',
|
11243 | 'swimming',
|
11244 | 'swimsuit',
|
11245 | 'swimwear',
|
11246 | 'swinger',
|
11247 | 'swinging',
|
11248 | 'swipe',
|
11249 | 'swirl',
|
11250 | 'switch',
|
11251 | 'swivel',
|
11252 | 'swizzle',
|
11253 | 'swooned',
|
11254 | 'swoop',
|
11255 | 'swoosh',
|
11256 | 'swore',
|
11257 | 'sworn',
|
11258 | 'swung',
|
11259 | 'sycamore',
|
11260 | 'sympathy',
|
11261 | 'symphonic',
|
11262 | 'symphony',
|
11263 | 'symptom',
|
11264 | 'synapse',
|
11265 | 'syndrome',
|
11266 | 'synergy',
|
11267 | 'synopses',
|
11268 | 'synopsis',
|
11269 | 'synthesis',
|
11270 | 'synthetic',
|
11271 | 'syrup',
|
11272 | 'system',
|
11273 | 't-shirt',
|
11274 | 'tabasco',
|
11275 | 'tabby',
|
11276 | 'tableful',
|
11277 | 'tables',
|
11278 | 'tablet',
|
11279 | 'tableware',
|
11280 | 'tabloid',
|
11281 | 'tackiness',
|
11282 | 'tacking',
|
11283 | 'tackle',
|
11284 | 'tackling',
|
11285 | 'tacky',
|
11286 | 'taco',
|
11287 | 'tactful',
|
11288 | 'tactical',
|
11289 | 'tactics',
|
11290 | 'tactile',
|
11291 | 'tactless',
|
11292 | 'tadpole',
|
11293 | 'taekwondo',
|
11294 | 'tag',
|
11295 | 'tainted',
|
11296 | 'take',
|
11297 | 'taking',
|
11298 | 'talcum',
|
11299 | 'talisman',
|
11300 | 'tall',
|
11301 | 'talon',
|
11302 | 'tamale',
|
11303 | 'tameness',
|
11304 | 'tamer',
|
11305 | 'tamper',
|
11306 | 'tank',
|
11307 | 'tanned',
|
11308 | 'tannery',
|
11309 | 'tanning',
|
11310 | 'tantrum',
|
11311 | 'tapeless',
|
11312 | 'tapered',
|
11313 | 'tapering',
|
11314 | 'tapestry',
|
11315 | 'tapioca',
|
11316 | 'tapping',
|
11317 | 'taps',
|
11318 | 'tarantula',
|
11319 | 'target',
|
11320 | 'tarmac',
|
11321 | 'tarnish',
|
11322 | 'tarot',
|
11323 | 'tartar',
|
11324 | 'tartly',
|
11325 | 'tartness',
|
11326 | 'task',
|
11327 | 'tassel',
|
11328 | 'taste',
|
11329 | 'tastiness',
|
11330 | 'tasting',
|
11331 | 'tasty',
|
11332 | 'tattered',
|
11333 | 'tattle',
|
11334 | 'tattling',
|
11335 | 'tattoo',
|
11336 | 'taunt',
|
11337 | 'tavern',
|
11338 | 'thank',
|
11339 | 'that',
|
11340 | 'thaw',
|
11341 | 'theater',
|
11342 | 'theatrics',
|
11343 | 'thee',
|
11344 | 'theft',
|
11345 | 'theme',
|
11346 | 'theology',
|
11347 | 'theorize',
|
11348 | 'thermal',
|
11349 | 'thermos',
|
11350 | 'thesaurus',
|
11351 | 'these',
|
11352 | 'thesis',
|
11353 | 'thespian',
|
11354 | 'thicken',
|
11355 | 'thicket',
|
11356 | 'thickness',
|
11357 | 'thieving',
|
11358 | 'thievish',
|
11359 | 'thigh',
|
11360 | 'thimble',
|
11361 | 'thing',
|
11362 | 'think',
|
11363 | 'thinly',
|
11364 | 'thinner',
|
11365 | 'thinness',
|
11366 | 'thinning',
|
11367 | 'thirstily',
|
11368 | 'thirsting',
|
11369 | 'thirsty',
|
11370 | 'thirteen',
|
11371 | 'thirty',
|
11372 | 'thong',
|
11373 | 'thorn',
|
11374 | 'those',
|
11375 | 'thousand',
|
11376 | 'thrash',
|
11377 | 'thread',
|
11378 | 'threaten',
|
11379 | 'threefold',
|
11380 | 'thrift',
|
11381 | 'thrill',
|
11382 | 'thrive',
|
11383 | 'thriving',
|
11384 | 'throat',
|
11385 | 'throbbing',
|
11386 | 'throng',
|
11387 | 'throttle',
|
11388 | 'throwaway',
|
11389 | 'throwback',
|
11390 | 'thrower',
|
11391 | 'throwing',
|
11392 | 'thud',
|
11393 | 'thumb',
|
11394 | 'thumping',
|
11395 | 'thursday',
|
11396 | 'thus',
|
11397 | 'thwarting',
|
11398 | 'thyself',
|
11399 | 'tiara',
|
11400 | 'tibia',
|
11401 | 'tidal',
|
11402 | 'tidbit',
|
11403 | 'tidiness',
|
11404 | 'tidings',
|
11405 | 'tidy',
|
11406 | 'tiger',
|
11407 | 'tighten',
|
11408 | 'tightly',
|
11409 | 'tightness',
|
11410 | 'tightrope',
|
11411 | 'tightwad',
|
11412 | 'tigress',
|
11413 | 'tile',
|
11414 | 'tiling',
|
11415 | 'till',
|
11416 | 'tilt',
|
11417 | 'timid',
|
11418 | 'timing',
|
11419 | 'timothy',
|
11420 | 'tinderbox',
|
11421 | 'tinfoil',
|
11422 | 'tingle',
|
11423 | 'tingling',
|
11424 | 'tingly',
|
11425 | 'tinker',
|
11426 | 'tinkling',
|
11427 | 'tinsel',
|
11428 | 'tinsmith',
|
11429 | 'tint',
|
11430 | 'tinwork',
|
11431 | 'tiny',
|
11432 | 'tipoff',
|
11433 | 'tipped',
|
11434 | 'tipper',
|
11435 | 'tipping',
|
11436 | 'tiptoeing',
|
11437 | 'tiptop',
|
11438 | 'tiring',
|
11439 | 'tissue',
|
11440 | 'trace',
|
11441 | 'tracing',
|
11442 | 'track',
|
11443 | 'traction',
|
11444 | 'tractor',
|
11445 | 'trade',
|
11446 | 'trading',
|
11447 | 'tradition',
|
11448 | 'traffic',
|
11449 | 'tragedy',
|
11450 | 'trailing',
|
11451 | 'trailside',
|
11452 | 'train',
|
11453 | 'traitor',
|
11454 | 'trance',
|
11455 | 'tranquil',
|
11456 | 'transfer',
|
11457 | 'transform',
|
11458 | 'translate',
|
11459 | 'transpire',
|
11460 | 'transport',
|
11461 | 'transpose',
|
11462 | 'trapdoor',
|
11463 | 'trapeze',
|
11464 | 'trapezoid',
|
11465 | 'trapped',
|
11466 | 'trapper',
|
11467 | 'trapping',
|
11468 | 'traps',
|
11469 | 'trash',
|
11470 | 'travel',
|
11471 | 'traverse',
|
11472 | 'travesty',
|
11473 | 'tray',
|
11474 | 'treachery',
|
11475 | 'treading',
|
11476 | 'treadmill',
|
11477 | 'treason',
|
11478 | 'treat',
|
11479 | 'treble',
|
11480 | 'tree',
|
11481 | 'trekker',
|
11482 | 'tremble',
|
11483 | 'trembling',
|
11484 | 'tremor',
|
11485 | 'trench',
|
11486 | 'trend',
|
11487 | 'trespass',
|
11488 | 'triage',
|
11489 | 'trial',
|
11490 | 'triangle',
|
11491 | 'tribesman',
|
11492 | 'tribunal',
|
11493 | 'tribune',
|
11494 | 'tributary',
|
11495 | 'tribute',
|
11496 | 'triceps',
|
11497 | 'trickery',
|
11498 | 'trickily',
|
11499 | 'tricking',
|
11500 | 'trickle',
|
11501 | 'trickster',
|
11502 | 'tricky',
|
11503 | 'tricolor',
|
11504 | 'tricycle',
|
11505 | 'trident',
|
11506 | 'tried',
|
11507 | 'trifle',
|
11508 | 'trifocals',
|
11509 | 'trillion',
|
11510 | 'trilogy',
|
11511 | 'trimester',
|
11512 | 'trimmer',
|
11513 | 'trimming',
|
11514 | 'trimness',
|
11515 | 'trinity',
|
11516 | 'trio',
|
11517 | 'tripod',
|
11518 | 'tripping',
|
11519 | 'triumph',
|
11520 | 'trivial',
|
11521 | 'trodden',
|
11522 | 'trolling',
|
11523 | 'trombone',
|
11524 | 'trophy',
|
11525 | 'tropical',
|
11526 | 'tropics',
|
11527 | 'trouble',
|
11528 | 'troubling',
|
11529 | 'trough',
|
11530 | 'trousers',
|
11531 | 'trout',
|
11532 | 'trowel',
|
11533 | 'truce',
|
11534 | 'truck',
|
11535 | 'truffle',
|
11536 | 'trump',
|
11537 | 'trunks',
|
11538 | 'trustable',
|
11539 | 'trustee',
|
11540 | 'trustful',
|
11541 | 'trusting',
|
11542 | 'trustless',
|
11543 | 'truth',
|
11544 | 'try',
|
11545 | 'tubby',
|
11546 | 'tubeless',
|
11547 | 'tubular',
|
11548 | 'tucking',
|
11549 | 'tuesday',
|
11550 | 'tug',
|
11551 | 'tuition',
|
11552 | 'tulip',
|
11553 | 'tumble',
|
11554 | 'tumbling',
|
11555 | 'tummy',
|
11556 | 'turban',
|
11557 | 'turbine',
|
11558 | 'turbofan',
|
11559 | 'turbojet',
|
11560 | 'turbulent',
|
11561 | 'turf',
|
11562 | 'turkey',
|
11563 | 'turmoil',
|
11564 | 'turret',
|
11565 | 'turtle',
|
11566 | 'tusk',
|
11567 | 'tutor',
|
11568 | 'tutu',
|
11569 | 'tux',
|
11570 | 'tweak',
|
11571 | 'tweed',
|
11572 | 'tweet',
|
11573 | 'tweezers',
|
11574 | 'twelve',
|
11575 | 'twentieth',
|
11576 | 'twenty',
|
11577 | 'twerp',
|
11578 | 'twice',
|
11579 | 'twiddle',
|
11580 | 'twiddling',
|
11581 | 'twig',
|
11582 | 'twilight',
|
11583 | 'twine',
|
11584 | 'twins',
|
11585 | 'twirl',
|
11586 | 'twistable',
|
11587 | 'twisted',
|
11588 | 'twister',
|
11589 | 'twisting',
|
11590 | 'twisty',
|
11591 | 'twitch',
|
11592 | 'twitter',
|
11593 | 'tycoon',
|
11594 | 'tying',
|
11595 | 'tyke',
|
11596 | 'udder',
|
11597 | 'ultimate',
|
11598 | 'ultimatum',
|
11599 | 'ultra',
|
11600 | 'umbilical',
|
11601 | 'umbrella',
|
11602 | 'umpire',
|
11603 | 'unabashed',
|
11604 | 'unable',
|
11605 | 'unadorned',
|
11606 | 'unadvised',
|
11607 | 'unafraid',
|
11608 | 'unaired',
|
11609 | 'unaligned',
|
11610 | 'unaltered',
|
11611 | 'unarmored',
|
11612 | 'unashamed',
|
11613 | 'unaudited',
|
11614 | 'unawake',
|
11615 | 'unaware',
|
11616 | 'unbaked',
|
11617 | 'unbalance',
|
11618 | 'unbeaten',
|
11619 | 'unbend',
|
11620 | 'unbent',
|
11621 | 'unbiased',
|
11622 | 'unbitten',
|
11623 | 'unblended',
|
11624 | 'unblessed',
|
11625 | 'unblock',
|
11626 | 'unbolted',
|
11627 | 'unbounded',
|
11628 | 'unboxed',
|
11629 | 'unbraided',
|
11630 | 'unbridle',
|
11631 | 'unbroken',
|
11632 | 'unbuckled',
|
11633 | 'unbundle',
|
11634 | 'unburned',
|
11635 | 'unbutton',
|
11636 | 'uncanny',
|
11637 | 'uncapped',
|
11638 | 'uncaring',
|
11639 | 'uncertain',
|
11640 | 'unchain',
|
11641 | 'unchanged',
|
11642 | 'uncharted',
|
11643 | 'uncheck',
|
11644 | 'uncivil',
|
11645 | 'unclad',
|
11646 | 'unclaimed',
|
11647 | 'unclamped',
|
11648 | 'unclasp',
|
11649 | 'uncle',
|
11650 | 'unclip',
|
11651 | 'uncloak',
|
11652 | 'unclog',
|
11653 | 'unclothed',
|
11654 | 'uncoated',
|
11655 | 'uncoiled',
|
11656 | 'uncolored',
|
11657 | 'uncombed',
|
11658 | 'uncommon',
|
11659 | 'uncooked',
|
11660 | 'uncork',
|
11661 | 'uncorrupt',
|
11662 | 'uncounted',
|
11663 | 'uncouple',
|
11664 | 'uncouth',
|
11665 | 'uncover',
|
11666 | 'uncross',
|
11667 | 'uncrown',
|
11668 | 'uncrushed',
|
11669 | 'uncured',
|
11670 | 'uncurious',
|
11671 | 'uncurled',
|
11672 | 'uncut',
|
11673 | 'undamaged',
|
11674 | 'undated',
|
11675 | 'undaunted',
|
11676 | 'undead',
|
11677 | 'undecided',
|
11678 | 'undefined',
|
11679 | 'underage',
|
11680 | 'underarm',
|
11681 | 'undercoat',
|
11682 | 'undercook',
|
11683 | 'undercut',
|
11684 | 'underdog',
|
11685 | 'underdone',
|
11686 | 'underfed',
|
11687 | 'underfeed',
|
11688 | 'underfoot',
|
11689 | 'undergo',
|
11690 | 'undergrad',
|
11691 | 'underhand',
|
11692 | 'underline',
|
11693 | 'underling',
|
11694 | 'undermine',
|
11695 | 'undermost',
|
11696 | 'underpaid',
|
11697 | 'underpass',
|
11698 | 'underpay',
|
11699 | 'underrate',
|
11700 | 'undertake',
|
11701 | 'undertone',
|
11702 | 'undertook',
|
11703 | 'undertow',
|
11704 | 'underuse',
|
11705 | 'underwear',
|
11706 | 'underwent',
|
11707 | 'underwire',
|
11708 | 'undesired',
|
11709 | 'undiluted',
|
11710 | 'undivided',
|
11711 | 'undocked',
|
11712 | 'undoing',
|
11713 | 'undone',
|
11714 | 'undrafted',
|
11715 | 'undress',
|
11716 | 'undrilled',
|
11717 | 'undusted',
|
11718 | 'undying',
|
11719 | 'unearned',
|
11720 | 'unearth',
|
11721 | 'unease',
|
11722 | 'uneasily',
|
11723 | 'uneasy',
|
11724 | 'uneatable',
|
11725 | 'uneaten',
|
11726 | 'unedited',
|
11727 | 'unelected',
|
11728 | 'unending',
|
11729 | 'unengaged',
|
11730 | 'unenvied',
|
11731 | 'unequal',
|
11732 | 'unethical',
|
11733 | 'uneven',
|
11734 | 'unexpired',
|
11735 | 'unexposed',
|
11736 | 'unfailing',
|
11737 | 'unfair',
|
11738 | 'unfasten',
|
11739 | 'unfazed',
|
11740 | 'unfeeling',
|
11741 | 'unfiled',
|
11742 | 'unfilled',
|
11743 | 'unfitted',
|
11744 | 'unfitting',
|
11745 | 'unfixable',
|
11746 | 'unfixed',
|
11747 | 'unflawed',
|
11748 | 'unfocused',
|
11749 | 'unfold',
|
11750 | 'unfounded',
|
11751 | 'unframed',
|
11752 | 'unfreeze',
|
11753 | 'unfrosted',
|
11754 | 'unfrozen',
|
11755 | 'unfunded',
|
11756 | 'unglazed',
|
11757 | 'ungloved',
|
11758 | 'unglue',
|
11759 | 'ungodly',
|
11760 | 'ungraded',
|
11761 | 'ungreased',
|
11762 | 'unguarded',
|
11763 | 'unguided',
|
11764 | 'unhappily',
|
11765 | 'unhappy',
|
11766 | 'unharmed',
|
11767 | 'unhealthy',
|
11768 | 'unheard',
|
11769 | 'unhearing',
|
11770 | 'unheated',
|
11771 | 'unhelpful',
|
11772 | 'unhidden',
|
11773 | 'unhinge',
|
11774 | 'unhitched',
|
11775 | 'unholy',
|
11776 | 'unhook',
|
11777 | 'unicorn',
|
11778 | 'unicycle',
|
11779 | 'unified',
|
11780 | 'unifier',
|
11781 | 'uniformed',
|
11782 | 'uniformly',
|
11783 | 'unify',
|
11784 | 'unimpeded',
|
11785 | 'uninjured',
|
11786 | 'uninstall',
|
11787 | 'uninsured',
|
11788 | 'uninvited',
|
11789 | 'union',
|
11790 | 'uniquely',
|
11791 | 'unisexual',
|
11792 | 'unison',
|
11793 | 'unissued',
|
11794 | 'unit',
|
11795 | 'universal',
|
11796 | 'universe',
|
11797 | 'unjustly',
|
11798 | 'unkempt',
|
11799 | 'unkind',
|
11800 | 'unknotted',
|
11801 | 'unknowing',
|
11802 | 'unknown',
|
11803 | 'unlaced',
|
11804 | 'unlatch',
|
11805 | 'unlawful',
|
11806 | 'unleaded',
|
11807 | 'unlearned',
|
11808 | 'unleash',
|
11809 | 'unless',
|
11810 | 'unleveled',
|
11811 | 'unlighted',
|
11812 | 'unlikable',
|
11813 | 'unlimited',
|
11814 | 'unlined',
|
11815 | 'unlinked',
|
11816 | 'unlisted',
|
11817 | 'unlit',
|
11818 | 'unlivable',
|
11819 | 'unloaded',
|
11820 | 'unloader',
|
11821 | 'unlocked',
|
11822 | 'unlocking',
|
11823 | 'unlovable',
|
11824 | 'unloved',
|
11825 | 'unlovely',
|
11826 | 'unloving',
|
11827 | 'unluckily',
|
11828 | 'unlucky',
|
11829 | 'unmade',
|
11830 | 'unmanaged',
|
11831 | 'unmanned',
|
11832 | 'unmapped',
|
11833 | 'unmarked',
|
11834 | 'unmasked',
|
11835 | 'unmasking',
|
11836 | 'unmatched',
|
11837 | 'unmindful',
|
11838 | 'unmixable',
|
11839 | 'unmixed',
|
11840 | 'unmolded',
|
11841 | 'unmoral',
|
11842 | 'unmovable',
|
11843 | 'unmoved',
|
11844 | 'unmoving',
|
11845 | 'unnamable',
|
11846 | 'unnamed',
|
11847 | 'unnatural',
|
11848 | 'unneeded',
|
11849 | 'unnerve',
|
11850 | 'unnerving',
|
11851 | 'unnoticed',
|
11852 | 'unopened',
|
11853 | 'unopposed',
|
11854 | 'unpack',
|
11855 | 'unpadded',
|
11856 | 'unpaid',
|
11857 | 'unpainted',
|
11858 | 'unpaired',
|
11859 | 'unpaved',
|
11860 | 'unpeeled',
|
11861 | 'unpicked',
|
11862 | 'unpiloted',
|
11863 | 'unpinned',
|
11864 | 'unplanned',
|
11865 | 'unplanted',
|
11866 | 'unpleased',
|
11867 | 'unpledged',
|
11868 | 'unplowed',
|
11869 | 'unplug',
|
11870 | 'unpopular',
|
11871 | 'unproven',
|
11872 | 'unquote',
|
11873 | 'unranked',
|
11874 | 'unrated',
|
11875 | 'unraveled',
|
11876 | 'unreached',
|
11877 | 'unread',
|
11878 | 'unreal',
|
11879 | 'unreeling',
|
11880 | 'unrefined',
|
11881 | 'unrelated',
|
11882 | 'unrented',
|
11883 | 'unrest',
|
11884 | 'unretired',
|
11885 | 'unrevised',
|
11886 | 'unrigged',
|
11887 | 'unripe',
|
11888 | 'unrivaled',
|
11889 | 'unroasted',
|
11890 | 'unrobed',
|
11891 | 'unroll',
|
11892 | 'unruffled',
|
11893 | 'unruly',
|
11894 | 'unrushed',
|
11895 | 'unsaddle',
|
11896 | 'unsafe',
|
11897 | 'unsaid',
|
11898 | 'unsalted',
|
11899 | 'unsaved',
|
11900 | 'unsavory',
|
11901 | 'unscathed',
|
11902 | 'unscented',
|
11903 | 'unscrew',
|
11904 | 'unsealed',
|
11905 | 'unseated',
|
11906 | 'unsecured',
|
11907 | 'unseeing',
|
11908 | 'unseemly',
|
11909 | 'unseen',
|
11910 | 'unselect',
|
11911 | 'unselfish',
|
11912 | 'unsent',
|
11913 | 'unsettled',
|
11914 | 'unshackle',
|
11915 | 'unshaken',
|
11916 | 'unshaved',
|
11917 | 'unshaven',
|
11918 | 'unsheathe',
|
11919 | 'unshipped',
|
11920 | 'unsightly',
|
11921 | 'unsigned',
|
11922 | 'unskilled',
|
11923 | 'unsliced',
|
11924 | 'unsmooth',
|
11925 | 'unsnap',
|
11926 | 'unsocial',
|
11927 | 'unsoiled',
|
11928 | 'unsold',
|
11929 | 'unsolved',
|
11930 | 'unsorted',
|
11931 | 'unspoiled',
|
11932 | 'unspoken',
|
11933 | 'unstable',
|
11934 | 'unstaffed',
|
11935 | 'unstamped',
|
11936 | 'unsteady',
|
11937 | 'unsterile',
|
11938 | 'unstirred',
|
11939 | 'unstitch',
|
11940 | 'unstopped',
|
11941 | 'unstuck',
|
11942 | 'unstuffed',
|
11943 | 'unstylish',
|
11944 | 'unsubtle',
|
11945 | 'unsubtly',
|
11946 | 'unsuited',
|
11947 | 'unsure',
|
11948 | 'unsworn',
|
11949 | 'untagged',
|
11950 | 'untainted',
|
11951 | 'untaken',
|
11952 | 'untamed',
|
11953 | 'untangled',
|
11954 | 'untapped',
|
11955 | 'untaxed',
|
11956 | 'unthawed',
|
11957 | 'unthread',
|
11958 | 'untidy',
|
11959 | 'untie',
|
11960 | 'until',
|
11961 | 'untimed',
|
11962 | 'untimely',
|
11963 | 'untitled',
|
11964 | 'untoasted',
|
11965 | 'untold',
|
11966 | 'untouched',
|
11967 | 'untracked',
|
11968 | 'untrained',
|
11969 | 'untreated',
|
11970 | 'untried',
|
11971 | 'untrimmed',
|
11972 | 'untrue',
|
11973 | 'untruth',
|
11974 | 'unturned',
|
11975 | 'untwist',
|
11976 | 'untying',
|
11977 | 'unusable',
|
11978 | 'unused',
|
11979 | 'unusual',
|
11980 | 'unvalued',
|
11981 | 'unvaried',
|
11982 | 'unvarying',
|
11983 | 'unveiled',
|
11984 | 'unveiling',
|
11985 | 'unvented',
|
11986 | 'unviable',
|
11987 | 'unvisited',
|
11988 | 'unvocal',
|
11989 | 'unwanted',
|
11990 | 'unwarlike',
|
11991 | 'unwary',
|
11992 | 'unwashed',
|
11993 | 'unwatched',
|
11994 | 'unweave',
|
11995 | 'unwed',
|
11996 | 'unwelcome',
|
11997 | 'unwell',
|
11998 | 'unwieldy',
|
11999 | 'unwilling',
|
12000 | 'unwind',
|
12001 | 'unwired',
|
12002 | 'unwitting',
|
12003 | 'unwomanly',
|
12004 | 'unworldly',
|
12005 | 'unworn',
|
12006 | 'unworried',
|
12007 | 'unworthy',
|
12008 | 'unwound',
|
12009 | 'unwoven',
|
12010 | 'unwrapped',
|
12011 | 'unwritten',
|
12012 | 'unzip',
|
12013 | 'upbeat',
|
12014 | 'upchuck',
|
12015 | 'upcoming',
|
12016 | 'upcountry',
|
12017 | 'update',
|
12018 | 'upfront',
|
12019 | 'upgrade',
|
12020 | 'upheaval',
|
12021 | 'upheld',
|
12022 | 'uphill',
|
12023 | 'uphold',
|
12024 | 'uplifted',
|
12025 | 'uplifting',
|
12026 | 'upload',
|
12027 | 'upon',
|
12028 | 'upper',
|
12029 | 'upright',
|
12030 | 'uprising',
|
12031 | 'upriver',
|
12032 | 'uproar',
|
12033 | 'uproot',
|
12034 | 'upscale',
|
12035 | 'upside',
|
12036 | 'upstage',
|
12037 | 'upstairs',
|
12038 | 'upstart',
|
12039 | 'upstate',
|
12040 | 'upstream',
|
12041 | 'upstroke',
|
12042 | 'upswing',
|
12043 | 'uptake',
|
12044 | 'uptight',
|
12045 | 'uptown',
|
12046 | 'upturned',
|
12047 | 'upward',
|
12048 | 'upwind',
|
12049 | 'uranium',
|
12050 | 'urban',
|
12051 | 'urchin',
|
12052 | 'urethane',
|
12053 | 'urgency',
|
12054 | 'urgent',
|
12055 | 'urging',
|
12056 | 'urologist',
|
12057 | 'urology',
|
12058 | 'usable',
|
12059 | 'usage',
|
12060 | 'useable',
|
12061 | 'used',
|
12062 | 'uselessly',
|
12063 | 'user',
|
12064 | 'usher',
|
12065 | 'usual',
|
12066 | 'utensil',
|
12067 | 'utility',
|
12068 | 'utilize',
|
12069 | 'utmost',
|
12070 | 'utopia',
|
12071 | 'utter',
|
12072 | 'vacancy',
|
12073 | 'vacant',
|
12074 | 'vacate',
|
12075 | 'vacation',
|
12076 | 'vagabond',
|
12077 | 'vagrancy',
|
12078 | 'vagrantly',
|
12079 | 'vaguely',
|
12080 | 'vagueness',
|
12081 | 'valiant',
|
12082 | 'valid',
|
12083 | 'valium',
|
12084 | 'valley',
|
12085 | 'valuables',
|
12086 | 'value',
|
12087 | 'vanilla',
|
12088 | 'vanish',
|
12089 | 'vanity',
|
12090 | 'vanquish',
|
12091 | 'vantage',
|
12092 | 'vaporizer',
|
12093 | 'variable',
|
12094 | 'variably',
|
12095 | 'varied',
|
12096 | 'variety',
|
12097 | 'various',
|
12098 | 'varmint',
|
12099 | 'varnish',
|
12100 | 'varsity',
|
12101 | 'varying',
|
12102 | 'vascular',
|
12103 | 'vaseline',
|
12104 | 'vastly',
|
12105 | 'vastness',
|
12106 | 'veal',
|
12107 | 'vegan',
|
12108 | 'veggie',
|
12109 | 'vehicular',
|
12110 | 'velcro',
|
12111 | 'velocity',
|
12112 | 'velvet',
|
12113 | 'vendetta',
|
12114 | 'vending',
|
12115 | 'vendor',
|
12116 | 'veneering',
|
12117 | 'vengeful',
|
12118 | 'venomous',
|
12119 | 'ventricle',
|
12120 | 'venture',
|
12121 | 'venue',
|
12122 | 'venus',
|
12123 | 'verbalize',
|
12124 | 'verbally',
|
12125 | 'verbose',
|
12126 | 'verdict',
|
12127 | 'verify',
|
12128 | 'verse',
|
12129 | 'version',
|
12130 | 'versus',
|
12131 | 'vertebrae',
|
12132 | 'vertical',
|
12133 | 'vertigo',
|
12134 | 'very',
|
12135 | 'vessel',
|
12136 | 'vest',
|
12137 | 'veteran',
|
12138 | 'veto',
|
12139 | 'vexingly',
|
12140 | 'viability',
|
12141 | 'viable',
|
12142 | 'vibes',
|
12143 | 'vice',
|
12144 | 'vicinity',
|
12145 | 'victory',
|
12146 | 'video',
|
12147 | 'viewable',
|
12148 | 'viewer',
|
12149 | 'viewing',
|
12150 | 'viewless',
|
12151 | 'viewpoint',
|
12152 | 'vigorous',
|
12153 | 'village',
|
12154 | 'villain',
|
12155 | 'vindicate',
|
12156 | 'vineyard',
|
12157 | 'vintage',
|
12158 | 'violate',
|
12159 | 'violation',
|
12160 | 'violator',
|
12161 | 'violet',
|
12162 | 'violin',
|
12163 | 'viper',
|
12164 | 'viral',
|
12165 | 'virtual',
|
12166 | 'virtuous',
|
12167 | 'virus',
|
12168 | 'visa',
|
12169 | 'viscosity',
|
12170 | 'viscous',
|
12171 | 'viselike',
|
12172 | 'visible',
|
12173 | 'visibly',
|
12174 | 'vision',
|
12175 | 'visiting',
|
12176 | 'visitor',
|
12177 | 'visor',
|
12178 | 'vista',
|
12179 | 'vitality',
|
12180 | 'vitalize',
|
12181 | 'vitally',
|
12182 | 'vitamins',
|
12183 | 'vivacious',
|
12184 | 'vividly',
|
12185 | 'vividness',
|
12186 | 'vixen',
|
12187 | 'vocalist',
|
12188 | 'vocalize',
|
12189 | 'vocally',
|
12190 | 'vocation',
|
12191 | 'voice',
|
12192 | 'voicing',
|
12193 | 'void',
|
12194 | 'volatile',
|
12195 | 'volley',
|
12196 | 'voltage',
|
12197 | 'volumes',
|
12198 | 'voter',
|
12199 | 'voting',
|
12200 | 'voucher',
|
12201 | 'vowed',
|
12202 | 'vowel',
|
12203 | 'voyage',
|
12204 | 'wackiness',
|
12205 | 'wad',
|
12206 | 'wafer',
|
12207 | 'waffle',
|
12208 | 'waged',
|
12209 | 'wager',
|
12210 | 'wages',
|
12211 | 'waggle',
|
12212 | 'wagon',
|
12213 | 'wake',
|
12214 | 'waking',
|
12215 | 'walk',
|
12216 | 'walmart',
|
12217 | 'walnut',
|
12218 | 'walrus',
|
12219 | 'waltz',
|
12220 | 'wand',
|
12221 | 'wannabe',
|
12222 | 'wanted',
|
12223 | 'wanting',
|
12224 | 'wasabi',
|
12225 | 'washable',
|
12226 | 'washbasin',
|
12227 | 'washboard',
|
12228 | 'washbowl',
|
12229 | 'washcloth',
|
12230 | 'washday',
|
12231 | 'washed',
|
12232 | 'washer',
|
12233 | 'washhouse',
|
12234 | 'washing',
|
12235 | 'washout',
|
12236 | 'washroom',
|
12237 | 'washstand',
|
12238 | 'washtub',
|
12239 | 'wasp',
|
12240 | 'wasting',
|
12241 | 'watch',
|
12242 | 'water',
|
12243 | 'waviness',
|
12244 | 'waving',
|
12245 | 'wavy',
|
12246 | 'whacking',
|
12247 | 'whacky',
|
12248 | 'wham',
|
12249 | 'wharf',
|
12250 | 'wheat',
|
12251 | 'whenever',
|
12252 | 'whiff',
|
12253 | 'whimsical',
|
12254 | 'whinny',
|
12255 | 'whiny',
|
12256 | 'whisking',
|
12257 | 'whoever',
|
12258 | 'whole',
|
12259 | 'whomever',
|
12260 | 'whoopee',
|
12261 | 'whooping',
|
12262 | 'whoops',
|
12263 | 'why',
|
12264 | 'wick',
|
12265 | 'widely',
|
12266 | 'widen',
|
12267 | 'widget',
|
12268 | 'widow',
|
12269 | 'width',
|
12270 | 'wieldable',
|
12271 | 'wielder',
|
12272 | 'wife',
|
12273 | 'wifi',
|
12274 | 'wikipedia',
|
12275 | 'wildcard',
|
12276 | 'wildcat',
|
12277 | 'wilder',
|
12278 | 'wildfire',
|
12279 | 'wildfowl',
|
12280 | 'wildland',
|
12281 | 'wildlife',
|
12282 | 'wildly',
|
12283 | 'wildness',
|
12284 | 'willed',
|
12285 | 'willfully',
|
12286 | 'willing',
|
12287 | 'willow',
|
12288 | 'willpower',
|
12289 | 'wilt',
|
12290 | 'wimp',
|
12291 | 'wince',
|
12292 | 'wincing',
|
12293 | 'wind',
|
12294 | 'wing',
|
12295 | 'winking',
|
12296 | 'winner',
|
12297 | 'winnings',
|
12298 | 'winter',
|
12299 | 'wipe',
|
12300 | 'wired',
|
12301 | 'wireless',
|
12302 | 'wiring',
|
12303 | 'wiry',
|
12304 | 'wisdom',
|
12305 | 'wise',
|
12306 | 'wish',
|
12307 | 'wisplike',
|
12308 | 'wispy',
|
12309 | 'wistful',
|
12310 | 'wizard',
|
12311 | 'wobble',
|
12312 | 'wobbling',
|
12313 | 'wobbly',
|
12314 | 'wok',
|
12315 | 'wolf',
|
12316 | 'wolverine',
|
12317 | 'womanhood',
|
12318 | 'womankind',
|
12319 | 'womanless',
|
12320 | 'womanlike',
|
12321 | 'womanly',
|
12322 | 'womb',
|
12323 | 'woof',
|
12324 | 'wooing',
|
12325 | 'wool',
|
12326 | 'woozy',
|
12327 | 'word',
|
12328 | 'work',
|
12329 | 'worried',
|
12330 | 'worrier',
|
12331 | 'worrisome',
|
12332 | 'worry',
|
12333 | 'worsening',
|
12334 | 'worshiper',
|
12335 | 'worst',
|
12336 | 'wound',
|
12337 | 'woven',
|
12338 | 'wow',
|
12339 | 'wrangle',
|
12340 | 'wrath',
|
12341 | 'wreath',
|
12342 | 'wreckage',
|
12343 | 'wrecker',
|
12344 | 'wrecking',
|
12345 | 'wrench',
|
12346 | 'wriggle',
|
12347 | 'wriggly',
|
12348 | 'wrinkle',
|
12349 | 'wrinkly',
|
12350 | 'wrist',
|
12351 | 'writing',
|
12352 | 'written',
|
12353 | 'wrongdoer',
|
12354 | 'wronged',
|
12355 | 'wrongful',
|
12356 | 'wrongly',
|
12357 | 'wrongness',
|
12358 | 'wrought',
|
12359 | 'xbox',
|
12360 | 'xerox',
|
12361 | 'yahoo',
|
12362 | 'yam',
|
12363 | 'yanking',
|
12364 | 'yapping',
|
12365 | 'yard',
|
12366 | 'yarn',
|
12367 | 'yeah',
|
12368 | 'yearbook',
|
12369 | 'yearling',
|
12370 | 'yearly',
|
12371 | 'yearning',
|
12372 | 'yeast',
|
12373 | 'yelling',
|
12374 | 'yelp',
|
12375 | 'yen',
|
12376 | 'yesterday',
|
12377 | 'yiddish',
|
12378 | 'yield',
|
12379 | 'yin',
|
12380 | 'yippee',
|
12381 | 'yo-yo',
|
12382 | 'yodel',
|
12383 | 'yoga',
|
12384 | 'yogurt',
|
12385 | 'yonder',
|
12386 | 'yoyo',
|
12387 | 'yummy',
|
12388 | 'zap',
|
12389 | 'zealous',
|
12390 | 'zebra',
|
12391 | 'zen',
|
12392 | 'zeppelin',
|
12393 | 'zero',
|
12394 | 'zestfully',
|
12395 | 'zesty',
|
12396 | 'zigzagged',
|
12397 | 'zipfile',
|
12398 | 'zipping',
|
12399 | 'zippy',
|
12400 | 'zips',
|
12401 | 'zit',
|
12402 | 'zodiac',
|
12403 | 'zombie',
|
12404 | 'zone',
|
12405 | 'zoning',
|
12406 | 'zookeeper',
|
12407 | 'zoologist',
|
12408 | 'zoology',
|
12409 | 'zoom',
|
12410 | ];
|
12411 |
|
12412 |
|
12413 | var crypto_service_decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
12414 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
12415 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
12416 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
12417 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
12418 | };
|
12419 | var crypto_service_metadata = (undefined && undefined.__metadata) || function (k, v) {
|
12420 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
12421 | };
|
12422 | var crypto_service_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
12423 | return new (P || (P = Promise))(function (resolve, reject) {
|
12424 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
12425 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
12426 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
12427 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
12428 | });
|
12429 | };
|
12430 |
|
12431 |
|
12432 |
|
12433 |
|
12434 |
|
12435 |
|
12436 |
|
12437 |
|
12438 |
|
12439 |
|
12440 | const crypto_service_Keys = {
|
12441 | key: 'key',
|
12442 | encOrgKeys: 'encOrgKeys',
|
12443 | encPrivateKey: 'encPrivateKey',
|
12444 | encKey: 'encKey',
|
12445 | keyHash: 'keyHash',
|
12446 | };
|
12447 | class crypto_service_CryptoService {
|
12448 | constructor(storageService, secureStorageService, cryptoFunctionService) {
|
12449 | this.storageService = storageService;
|
12450 | this.secureStorageService = secureStorageService;
|
12451 | this.cryptoFunctionService = cryptoFunctionService;
|
12452 | }
|
12453 | setKey(key) {
|
12454 | return crypto_service_awaiter(this, void 0, void 0, function* () {
|
12455 | this.key = key;
|
12456 | const option = yield this.storageService.get(ConstantsService.vaultTimeoutKey);
|
12457 | if (option != null) {
|
12458 |
|
12459 | return;
|
12460 | }
|
12461 | return this.secureStorageService.save(crypto_service_Keys.key, key.keyB64);
|
12462 | });
|
12463 | }
|
12464 | setKeyHash(keyHash) {
|
12465 | this.keyHash = keyHash;
|
12466 | return this.storageService.save(crypto_service_Keys.keyHash, keyHash);
|
12467 | }
|
12468 | setEncKey(encKey) {
|
12469 | return crypto_service_awaiter(this, void 0, void 0, function* () {
|
12470 | if (encKey == null) {
|
12471 | return;
|
12472 | }
|
12473 | yield this.storageService.save(crypto_service_Keys.encKey, encKey);
|
12474 | this.encKey = null;
|
12475 | });
|
12476 | }
|
12477 | setEncPrivateKey(encPrivateKey) {
|
12478 | return crypto_service_awaiter(this, void 0, void 0, function* () {
|
12479 | if (encPrivateKey == null) {
|
12480 | return;
|
12481 | }
|
12482 | yield this.storageService.save(crypto_service_Keys.encPrivateKey, encPrivateKey);
|
12483 | this.privateKey = null;
|
12484 | });
|
12485 | }
|
12486 | setOrgKeys(orgs) {
|
12487 | const orgKeys = {};
|
12488 | orgs.forEach((org) => {
|
12489 | orgKeys[org.id] = org.key;
|
12490 | });
|
12491 | this.orgKeys = null;
|
12492 | return this.storageService.save(crypto_service_Keys.encOrgKeys, orgKeys);
|
12493 | }
|
12494 | getKey() {
|
12495 | return crypto_service_awaiter(this, void 0, void 0, function* () {
|
12496 | if (this.key != null) {
|
12497 | return this.key;
|
12498 | }
|
12499 | const key = yield this.secureStorageService.get(crypto_service_Keys.key);
|
12500 | if (key != null) {
|
12501 | this.key = new symmetricCryptoKey_SymmetricCryptoKey(utils_Utils.fromB64ToArray(key).buffer);
|
12502 | }
|
12503 | return key == null ? null : this.key;
|
12504 | });
|
12505 | }
|
12506 | getKeyHash() {
|
12507 | return crypto_service_awaiter(this, void 0, void 0, function* () {
|
12508 | if (this.keyHash != null) {
|
12509 | return this.keyHash;
|
12510 | }
|
12511 | const keyHash = yield this.storageService.get(crypto_service_Keys.keyHash);
|
12512 | if (keyHash != null) {
|
12513 | this.keyHash = keyHash;
|
12514 | }
|
12515 | return keyHash == null ? null : this.keyHash;
|
12516 | });
|
12517 | }
|
12518 | getEncKey(key = null) {
|
12519 | return crypto_service_awaiter(this, void 0, void 0, function* () {
|
12520 | if (this.encKey != null) {
|
12521 | return this.encKey;
|
12522 | }
|
12523 | const encKey = yield this.storageService.get(crypto_service_Keys.encKey);
|
12524 | if (encKey == null) {
|
12525 | return null;
|
12526 | }
|
12527 | if (key == null) {
|
12528 | key = yield this.getKey();
|
12529 | }
|
12530 | if (key == null) {
|
12531 | return null;
|
12532 | }
|
12533 | let decEncKey;
|
12534 | const encKeyCipher = new cipherString_CipherString(encKey);
|
12535 | if (encKeyCipher.encryptionType === EncryptionType.AesCbc256_B64) {
|
12536 | decEncKey = yield this.decryptToBytes(encKeyCipher, key);
|
12537 | }
|
12538 | else if (encKeyCipher.encryptionType === EncryptionType.AesCbc256_HmacSha256_B64) {
|
12539 | const newKey = yield this.stretchKey(key);
|
12540 | decEncKey = yield this.decryptToBytes(encKeyCipher, newKey);
|
12541 | }
|
12542 | else {
|
12543 | throw new Error('Unsupported encKey type.');
|
12544 | }
|
12545 | if (decEncKey == null) {
|
12546 | return null;
|
12547 | }
|
12548 | this.encKey = new symmetricCryptoKey_SymmetricCryptoKey(decEncKey);
|
12549 | return this.encKey;
|
12550 | });
|
12551 | }
|
12552 | getPublicKey() {
|
12553 | return crypto_service_awaiter(this, void 0, void 0, function* () {
|
12554 | if (this.publicKey != null) {
|
12555 | return this.publicKey;
|
12556 | }
|
12557 | const privateKey = yield this.getPrivateKey();
|
12558 | if (privateKey == null) {
|
12559 | return null;
|
12560 | }
|
12561 | this.publicKey = yield this.cryptoFunctionService.rsaExtractPublicKey(privateKey);
|
12562 | return this.publicKey;
|
12563 | });
|
12564 | }
|
12565 | getPrivateKey() {
|
12566 | return crypto_service_awaiter(this, void 0, void 0, function* () {
|
12567 | if (this.privateKey != null) {
|
12568 | return this.privateKey;
|
12569 | }
|
12570 | const encPrivateKey = yield this.storageService.get(crypto_service_Keys.encPrivateKey);
|
12571 | if (encPrivateKey == null) {
|
12572 | return null;
|
12573 | }
|
12574 | this.privateKey = yield this.decryptToBytes(new cipherString_CipherString(encPrivateKey), null);
|
12575 | return this.privateKey;
|
12576 | });
|
12577 | }
|
12578 | getFingerprint(userId, publicKey) {
|
12579 | return crypto_service_awaiter(this, void 0, void 0, function* () {
|
12580 | if (publicKey == null) {
|
12581 | publicKey = yield this.getPublicKey();
|
12582 | }
|
12583 | if (publicKey === null) {
|
12584 | throw new Error('No public key available.');
|
12585 | }
|
12586 | const keyFingerprint = yield this.cryptoFunctionService.hash(publicKey, 'sha256');
|
12587 | const userFingerprint = yield this.hkdfExpand(keyFingerprint, utils_Utils.fromUtf8ToArray(userId), 32);
|
12588 | return this.hashPhrase(userFingerprint.buffer);
|
12589 | });
|
12590 | }
|
12591 | getOrgKeys() {
|
12592 | return crypto_service_awaiter(this, void 0, void 0, function* () {
|
12593 | if (this.orgKeys != null && this.orgKeys.size > 0) {
|
12594 | return this.orgKeys;
|
12595 | }
|
12596 | const encOrgKeys = yield this.storageService.get(crypto_service_Keys.encOrgKeys);
|
12597 | if (encOrgKeys == null) {
|
12598 | return null;
|
12599 | }
|
12600 | const orgKeys = new Map();
|
12601 | let setKey = false;
|
12602 | for (const orgId in encOrgKeys) {
|
12603 | if (!encOrgKeys.hasOwnProperty(orgId)) {
|
12604 | continue;
|
12605 | }
|
12606 | const decValue = yield this.rsaDecrypt(encOrgKeys[orgId]);
|
12607 | orgKeys.set(orgId, new symmetricCryptoKey_SymmetricCryptoKey(decValue));
|
12608 | setKey = true;
|
12609 | }
|
12610 | if (setKey) {
|
12611 | this.orgKeys = orgKeys;
|
12612 | }
|
12613 | return this.orgKeys;
|
12614 | });
|
12615 | }
|
12616 | getOrgKey(orgId) {
|
12617 | return crypto_service_awaiter(this, void 0, void 0, function* () {
|
12618 | if (orgId == null) {
|
12619 | return null;
|
12620 | }
|
12621 | const orgKeys = yield this.getOrgKeys();
|
12622 | if (orgKeys == null || !orgKeys.has(orgId)) {
|
12623 | return null;
|
12624 | }
|
12625 | return orgKeys.get(orgId);
|
12626 | });
|
12627 | }
|
12628 | hasKey() {
|
12629 | return crypto_service_awaiter(this, void 0, void 0, function* () {
|
12630 | return (yield this.getKey()) != null;
|
12631 | });
|
12632 | }
|
12633 | hasEncKey() {
|
12634 | return crypto_service_awaiter(this, void 0, void 0, function* () {
|
12635 | const encKey = yield this.storageService.get(crypto_service_Keys.encKey);
|
12636 | return encKey != null;
|
12637 | });
|
12638 | }
|
12639 | clearKey() {
|
12640 | this.key = this.legacyEtmKey = null;
|
12641 | return this.secureStorageService.remove(crypto_service_Keys.key);
|
12642 | }
|
12643 | clearKeyHash() {
|
12644 | this.keyHash = null;
|
12645 | return this.storageService.remove(crypto_service_Keys.keyHash);
|
12646 | }
|
12647 | clearEncKey(memoryOnly) {
|
12648 | this.encKey = null;
|
12649 | if (memoryOnly) {
|
12650 | return Promise.resolve();
|
12651 | }
|
12652 | return this.storageService.remove(crypto_service_Keys.encKey);
|
12653 | }
|
12654 | clearKeyPair(memoryOnly) {
|
12655 | this.privateKey = null;
|
12656 | this.publicKey = null;
|
12657 | if (memoryOnly) {
|
12658 | return Promise.resolve();
|
12659 | }
|
12660 | return this.storageService.remove(crypto_service_Keys.encPrivateKey);
|
12661 | }
|
12662 | clearOrgKeys(memoryOnly) {
|
12663 | this.orgKeys = null;
|
12664 | if (memoryOnly) {
|
12665 | return Promise.resolve();
|
12666 | }
|
12667 | return this.storageService.remove(crypto_service_Keys.encOrgKeys);
|
12668 | }
|
12669 | clearPinProtectedKey() {
|
12670 | return this.storageService.remove(ConstantsService.pinProtectedKey);
|
12671 | }
|
12672 | clearKeys() {
|
12673 | return Promise.all([
|
12674 | this.clearKey(),
|
12675 | this.clearKeyHash(),
|
12676 | this.clearOrgKeys(),
|
12677 | this.clearEncKey(),
|
12678 | this.clearKeyPair(),
|
12679 | this.clearPinProtectedKey(),
|
12680 | ]);
|
12681 | }
|
12682 | toggleKey() {
|
12683 | return crypto_service_awaiter(this, void 0, void 0, function* () {
|
12684 | const key = yield this.getKey();
|
12685 | const option = yield this.storageService.get(ConstantsService.vaultTimeoutKey);
|
12686 | if (option != null || option === 0) {
|
12687 |
|
12688 | yield this.clearKey();
|
12689 | this.key = key;
|
12690 | return;
|
12691 | }
|
12692 | yield this.setKey(key);
|
12693 | });
|
12694 | }
|
12695 | makeKey(password, salt, kdf, kdfIterations) {
|
12696 | return crypto_service_awaiter(this, void 0, void 0, function* () {
|
12697 | let key = null;
|
12698 | if (kdf == null || kdf === KdfType.PBKDF2_SHA256) {
|
12699 | if (kdfIterations == null) {
|
12700 | kdfIterations = 5000;
|
12701 | }
|
12702 | else if (kdfIterations < 5000) {
|
12703 | throw new Error('PBKDF2 iteration minimum is 5000.');
|
12704 | }
|
12705 | key = yield this.cryptoFunctionService.pbkdf2(password, salt, 'sha256', kdfIterations);
|
12706 | }
|
12707 | else {
|
12708 | throw new Error('Unknown Kdf.');
|
12709 | }
|
12710 | return new symmetricCryptoKey_SymmetricCryptoKey(key);
|
12711 | });
|
12712 | }
|
12713 | makeKeyFromPin(pin, salt, kdf, kdfIterations, protectedKeyCs = null) {
|
12714 | return crypto_service_awaiter(this, void 0, void 0, function* () {
|
12715 | if (protectedKeyCs == null) {
|
12716 | const pinProtectedKey = yield this.storageService.get(ConstantsService.pinProtectedKey);
|
12717 | if (pinProtectedKey == null) {
|
12718 | throw new Error('No PIN protected key found.');
|
12719 | }
|
12720 | protectedKeyCs = new cipherString_CipherString(pinProtectedKey);
|
12721 | }
|
12722 | const pinKey = yield this.makePinKey(pin, salt, kdf, kdfIterations);
|
12723 | const decKey = yield this.decryptToBytes(protectedKeyCs, pinKey);
|
12724 | return new symmetricCryptoKey_SymmetricCryptoKey(decKey);
|
12725 | });
|
12726 | }
|
12727 | makeShareKey() {
|
12728 | return crypto_service_awaiter(this, void 0, void 0, function* () {
|
12729 | const shareKey = yield this.cryptoFunctionService.randomBytes(64);
|
12730 | const publicKey = yield this.getPublicKey();
|
12731 | const encShareKey = yield this.rsaEncrypt(shareKey, publicKey);
|
12732 | return [encShareKey, new symmetricCryptoKey_SymmetricCryptoKey(shareKey)];
|
12733 | });
|
12734 | }
|
12735 | makeKeyPair(key) {
|
12736 | return crypto_service_awaiter(this, void 0, void 0, function* () {
|
12737 | const keyPair = yield this.cryptoFunctionService.rsaGenerateKeyPair(2048);
|
12738 | const publicB64 = utils_Utils.fromBufferToB64(keyPair[0]);
|
12739 | const privateEnc = yield this.encrypt(keyPair[1], key);
|
12740 | return [publicB64, privateEnc];
|
12741 | });
|
12742 | }
|
12743 | makePinKey(pin, salt, kdf, kdfIterations) {
|
12744 | return crypto_service_awaiter(this, void 0, void 0, function* () {
|
12745 | const pinKey = yield this.makeKey(pin, salt, kdf, kdfIterations);
|
12746 | return yield this.stretchKey(pinKey);
|
12747 | });
|
12748 | }
|
12749 | hashPassword(password, key) {
|
12750 | return crypto_service_awaiter(this, void 0, void 0, function* () {
|
12751 | if (key == null) {
|
12752 | key = yield this.getKey();
|
12753 | }
|
12754 | if (password == null || key == null) {
|
12755 | throw new Error('Invalid parameters.');
|
12756 | }
|
12757 | const hash = yield this.cryptoFunctionService.pbkdf2(key.key, password, 'sha256', 1);
|
12758 | return utils_Utils.fromBufferToB64(hash);
|
12759 | });
|
12760 | }
|
12761 | makeEncKey(key) {
|
12762 | return crypto_service_awaiter(this, void 0, void 0, function* () {
|
12763 | const theKey = yield this.getKeyForEncryption(key);
|
12764 | const encKey = yield this.cryptoFunctionService.randomBytes(64);
|
12765 | return this.buildEncKey(theKey, encKey);
|
12766 | });
|
12767 | }
|
12768 | remakeEncKey(key) {
|
12769 | return crypto_service_awaiter(this, void 0, void 0, function* () {
|
12770 | const encKey = yield this.getEncKey();
|
12771 | return this.buildEncKey(key, encKey.key);
|
12772 | });
|
12773 | }
|
12774 | encrypt(plainValue, key) {
|
12775 | return crypto_service_awaiter(this, void 0, void 0, function* () {
|
12776 | if (plainValue == null) {
|
12777 | return Promise.resolve(null);
|
12778 | }
|
12779 | let plainBuf;
|
12780 | if (typeof (plainValue) === 'string') {
|
12781 | plainBuf = utils_Utils.fromUtf8ToArray(plainValue).buffer;
|
12782 | }
|
12783 | else {
|
12784 | plainBuf = plainValue;
|
12785 | }
|
12786 | const encObj = yield this.aesEncrypt(plainBuf, key);
|
12787 | const iv = utils_Utils.fromBufferToB64(encObj.iv);
|
12788 | const data = utils_Utils.fromBufferToB64(encObj.data);
|
12789 | const mac = encObj.mac != null ? utils_Utils.fromBufferToB64(encObj.mac) : null;
|
12790 | return new cipherString_CipherString(encObj.key.encType, data, iv, mac);
|
12791 | });
|
12792 | }
|
12793 | encryptToBytes(plainValue, key) {
|
12794 | return crypto_service_awaiter(this, void 0, void 0, function* () {
|
12795 | const encValue = yield this.aesEncrypt(plainValue, key);
|
12796 | let macLen = 0;
|
12797 | if (encValue.mac != null) {
|
12798 | macLen = encValue.mac.byteLength;
|
12799 | }
|
12800 | const encBytes = new Uint8Array(1 + encValue.iv.byteLength + macLen + encValue.data.byteLength);
|
12801 | encBytes.set([encValue.key.encType]);
|
12802 | encBytes.set(new Uint8Array(encValue.iv), 1);
|
12803 | if (encValue.mac != null) {
|
12804 | encBytes.set(new Uint8Array(encValue.mac), 1 + encValue.iv.byteLength);
|
12805 | }
|
12806 | encBytes.set(new Uint8Array(encValue.data), 1 + encValue.iv.byteLength + macLen);
|
12807 | return encBytes.buffer;
|
12808 | });
|
12809 | }
|
12810 | rsaEncrypt(data, publicKey) {
|
12811 | return crypto_service_awaiter(this, void 0, void 0, function* () {
|
12812 | if (publicKey == null) {
|
12813 | publicKey = yield this.getPublicKey();
|
12814 | }
|
12815 | if (publicKey == null) {
|
12816 | throw new Error('Public key unavailable.');
|
12817 | }
|
12818 | const encBytes = yield this.cryptoFunctionService.rsaEncrypt(data, publicKey, 'sha1');
|
12819 | return new cipherString_CipherString(EncryptionType.Rsa2048_OaepSha1_B64, utils_Utils.fromBufferToB64(encBytes));
|
12820 | });
|
12821 | }
|
12822 | decryptToBytes(cipherString, key) {
|
12823 | return crypto_service_awaiter(this, void 0, void 0, function* () {
|
12824 | const iv = utils_Utils.fromB64ToArray(cipherString.iv).buffer;
|
12825 | const data = utils_Utils.fromB64ToArray(cipherString.data).buffer;
|
12826 | const mac = cipherString.mac ? utils_Utils.fromB64ToArray(cipherString.mac).buffer : null;
|
12827 | const decipher = yield this.aesDecryptToBytes(cipherString.encryptionType, data, iv, mac, key);
|
12828 | if (decipher == null) {
|
12829 | return null;
|
12830 | }
|
12831 | return decipher;
|
12832 | });
|
12833 | }
|
12834 | decryptToUtf8(cipherString, key) {
|
12835 | return crypto_service_awaiter(this, void 0, void 0, function* () {
|
12836 | return yield this.aesDecryptToUtf8(cipherString.encryptionType, cipherString.data, cipherString.iv, cipherString.mac, key);
|
12837 | });
|
12838 | }
|
12839 | decryptFromBytes(encBuf, key) {
|
12840 | return crypto_service_awaiter(this, void 0, void 0, function* () {
|
12841 | if (encBuf == null) {
|
12842 | throw new Error('no encBuf.');
|
12843 | }
|
12844 | const encBytes = new Uint8Array(encBuf);
|
12845 | const encType = encBytes[0];
|
12846 | let ctBytes = null;
|
12847 | let ivBytes = null;
|
12848 | let macBytes = null;
|
12849 | switch (encType) {
|
12850 | case EncryptionType.AesCbc128_HmacSha256_B64:
|
12851 | case EncryptionType.AesCbc256_HmacSha256_B64:
|
12852 | if (encBytes.length <= 49) {
|
12853 | return null;
|
12854 | }
|
12855 | ivBytes = encBytes.slice(1, 17);
|
12856 | macBytes = encBytes.slice(17, 49);
|
12857 | ctBytes = encBytes.slice(49);
|
12858 | break;
|
12859 | case EncryptionType.AesCbc256_B64:
|
12860 | if (encBytes.length <= 17) {
|
12861 | return null;
|
12862 | }
|
12863 | ivBytes = encBytes.slice(1, 17);
|
12864 | ctBytes = encBytes.slice(17);
|
12865 | break;
|
12866 | default:
|
12867 | return null;
|
12868 | }
|
12869 | return yield this.aesDecryptToBytes(encType, ctBytes.buffer, ivBytes.buffer, macBytes != null ? macBytes.buffer : null, key);
|
12870 | });
|
12871 | }
|
12872 |
|
12873 |
|
12874 | randomNumber(min, max) {
|
12875 | return crypto_service_awaiter(this, void 0, void 0, function* () {
|
12876 | let rval = 0;
|
12877 | const range = max - min + 1;
|
12878 | const bitsNeeded = Math.ceil(Math.log2(range));
|
12879 | if (bitsNeeded > 53) {
|
12880 | throw new Error('We cannot generate numbers larger than 53 bits.');
|
12881 | }
|
12882 | const bytesNeeded = Math.ceil(bitsNeeded / 8);
|
12883 | const mask = Math.pow(2, bitsNeeded) - 1;
|
12884 |
|
12885 |
|
12886 | const byteArray = new Uint8Array(yield this.cryptoFunctionService.randomBytes(bytesNeeded));
|
12887 | let p = (bytesNeeded - 1) * 8;
|
12888 | for (let i = 0; i < bytesNeeded; i++) {
|
12889 | rval += byteArray[i] * Math.pow(2, p);
|
12890 | p -= 8;
|
12891 | }
|
12892 |
|
12893 |
|
12894 | rval = rval & mask;
|
12895 | if (rval >= range) {
|
12896 |
|
12897 | return this.randomNumber(min, max);
|
12898 | }
|
12899 |
|
12900 | return min + rval;
|
12901 | });
|
12902 | }
|
12903 |
|
12904 | aesEncrypt(data, key) {
|
12905 | return crypto_service_awaiter(this, void 0, void 0, function* () {
|
12906 | const obj = new EncryptedObject();
|
12907 | obj.key = yield this.getKeyForEncryption(key);
|
12908 | obj.iv = yield this.cryptoFunctionService.randomBytes(16);
|
12909 | obj.data = yield this.cryptoFunctionService.aesEncrypt(data, obj.iv, obj.key.encKey);
|
12910 | if (obj.key.macKey != null) {
|
12911 | const macData = new Uint8Array(obj.iv.byteLength + obj.data.byteLength);
|
12912 | macData.set(new Uint8Array(obj.iv), 0);
|
12913 | macData.set(new Uint8Array(obj.data), obj.iv.byteLength);
|
12914 | obj.mac = yield this.cryptoFunctionService.hmac(macData.buffer, obj.key.macKey, 'sha256');
|
12915 | }
|
12916 | return obj;
|
12917 | });
|
12918 | }
|
12919 | aesDecryptToUtf8(encType, data, iv, mac, key) {
|
12920 | return crypto_service_awaiter(this, void 0, void 0, function* () {
|
12921 | const keyForEnc = yield this.getKeyForEncryption(key);
|
12922 | const theKey = this.resolveLegacyKey(encType, keyForEnc);
|
12923 | if (theKey.macKey != null && mac == null) {
|
12924 |
|
12925 | console.error('mac required.');
|
12926 | return null;
|
12927 | }
|
12928 | if (theKey.encType !== encType) {
|
12929 |
|
12930 | console.error('encType unavailable.');
|
12931 | return null;
|
12932 | }
|
12933 | const fastParams = this.cryptoFunctionService.aesDecryptFastParameters(data, iv, mac, theKey);
|
12934 | if (fastParams.macKey != null && fastParams.mac != null) {
|
12935 | const computedMac = yield this.cryptoFunctionService.hmacFast(fastParams.macData, fastParams.macKey, 'sha256');
|
12936 | const macsEqual = yield this.cryptoFunctionService.compareFast(fastParams.mac, computedMac);
|
12937 | if (!macsEqual) {
|
12938 |
|
12939 | console.error('mac failed.');
|
12940 | return null;
|
12941 | }
|
12942 | }
|
12943 | return this.cryptoFunctionService.aesDecryptFast(fastParams);
|
12944 | });
|
12945 | }
|
12946 | aesDecryptToBytes(encType, data, iv, mac, key) {
|
12947 | return crypto_service_awaiter(this, void 0, void 0, function* () {
|
12948 | const keyForEnc = yield this.getKeyForEncryption(key);
|
12949 | const theKey = this.resolveLegacyKey(encType, keyForEnc);
|
12950 | if (theKey.macKey != null && mac == null) {
|
12951 | return null;
|
12952 | }
|
12953 | if (theKey.encType !== encType) {
|
12954 | return null;
|
12955 | }
|
12956 | if (theKey.macKey != null && mac != null) {
|
12957 | const macData = new Uint8Array(iv.byteLength + data.byteLength);
|
12958 | macData.set(new Uint8Array(iv), 0);
|
12959 | macData.set(new Uint8Array(data), iv.byteLength);
|
12960 | const computedMac = yield this.cryptoFunctionService.hmac(macData.buffer, theKey.macKey, 'sha256');
|
12961 | if (computedMac === null) {
|
12962 | return null;
|
12963 | }
|
12964 | const macsMatch = yield this.cryptoFunctionService.compare(mac, computedMac);
|
12965 | if (!macsMatch) {
|
12966 |
|
12967 | console.error('mac failed.');
|
12968 | return null;
|
12969 | }
|
12970 | }
|
12971 | return yield this.cryptoFunctionService.aesDecrypt(data, iv, theKey.encKey);
|
12972 | });
|
12973 | }
|
12974 | rsaDecrypt(encValue) {
|
12975 | return crypto_service_awaiter(this, void 0, void 0, function* () {
|
12976 | const headerPieces = encValue.split('.');
|
12977 | let encType = null;
|
12978 | let encPieces;
|
12979 | if (headerPieces.length === 1) {
|
12980 | encType = EncryptionType.Rsa2048_OaepSha256_B64;
|
12981 | encPieces = [headerPieces[0]];
|
12982 | }
|
12983 | else if (headerPieces.length === 2) {
|
12984 | try {
|
12985 | encType = parseInt(headerPieces[0], null);
|
12986 | encPieces = headerPieces[1].split('|');
|
12987 | }
|
12988 | catch (e) { }
|
12989 | }
|
12990 | switch (encType) {
|
12991 | case EncryptionType.Rsa2048_OaepSha256_B64:
|
12992 | case EncryptionType.Rsa2048_OaepSha1_B64:
|
12993 |
|
12994 | case EncryptionType.Rsa2048_OaepSha256_HmacSha256_B64:
|
12995 | case EncryptionType.Rsa2048_OaepSha1_HmacSha256_B64:
|
12996 | break;
|
12997 | default:
|
12998 | throw new Error('encType unavailable.');
|
12999 | }
|
13000 | if (encPieces == null || encPieces.length <= 0) {
|
13001 | throw new Error('encPieces unavailable.');
|
13002 | }
|
13003 | const data = utils_Utils.fromB64ToArray(encPieces[0]).buffer;
|
13004 | const privateKey = yield this.getPrivateKey();
|
13005 | if (privateKey == null) {
|
13006 | throw new Error('No private key.');
|
13007 | }
|
13008 | let alg = 'sha1';
|
13009 | switch (encType) {
|
13010 | case EncryptionType.Rsa2048_OaepSha256_B64:
|
13011 | case EncryptionType.Rsa2048_OaepSha256_HmacSha256_B64:
|
13012 | alg = 'sha256';
|
13013 | break;
|
13014 | case EncryptionType.Rsa2048_OaepSha1_B64:
|
13015 | case EncryptionType.Rsa2048_OaepSha1_HmacSha256_B64:
|
13016 | break;
|
13017 | default:
|
13018 | throw new Error('encType unavailable.');
|
13019 | }
|
13020 | return this.cryptoFunctionService.rsaDecrypt(data, privateKey, alg);
|
13021 | });
|
13022 | }
|
13023 | getKeyForEncryption(key) {
|
13024 | return crypto_service_awaiter(this, void 0, void 0, function* () {
|
13025 | if (key != null) {
|
13026 | return key;
|
13027 | }
|
13028 | const encKey = yield this.getEncKey();
|
13029 | if (encKey != null) {
|
13030 | return encKey;
|
13031 | }
|
13032 | return yield this.getKey();
|
13033 | });
|
13034 | }
|
13035 | resolveLegacyKey(encType, key) {
|
13036 | if (encType === EncryptionType.AesCbc128_HmacSha256_B64 &&
|
13037 | key.encType === EncryptionType.AesCbc256_B64) {
|
13038 |
|
13039 | if (this.legacyEtmKey == null) {
|
13040 | this.legacyEtmKey = new symmetricCryptoKey_SymmetricCryptoKey(key.key, EncryptionType.AesCbc128_HmacSha256_B64);
|
13041 | }
|
13042 | return this.legacyEtmKey;
|
13043 | }
|
13044 | return key;
|
13045 | }
|
13046 | stretchKey(key) {
|
13047 | return crypto_service_awaiter(this, void 0, void 0, function* () {
|
13048 | const newKey = new Uint8Array(64);
|
13049 | newKey.set(yield this.hkdfExpand(key.key, utils_Utils.fromUtf8ToArray('enc'), 32));
|
13050 | newKey.set(yield this.hkdfExpand(key.key, utils_Utils.fromUtf8ToArray('mac'), 32), 32);
|
13051 | return new symmetricCryptoKey_SymmetricCryptoKey(newKey.buffer);
|
13052 | });
|
13053 | }
|
13054 |
|
13055 | hkdfExpand(prk, info, size) {
|
13056 | return crypto_service_awaiter(this, void 0, void 0, function* () {
|
13057 | const hashLen = 32;
|
13058 | const okm = new Uint8Array(size);
|
13059 | let previousT = new Uint8Array(0);
|
13060 | const n = Math.ceil(size / hashLen);
|
13061 | for (let i = 0; i < n; i++) {
|
13062 | const t = new Uint8Array(previousT.length + info.length + 1);
|
13063 | t.set(previousT);
|
13064 | t.set(info, previousT.length);
|
13065 | t.set([i + 1], t.length - 1);
|
13066 | previousT = new Uint8Array(yield this.cryptoFunctionService.hmac(t.buffer, prk, 'sha256'));
|
13067 | okm.set(previousT, i * hashLen);
|
13068 | }
|
13069 | return okm;
|
13070 | });
|
13071 | }
|
13072 | hashPhrase(hash, minimumEntropy = 64) {
|
13073 | return crypto_service_awaiter(this, void 0, void 0, function* () {
|
13074 | const entropyPerWord = Math.log(EEFLongWordList.length) / Math.log(2);
|
13075 | let numWords = Math.ceil(minimumEntropy / entropyPerWord);
|
13076 | const hashArr = Array.from(new Uint8Array(hash));
|
13077 | const entropyAvailable = hashArr.length * 4;
|
13078 | if (numWords * entropyPerWord > entropyAvailable) {
|
13079 | throw new Error('Output entropy of hash function is too small');
|
13080 | }
|
13081 | const phrase = [];
|
13082 | let hashNumber = external_big_integer_["fromArray"](hashArr, 256);
|
13083 | while (numWords--) {
|
13084 | const remainder = hashNumber.mod(EEFLongWordList.length);
|
13085 | hashNumber = hashNumber.divide(EEFLongWordList.length);
|
13086 | phrase.push(EEFLongWordList[remainder]);
|
13087 | }
|
13088 | return phrase;
|
13089 | });
|
13090 | }
|
13091 | buildEncKey(key, encKey) {
|
13092 | return crypto_service_awaiter(this, void 0, void 0, function* () {
|
13093 | let encKeyEnc = null;
|
13094 | if (key.key.byteLength === 32) {
|
13095 | const newKey = yield this.stretchKey(key);
|
13096 | encKeyEnc = yield this.encrypt(encKey, newKey);
|
13097 | }
|
13098 | else if (key.key.byteLength === 64) {
|
13099 | encKeyEnc = yield this.encrypt(encKey, key);
|
13100 | }
|
13101 | else {
|
13102 | throw new Error('Invalid key size.');
|
13103 | }
|
13104 | return [new symmetricCryptoKey_SymmetricCryptoKey(encKey), encKeyEnc];
|
13105 | });
|
13106 | }
|
13107 | }
|
13108 | crypto_service_decorate([
|
13109 | sequentialize(() => 'getEncKey'),
|
13110 | crypto_service_metadata("design:type", Function),
|
13111 | crypto_service_metadata("design:paramtypes", [symmetricCryptoKey_SymmetricCryptoKey]),
|
13112 | crypto_service_metadata("design:returntype", Promise)
|
13113 | ], crypto_service_CryptoService.prototype, "getEncKey", null);
|
13114 | crypto_service_decorate([
|
13115 | sequentialize(() => 'getOrgKeys'),
|
13116 | crypto_service_metadata("design:type", Function),
|
13117 | crypto_service_metadata("design:paramtypes", []),
|
13118 | crypto_service_metadata("design:returntype", Promise)
|
13119 | ], crypto_service_CryptoService.prototype, "getOrgKeys", null);
|
13120 |
|
13121 |
|
13122 | var environment_service_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
13123 | return new (P || (P = Promise))(function (resolve, reject) {
|
13124 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
13125 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
13126 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
13127 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
13128 | });
|
13129 | };
|
13130 |
|
13131 |
|
13132 | class environment_service_EnvironmentService {
|
13133 | constructor(apiService, storageService, notificationsService) {
|
13134 | this.apiService = apiService;
|
13135 | this.storageService = storageService;
|
13136 | this.notificationsService = notificationsService;
|
13137 | }
|
13138 | getWebVaultUrl() {
|
13139 | if (this.webVaultUrl != null) {
|
13140 | return this.webVaultUrl;
|
13141 | }
|
13142 | else if (this.baseUrl) {
|
13143 | return this.baseUrl;
|
13144 | }
|
13145 | return null;
|
13146 | }
|
13147 | setUrlsFromStorage() {
|
13148 | return environment_service_awaiter(this, void 0, void 0, function* () {
|
13149 | const urlsObj = yield this.storageService.get(ConstantsService.environmentUrlsKey);
|
13150 | const urls = urlsObj || {
|
13151 | base: null,
|
13152 | api: null,
|
13153 | identity: null,
|
13154 | icons: null,
|
13155 | notifications: null,
|
13156 | events: null,
|
13157 | webVault: null,
|
13158 | };
|
13159 | const envUrls = new EnvironmentUrls();
|
13160 | if (urls.base) {
|
13161 | this.baseUrl = envUrls.base = urls.base;
|
13162 | this.apiService.setUrls(envUrls);
|
13163 | return;
|
13164 | }
|
13165 | this.webVaultUrl = urls.webVault;
|
13166 | this.apiUrl = envUrls.api = urls.api;
|
13167 | this.identityUrl = envUrls.identity = urls.identity;
|
13168 | this.iconsUrl = urls.icons;
|
13169 | this.notificationsUrl = urls.notifications;
|
13170 | this.eventsUrl = envUrls.events = urls.events;
|
13171 | this.apiService.setUrls(envUrls);
|
13172 | });
|
13173 | }
|
13174 | setUrls(urls) {
|
13175 | return environment_service_awaiter(this, void 0, void 0, function* () {
|
13176 | urls.base = this.formatUrl(urls.base);
|
13177 | urls.webVault = this.formatUrl(urls.webVault);
|
13178 | urls.api = this.formatUrl(urls.api);
|
13179 | urls.identity = this.formatUrl(urls.identity);
|
13180 | urls.icons = this.formatUrl(urls.icons);
|
13181 | urls.notifications = this.formatUrl(urls.notifications);
|
13182 | urls.events = this.formatUrl(urls.events);
|
13183 | yield this.storageService.save(ConstantsService.environmentUrlsKey, {
|
13184 | base: urls.base,
|
13185 | api: urls.api,
|
13186 | identity: urls.identity,
|
13187 | webVault: urls.webVault,
|
13188 | icons: urls.icons,
|
13189 | notifications: urls.notifications,
|
13190 | events: urls.events,
|
13191 | });
|
13192 | this.baseUrl = urls.base;
|
13193 | this.webVaultUrl = urls.webVault;
|
13194 | this.apiUrl = urls.api;
|
13195 | this.identityUrl = urls.identity;
|
13196 | this.iconsUrl = urls.icons;
|
13197 | this.notificationsUrl = urls.notifications;
|
13198 | this.eventsUrl = urls.events;
|
13199 | const envUrls = new EnvironmentUrls();
|
13200 | if (this.baseUrl) {
|
13201 | envUrls.base = this.baseUrl;
|
13202 | }
|
13203 | else {
|
13204 | envUrls.api = this.apiUrl;
|
13205 | envUrls.identity = this.identityUrl;
|
13206 | envUrls.events = this.eventsUrl;
|
13207 | }
|
13208 | this.apiService.setUrls(envUrls);
|
13209 | if (this.notificationsService != null) {
|
13210 | this.notificationsService.init(this);
|
13211 | }
|
13212 | return urls;
|
13213 | });
|
13214 | }
|
13215 | formatUrl(url) {
|
13216 | if (url == null || url === '') {
|
13217 | return null;
|
13218 | }
|
13219 | url = url.replace(/\/+$/g, '');
|
13220 | if (!url.startsWith('http://') && !url.startsWith('https://')) {
|
13221 | url = 'https://' + url;
|
13222 | }
|
13223 | return url.trim();
|
13224 | }
|
13225 | }
|
13226 |
|
13227 |
|
13228 | var external_papaparse_ = __webpack_require__(8);
|
13229 |
|
13230 |
|
13231 |
|
13232 | class export_card_Card {
|
13233 | static template() {
|
13234 | const req = new export_card_Card();
|
13235 | req.cardholderName = 'John Doe';
|
13236 | req.brand = 'visa';
|
13237 | req.number = '4242424242424242';
|
13238 | req.expMonth = '04';
|
13239 | req.expYear = '2023';
|
13240 | req.code = '123';
|
13241 | return req;
|
13242 | }
|
13243 | static toView(req, view = new CardView()) {
|
13244 | view.cardholderName = req.cardholderName;
|
13245 | view.brand = req.brand;
|
13246 | view.number = req.number;
|
13247 | view.expMonth = req.expMonth;
|
13248 | view.expYear = req.expYear;
|
13249 | view.code = req.code;
|
13250 | return view;
|
13251 | }
|
13252 | constructor(o) {
|
13253 | if (o == null) {
|
13254 | return;
|
13255 | }
|
13256 | this.cardholderName = o.cardholderName;
|
13257 | this.brand = o.brand;
|
13258 | this.number = o.number;
|
13259 | this.expMonth = o.expMonth;
|
13260 | this.expYear = o.expYear;
|
13261 | this.code = o.code;
|
13262 | }
|
13263 | }
|
13264 |
|
13265 |
|
13266 |
|
13267 |
|
13268 | class export_field_Field {
|
13269 | static template() {
|
13270 | const req = new export_field_Field();
|
13271 | req.name = 'Field name';
|
13272 | req.value = 'Some value';
|
13273 | req.type = FieldType.Text;
|
13274 | return req;
|
13275 | }
|
13276 | static toView(req, view = new FieldView()) {
|
13277 | view.type = req.type;
|
13278 | view.value = req.value;
|
13279 | view.name = req.name;
|
13280 | return view;
|
13281 | }
|
13282 | constructor(o) {
|
13283 | if (o == null) {
|
13284 | return;
|
13285 | }
|
13286 | this.name = o.name;
|
13287 | this.value = o.value;
|
13288 | this.type = o.type;
|
13289 | }
|
13290 | }
|
13291 |
|
13292 |
|
13293 |
|
13294 | class export_identity_Identity {
|
13295 | static template() {
|
13296 | const req = new export_identity_Identity();
|
13297 | req.title = 'Mr';
|
13298 | req.firstName = 'John';
|
13299 | req.middleName = 'William';
|
13300 | req.lastName = 'Doe';
|
13301 | req.address1 = '123 Any St';
|
13302 | req.address2 = 'Apt #123';
|
13303 | req.address3 = null;
|
13304 | req.city = 'New York';
|
13305 | req.state = 'NY';
|
13306 | req.postalCode = '10001';
|
13307 | req.country = 'US';
|
13308 | req.company = 'Acme Inc.';
|
13309 | req.email = 'john@company.com';
|
13310 | req.phone = '5555551234';
|
13311 | req.ssn = '000-123-4567';
|
13312 | req.username = 'jdoe';
|
13313 | req.passportNumber = 'US-123456789';
|
13314 | req.licenseNumber = 'D123-12-123-12333';
|
13315 | return req;
|
13316 | }
|
13317 | static toView(req, view = new identityView_IdentityView()) {
|
13318 | view.title = req.title;
|
13319 | view.firstName = req.firstName;
|
13320 | view.middleName = req.middleName;
|
13321 | view.lastName = req.lastName;
|
13322 | view.address1 = req.address1;
|
13323 | view.address2 = req.address2;
|
13324 | view.address3 = req.address3;
|
13325 | view.city = req.city;
|
13326 | view.state = req.state;
|
13327 | view.postalCode = req.postalCode;
|
13328 | view.country = req.country;
|
13329 | view.company = req.company;
|
13330 | view.email = req.email;
|
13331 | view.phone = req.phone;
|
13332 | view.ssn = req.ssn;
|
13333 | view.username = req.username;
|
13334 | view.passportNumber = req.passportNumber;
|
13335 | view.licenseNumber = req.licenseNumber;
|
13336 | return view;
|
13337 | }
|
13338 | constructor(o) {
|
13339 | if (o == null) {
|
13340 | return;
|
13341 | }
|
13342 | this.title = o.title;
|
13343 | this.firstName = o.firstName;
|
13344 | this.middleName = o.middleName;
|
13345 | this.lastName = o.lastName;
|
13346 | this.address1 = o.address1;
|
13347 | this.address2 = o.address2;
|
13348 | this.address3 = o.address3;
|
13349 | this.city = o.city;
|
13350 | this.state = o.state;
|
13351 | this.postalCode = o.postalCode;
|
13352 | this.country = o.country;
|
13353 | this.company = o.company;
|
13354 | this.email = o.email;
|
13355 | this.phone = o.phone;
|
13356 | this.ssn = o.ssn;
|
13357 | this.username = o.username;
|
13358 | this.passportNumber = o.passportNumber;
|
13359 | this.licenseNumber = o.licenseNumber;
|
13360 | }
|
13361 | }
|
13362 |
|
13363 |
|
13364 |
|
13365 | class export_loginUri_LoginUri {
|
13366 | constructor(o) {
|
13367 | this.match = null;
|
13368 | if (o == null) {
|
13369 | return;
|
13370 | }
|
13371 | this.uri = o.uri;
|
13372 | this.match = o.match;
|
13373 | }
|
13374 | static template() {
|
13375 | const req = new export_loginUri_LoginUri();
|
13376 | req.uri = 'https://google.com';
|
13377 | req.match = null;
|
13378 | return req;
|
13379 | }
|
13380 | static toView(req, view = new loginUriView_LoginUriView()) {
|
13381 | view.uri = req.uri;
|
13382 | view.match = req.match;
|
13383 | return view;
|
13384 | }
|
13385 | }
|
13386 |
|
13387 |
|
13388 |
|
13389 |
|
13390 | class export_login_Login {
|
13391 | static template() {
|
13392 | const req = new export_login_Login();
|
13393 | req.uris = [];
|
13394 | req.username = 'jdoe';
|
13395 | req.password = 'myp@ssword123';
|
13396 | req.totp = 'JBSWY3DPEHPK3PXP';
|
13397 | return req;
|
13398 | }
|
13399 | static toView(req, view = new LoginView()) {
|
13400 | if (req.uris != null) {
|
13401 | view.uris = req.uris.map((u) => export_loginUri_LoginUri.toView(u));
|
13402 | }
|
13403 | view.username = req.username;
|
13404 | view.password = req.password;
|
13405 | view.totp = req.totp;
|
13406 | return view;
|
13407 | }
|
13408 | constructor(o) {
|
13409 | if (o == null) {
|
13410 | return;
|
13411 | }
|
13412 | if (o.uris != null) {
|
13413 | this.uris = o.uris.map((u) => new export_loginUri_LoginUri(u));
|
13414 | }
|
13415 | this.username = o.username;
|
13416 | this.password = o.password;
|
13417 | this.totp = o.totp;
|
13418 | }
|
13419 | }
|
13420 |
|
13421 |
|
13422 | var SecureNoteType;
|
13423 | (function (SecureNoteType) {
|
13424 | SecureNoteType[SecureNoteType["Generic"] = 0] = "Generic";
|
13425 | })(SecureNoteType || (SecureNoteType = {}));
|
13426 |
|
13427 |
|
13428 |
|
13429 |
|
13430 | class export_secureNote_SecureNote {
|
13431 | static template() {
|
13432 | const req = new export_secureNote_SecureNote();
|
13433 | req.type = SecureNoteType.Generic;
|
13434 | return req;
|
13435 | }
|
13436 | static toView(req, view = new SecureNoteView()) {
|
13437 | view.type = req.type;
|
13438 | return view;
|
13439 | }
|
13440 | constructor(o) {
|
13441 | if (o == null) {
|
13442 | return;
|
13443 | }
|
13444 | this.type = o.type;
|
13445 | }
|
13446 | }
|
13447 |
|
13448 |
|
13449 |
|
13450 |
|
13451 |
|
13452 |
|
13453 |
|
13454 |
|
13455 |
|
13456 | class export_cipher_Cipher {
|
13457 | static template() {
|
13458 | const req = new export_cipher_Cipher();
|
13459 | req.organizationId = null;
|
13460 | req.folderId = null;
|
13461 | req.type = CipherType.Login;
|
13462 | req.name = 'Item name';
|
13463 | req.notes = 'Some notes about this item.';
|
13464 | req.favorite = false;
|
13465 | req.fields = [];
|
13466 | req.login = null;
|
13467 | req.secureNote = null;
|
13468 | req.card = null;
|
13469 | req.identity = null;
|
13470 | return req;
|
13471 | }
|
13472 | static toView(req, view = new cipherView_CipherView()) {
|
13473 | view.type = req.type;
|
13474 | view.folderId = req.folderId;
|
13475 | if (view.organizationId == null) {
|
13476 | view.organizationId = req.organizationId;
|
13477 | }
|
13478 | view.name = req.name;
|
13479 | view.notes = req.notes;
|
13480 | view.favorite = req.favorite;
|
13481 | if (req.fields != null) {
|
13482 | view.fields = req.fields.map((f) => export_field_Field.toView(f));
|
13483 | }
|
13484 | switch (req.type) {
|
13485 | case CipherType.Login:
|
13486 | view.login = export_login_Login.toView(req.login);
|
13487 | break;
|
13488 | case CipherType.SecureNote:
|
13489 | view.secureNote = export_secureNote_SecureNote.toView(req.secureNote);
|
13490 | break;
|
13491 | case CipherType.Card:
|
13492 | view.card = export_card_Card.toView(req.card);
|
13493 | break;
|
13494 | case CipherType.Identity:
|
13495 | view.identity = export_identity_Identity.toView(req.identity);
|
13496 | break;
|
13497 | }
|
13498 | return view;
|
13499 | }
|
13500 |
|
13501 | build(o) {
|
13502 | this.organizationId = o.organizationId;
|
13503 | this.folderId = o.folderId;
|
13504 | this.type = o.type;
|
13505 | this.name = o.name;
|
13506 | this.notes = o.notes;
|
13507 | this.favorite = o.favorite;
|
13508 | if (o.fields != null) {
|
13509 | this.fields = o.fields.map((f) => new export_field_Field(f));
|
13510 | }
|
13511 | switch (o.type) {
|
13512 | case CipherType.Login:
|
13513 | this.login = new export_login_Login(o.login);
|
13514 | break;
|
13515 | case CipherType.SecureNote:
|
13516 | this.secureNote = new export_secureNote_SecureNote(o.secureNote);
|
13517 | break;
|
13518 | case CipherType.Card:
|
13519 | this.card = new export_card_Card(o.card);
|
13520 | break;
|
13521 | case CipherType.Identity:
|
13522 | this.identity = new export_identity_Identity(o.identity);
|
13523 | break;
|
13524 | }
|
13525 | }
|
13526 | }
|
13527 |
|
13528 |
|
13529 |
|
13530 | class cipherWithIds_CipherWithIds extends export_cipher_Cipher {
|
13531 |
|
13532 | build(o) {
|
13533 | this.id = o.id;
|
13534 | super.build(o);
|
13535 | this.collectionIds = o.collectionIds;
|
13536 | }
|
13537 | }
|
13538 |
|
13539 |
|
13540 |
|
13541 | class export_collection_Collection {
|
13542 | static template() {
|
13543 | const req = new export_collection_Collection();
|
13544 | req.organizationId = '00000000-0000-0000-0000-000000000000';
|
13545 | req.name = 'Collection name';
|
13546 | req.externalId = null;
|
13547 | return req;
|
13548 | }
|
13549 | static toView(req, view = new collectionView_CollectionView()) {
|
13550 | view.name = req.name;
|
13551 | view.externalId = req.externalId;
|
13552 | if (view.organizationId == null) {
|
13553 | view.organizationId = req.organizationId;
|
13554 | }
|
13555 | return view;
|
13556 | }
|
13557 |
|
13558 | build(o) {
|
13559 | this.organizationId = o.organizationId;
|
13560 | this.name = o.name;
|
13561 | this.externalId = o.externalId;
|
13562 | }
|
13563 | }
|
13564 |
|
13565 |
|
13566 |
|
13567 | class collectionWithId_CollectionWithId extends export_collection_Collection {
|
13568 |
|
13569 | build(o) {
|
13570 | this.id = o.id;
|
13571 | super.build(o);
|
13572 | }
|
13573 | }
|
13574 |
|
13575 |
|
13576 |
|
13577 | class export_folder_Folder {
|
13578 | static template() {
|
13579 | const req = new export_folder_Folder();
|
13580 | req.name = 'Folder name';
|
13581 | return req;
|
13582 | }
|
13583 | static toView(req, view = new FolderView()) {
|
13584 | view.name = req.name;
|
13585 | return view;
|
13586 | }
|
13587 |
|
13588 | build(o) {
|
13589 | this.name = o.name;
|
13590 | }
|
13591 | }
|
13592 |
|
13593 |
|
13594 |
|
13595 | class folderWithId_FolderWithId extends export_folder_Folder {
|
13596 |
|
13597 | build(o) {
|
13598 | this.id = o.id;
|
13599 | super.build(o);
|
13600 | }
|
13601 | }
|
13602 |
|
13603 |
|
13604 | var export_service_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
13605 | return new (P || (P = Promise))(function (resolve, reject) {
|
13606 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
13607 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
13608 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
13609 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
13610 | });
|
13611 | };
|
13612 |
|
13613 |
|
13614 |
|
13615 |
|
13616 |
|
13617 |
|
13618 |
|
13619 |
|
13620 |
|
13621 | class export_service_ExportService {
|
13622 | constructor(folderService, cipherService, apiService) {
|
13623 | this.folderService = folderService;
|
13624 | this.cipherService = cipherService;
|
13625 | this.apiService = apiService;
|
13626 | }
|
13627 | getExport(format = 'csv') {
|
13628 | return export_service_awaiter(this, void 0, void 0, function* () {
|
13629 | let decFolders = [];
|
13630 | let decCiphers = [];
|
13631 | const promises = [];
|
13632 | promises.push(this.folderService.getAllDecrypted().then((folders) => {
|
13633 | decFolders = folders;
|
13634 | }));
|
13635 | promises.push(this.cipherService.getAllDecrypted().then((ciphers) => {
|
13636 | decCiphers = ciphers;
|
13637 | }));
|
13638 | yield Promise.all(promises);
|
13639 | if (format === 'csv') {
|
13640 | const foldersMap = new Map();
|
13641 | decFolders.forEach((f) => {
|
13642 | if (f.id != null) {
|
13643 | foldersMap.set(f.id, f);
|
13644 | }
|
13645 | });
|
13646 | const exportCiphers = [];
|
13647 | decCiphers.forEach((c) => {
|
13648 |
|
13649 | if (c.type !== CipherType.Login && c.type !== CipherType.SecureNote) {
|
13650 | return;
|
13651 | }
|
13652 | if (c.organizationId != null) {
|
13653 | return;
|
13654 | }
|
13655 | const cipher = {};
|
13656 | cipher.folder = c.folderId != null && foldersMap.has(c.folderId) ?
|
13657 | foldersMap.get(c.folderId).name : null;
|
13658 | cipher.favorite = c.favorite ? 1 : null;
|
13659 | this.buildCommonCipher(cipher, c);
|
13660 | exportCiphers.push(cipher);
|
13661 | });
|
13662 | return external_papaparse_["unparse"](exportCiphers);
|
13663 | }
|
13664 | else {
|
13665 | const jsonDoc = {
|
13666 | folders: [],
|
13667 | items: [],
|
13668 | };
|
13669 | decFolders.forEach((f) => {
|
13670 | if (f.id == null) {
|
13671 | return;
|
13672 | }
|
13673 | const folder = new folderWithId_FolderWithId();
|
13674 | folder.build(f);
|
13675 | jsonDoc.folders.push(folder);
|
13676 | });
|
13677 | decCiphers.forEach((c) => {
|
13678 | if (c.organizationId != null) {
|
13679 | return;
|
13680 | }
|
13681 | const cipher = new cipherWithIds_CipherWithIds();
|
13682 | cipher.build(c);
|
13683 | cipher.collectionIds = null;
|
13684 | jsonDoc.items.push(cipher);
|
13685 | });
|
13686 | return JSON.stringify(jsonDoc, null, ' ');
|
13687 | }
|
13688 | });
|
13689 | }
|
13690 | getOrganizationExport(organizationId, format = 'csv') {
|
13691 | return export_service_awaiter(this, void 0, void 0, function* () {
|
13692 | const decCollections = [];
|
13693 | const decCiphers = [];
|
13694 | const promises = [];
|
13695 | promises.push(this.apiService.getCollections(organizationId).then((collections) => {
|
13696 | const collectionPromises = [];
|
13697 | if (collections != null && collections.data != null && collections.data.length > 0) {
|
13698 | collections.data.forEach((c) => {
|
13699 | const collection = new collection_Collection(new CollectionData(c));
|
13700 | collectionPromises.push(collection.decrypt().then((decCol) => {
|
13701 | decCollections.push(decCol);
|
13702 | }));
|
13703 | });
|
13704 | }
|
13705 | return Promise.all(collectionPromises);
|
13706 | }));
|
13707 | promises.push(this.apiService.getCiphersOrganization(organizationId).then((ciphers) => {
|
13708 | const cipherPromises = [];
|
13709 | if (ciphers != null && ciphers.data != null && ciphers.data.length > 0) {
|
13710 | ciphers.data.forEach((c) => {
|
13711 | const cipher = new cipher_Cipher(new cipherData_CipherData(c));
|
13712 | cipherPromises.push(cipher.decrypt().then((decCipher) => {
|
13713 | decCiphers.push(decCipher);
|
13714 | }));
|
13715 | });
|
13716 | }
|
13717 | return Promise.all(cipherPromises);
|
13718 | }));
|
13719 | yield Promise.all(promises);
|
13720 | if (format === 'csv') {
|
13721 | const collectionsMap = new Map();
|
13722 | decCollections.forEach((c) => {
|
13723 | collectionsMap.set(c.id, c);
|
13724 | });
|
13725 | const exportCiphers = [];
|
13726 | decCiphers.forEach((c) => {
|
13727 |
|
13728 | if (c.type !== CipherType.Login && c.type !== CipherType.SecureNote) {
|
13729 | return;
|
13730 | }
|
13731 | const cipher = {};
|
13732 | cipher.collections = [];
|
13733 | if (c.collectionIds != null) {
|
13734 | cipher.collections = c.collectionIds.filter((id) => collectionsMap.has(id))
|
13735 | .map((id) => collectionsMap.get(id).name);
|
13736 | }
|
13737 | this.buildCommonCipher(cipher, c);
|
13738 | exportCiphers.push(cipher);
|
13739 | });
|
13740 | return external_papaparse_["unparse"](exportCiphers);
|
13741 | }
|
13742 | else {
|
13743 | const jsonDoc = {
|
13744 | collections: [],
|
13745 | items: [],
|
13746 | };
|
13747 | decCollections.forEach((c) => {
|
13748 | const collection = new collectionWithId_CollectionWithId();
|
13749 | collection.build(c);
|
13750 | jsonDoc.collections.push(collection);
|
13751 | });
|
13752 | decCiphers.forEach((c) => {
|
13753 | const cipher = new cipherWithIds_CipherWithIds();
|
13754 | cipher.build(c);
|
13755 | jsonDoc.items.push(cipher);
|
13756 | });
|
13757 | return JSON.stringify(jsonDoc, null, ' ');
|
13758 | }
|
13759 | });
|
13760 | }
|
13761 | getFileName(prefix = null, extension = 'csv') {
|
13762 | const now = new Date();
|
13763 | const dateString = now.getFullYear() + '' + this.padNumber(now.getMonth() + 1, 2) + '' + this.padNumber(now.getDate(), 2) +
|
13764 | this.padNumber(now.getHours(), 2) + '' + this.padNumber(now.getMinutes(), 2) +
|
13765 | this.padNumber(now.getSeconds(), 2);
|
13766 | return 'bitwarden' + (prefix ? ('_' + prefix) : '') + '_export_' + dateString + '.' + extension;
|
13767 | }
|
13768 | padNumber(num, width, padCharacter = '0') {
|
13769 | const numString = num.toString();
|
13770 | return numString.length >= width ? numString :
|
13771 | new Array(width - numString.length + 1).join(padCharacter) + numString;
|
13772 | }
|
13773 | buildCommonCipher(cipher, c) {
|
13774 | cipher.type = null;
|
13775 | cipher.name = c.name;
|
13776 | cipher.notes = c.notes;
|
13777 | cipher.fields = null;
|
13778 |
|
13779 | cipher.login_uri = null;
|
13780 | cipher.login_username = null;
|
13781 | cipher.login_password = null;
|
13782 | cipher.login_totp = null;
|
13783 | if (c.fields) {
|
13784 | c.fields.forEach((f) => {
|
13785 | if (!cipher.fields) {
|
13786 | cipher.fields = '';
|
13787 | }
|
13788 | else {
|
13789 | cipher.fields += '\n';
|
13790 | }
|
13791 | cipher.fields += ((f.name || '') + ': ' + f.value);
|
13792 | });
|
13793 | }
|
13794 | switch (c.type) {
|
13795 | case CipherType.Login:
|
13796 | cipher.type = 'login';
|
13797 | cipher.login_username = c.login.username;
|
13798 | cipher.login_password = c.login.password;
|
13799 | cipher.login_totp = c.login.totp;
|
13800 | if (c.login.uris) {
|
13801 | cipher.login_uri = [];
|
13802 | c.login.uris.forEach((u) => {
|
13803 | cipher.login_uri.push(u.uri);
|
13804 | });
|
13805 | }
|
13806 | break;
|
13807 | case CipherType.SecureNote:
|
13808 | cipher.type = 'note';
|
13809 | break;
|
13810 | default:
|
13811 | return;
|
13812 | }
|
13813 | return cipher;
|
13814 | }
|
13815 | }
|
13816 |
|
13817 |
|
13818 | class FolderData {
|
13819 | constructor(response, userId) {
|
13820 | this.userId = userId;
|
13821 | this.name = response.name;
|
13822 | this.id = response.id;
|
13823 | this.revisionDate = response.revisionDate;
|
13824 | }
|
13825 | }
|
13826 |
|
13827 |
|
13828 | class FolderRequest {
|
13829 | constructor(folder) {
|
13830 | this.name = folder.name ? folder.name.encryptedString : null;
|
13831 | }
|
13832 | }
|
13833 |
|
13834 |
|
13835 | var folder_service_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
13836 | return new (P || (P = Promise))(function (resolve, reject) {
|
13837 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
13838 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
13839 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
13840 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
13841 | });
|
13842 | };
|
13843 |
|
13844 |
|
13845 |
|
13846 |
|
13847 |
|
13848 |
|
13849 | const folder_service_Keys = {
|
13850 | foldersPrefix: 'folders_',
|
13851 | ciphersPrefix: 'ciphers_',
|
13852 | };
|
13853 | const folder_service_NestingDelimiter = '/';
|
13854 | class folder_service_FolderService {
|
13855 | constructor(cryptoService, userService, apiService, storageService, i18nService, cipherService) {
|
13856 | this.cryptoService = cryptoService;
|
13857 | this.userService = userService;
|
13858 | this.apiService = apiService;
|
13859 | this.storageService = storageService;
|
13860 | this.i18nService = i18nService;
|
13861 | this.cipherService = cipherService;
|
13862 | }
|
13863 | clearCache() {
|
13864 | this.decryptedFolderCache = null;
|
13865 | }
|
13866 | encrypt(model, key) {
|
13867 | return folder_service_awaiter(this, void 0, void 0, function* () {
|
13868 | const folder = new folder_Folder();
|
13869 | folder.id = model.id;
|
13870 | folder.name = yield this.cryptoService.encrypt(model.name, key);
|
13871 | return folder;
|
13872 | });
|
13873 | }
|
13874 | get(id) {
|
13875 | return folder_service_awaiter(this, void 0, void 0, function* () {
|
13876 | const userId = yield this.userService.getUserId();
|
13877 | const folders = yield this.storageService.get(folder_service_Keys.foldersPrefix + userId);
|
13878 | if (folders == null || !folders.hasOwnProperty(id)) {
|
13879 | return null;
|
13880 | }
|
13881 | return new folder_Folder(folders[id]);
|
13882 | });
|
13883 | }
|
13884 | getAll() {
|
13885 | return folder_service_awaiter(this, void 0, void 0, function* () {
|
13886 | const userId = yield this.userService.getUserId();
|
13887 | const folders = yield this.storageService.get(folder_service_Keys.foldersPrefix + userId);
|
13888 | const response = [];
|
13889 | for (const id in folders) {
|
13890 | if (folders.hasOwnProperty(id)) {
|
13891 | response.push(new folder_Folder(folders[id]));
|
13892 | }
|
13893 | }
|
13894 | return response;
|
13895 | });
|
13896 | }
|
13897 | getAllDecrypted() {
|
13898 | return folder_service_awaiter(this, void 0, void 0, function* () {
|
13899 | if (this.decryptedFolderCache != null) {
|
13900 | return this.decryptedFolderCache;
|
13901 | }
|
13902 | const hasKey = yield this.cryptoService.hasKey();
|
13903 | if (!hasKey) {
|
13904 | throw new Error('No key.');
|
13905 | }
|
13906 | const decFolders = [];
|
13907 | const promises = [];
|
13908 | const folders = yield this.getAll();
|
13909 | folders.forEach((folder) => {
|
13910 | promises.push(folder.decrypt().then((f) => decFolders.push(f)));
|
13911 | });
|
13912 | yield Promise.all(promises);
|
13913 | decFolders.sort(utils_Utils.getSortFunction(this.i18nService, 'name'));
|
13914 | const noneFolder = new FolderView();
|
13915 | noneFolder.name = this.i18nService.t('noneFolder');
|
13916 | decFolders.push(noneFolder);
|
13917 | this.decryptedFolderCache = decFolders;
|
13918 | return this.decryptedFolderCache;
|
13919 | });
|
13920 | }
|
13921 | getAllNested() {
|
13922 | return folder_service_awaiter(this, void 0, void 0, function* () {
|
13923 | const folders = yield this.getAllDecrypted();
|
13924 | const nodes = [];
|
13925 | folders.forEach((f) => {
|
13926 | const folderCopy = new FolderView();
|
13927 | folderCopy.id = f.id;
|
13928 | folderCopy.revisionDate = f.revisionDate;
|
13929 | const parts = f.name != null ? f.name.replace(/^\/+|\/+$/g, '').split(folder_service_NestingDelimiter) : [];
|
13930 | serviceUtils_ServiceUtils.nestedTraverse(nodes, 0, parts, folderCopy, null, folder_service_NestingDelimiter);
|
13931 | });
|
13932 | return nodes;
|
13933 | });
|
13934 | }
|
13935 | getNested(id) {
|
13936 | return folder_service_awaiter(this, void 0, void 0, function* () {
|
13937 | const folders = yield this.getAllNested();
|
13938 | return serviceUtils_ServiceUtils.getTreeNodeObject(folders, id);
|
13939 | });
|
13940 | }
|
13941 | saveWithServer(folder) {
|
13942 | return folder_service_awaiter(this, void 0, void 0, function* () {
|
13943 | const request = new FolderRequest(folder);
|
13944 | let response;
|
13945 | if (folder.id == null) {
|
13946 | response = yield this.apiService.postFolder(request);
|
13947 | folder.id = response.id;
|
13948 | }
|
13949 | else {
|
13950 | response = yield this.apiService.putFolder(folder.id, request);
|
13951 | }
|
13952 | const userId = yield this.userService.getUserId();
|
13953 | const data = new FolderData(response, userId);
|
13954 | yield this.upsert(data);
|
13955 | });
|
13956 | }
|
13957 | upsert(folder) {
|
13958 | return folder_service_awaiter(this, void 0, void 0, function* () {
|
13959 | const userId = yield this.userService.getUserId();
|
13960 | let folders = yield this.storageService.get(folder_service_Keys.foldersPrefix + userId);
|
13961 | if (folders == null) {
|
13962 | folders = {};
|
13963 | }
|
13964 | if (folder instanceof FolderData) {
|
13965 | const f = folder;
|
13966 | folders[f.id] = f;
|
13967 | }
|
13968 | else {
|
13969 | folder.forEach((f) => {
|
13970 | folders[f.id] = f;
|
13971 | });
|
13972 | }
|
13973 | yield this.storageService.save(folder_service_Keys.foldersPrefix + userId, folders);
|
13974 | this.decryptedFolderCache = null;
|
13975 | });
|
13976 | }
|
13977 | replace(folders) {
|
13978 | return folder_service_awaiter(this, void 0, void 0, function* () {
|
13979 | const userId = yield this.userService.getUserId();
|
13980 | yield this.storageService.save(folder_service_Keys.foldersPrefix + userId, folders);
|
13981 | this.decryptedFolderCache = null;
|
13982 | });
|
13983 | }
|
13984 | clear(userId) {
|
13985 | return folder_service_awaiter(this, void 0, void 0, function* () {
|
13986 | yield this.storageService.remove(folder_service_Keys.foldersPrefix + userId);
|
13987 | this.decryptedFolderCache = null;
|
13988 | });
|
13989 | }
|
13990 | delete(id) {
|
13991 | return folder_service_awaiter(this, void 0, void 0, function* () {
|
13992 | const userId = yield this.userService.getUserId();
|
13993 | const folders = yield this.storageService.get(folder_service_Keys.foldersPrefix + userId);
|
13994 | if (folders == null) {
|
13995 | return;
|
13996 | }
|
13997 | if (typeof id === 'string') {
|
13998 | if (folders[id] == null) {
|
13999 | return;
|
14000 | }
|
14001 | delete folders[id];
|
14002 | }
|
14003 | else {
|
14004 | id.forEach((i) => {
|
14005 | delete folders[i];
|
14006 | });
|
14007 | }
|
14008 | yield this.storageService.save(folder_service_Keys.foldersPrefix + userId, folders);
|
14009 | this.decryptedFolderCache = null;
|
14010 |
|
14011 | const ciphers = yield this.storageService.get(folder_service_Keys.ciphersPrefix + userId);
|
14012 | if (ciphers != null) {
|
14013 | const updates = [];
|
14014 | for (const cId in ciphers) {
|
14015 | if (ciphers[cId].folderId === id) {
|
14016 | ciphers[cId].folderId = null;
|
14017 | updates.push(ciphers[cId]);
|
14018 | }
|
14019 | }
|
14020 | if (updates.length > 0) {
|
14021 | this.cipherService.upsert(updates);
|
14022 | }
|
14023 | }
|
14024 | });
|
14025 | }
|
14026 | deleteWithServer(id) {
|
14027 | return folder_service_awaiter(this, void 0, void 0, function* () {
|
14028 | yield this.apiService.deleteFolder(id);
|
14029 | yield this.delete(id);
|
14030 | });
|
14031 | }
|
14032 | }
|
14033 |
|
14034 |
|
14035 | class CollectionRequest {
|
14036 | constructor(collection) {
|
14037 | this.groups = [];
|
14038 | if (collection == null) {
|
14039 | return;
|
14040 | }
|
14041 | this.name = collection.name ? collection.name.encryptedString : null;
|
14042 | this.externalId = collection.externalId;
|
14043 | }
|
14044 | }
|
14045 |
|
14046 |
|
14047 | class ImportCiphersRequest {
|
14048 | constructor() {
|
14049 | this.ciphers = [];
|
14050 | this.folders = [];
|
14051 | this.folderRelationships = [];
|
14052 | }
|
14053 | }
|
14054 |
|
14055 |
|
14056 | class ImportOrganizationCiphersRequest {
|
14057 | constructor() {
|
14058 | this.ciphers = [];
|
14059 | this.collections = [];
|
14060 | this.collectionRelationships = [];
|
14061 | }
|
14062 | }
|
14063 |
|
14064 |
|
14065 | class KvpRequest {
|
14066 | constructor(key, value) {
|
14067 | this.key = key;
|
14068 | this.value = value;
|
14069 | }
|
14070 | }
|
14071 |
|
14072 |
|
14073 |
|
14074 |
|
14075 |
|
14076 |
|
14077 |
|
14078 |
|
14079 |
|
14080 |
|
14081 |
|
14082 |
|
14083 |
|
14084 |
|
14085 | class baseImporter_BaseImporter {
|
14086 | constructor() {
|
14087 | this.organization = false;
|
14088 | this.newLineRegex = /(?:\r\n|\r|\n)/;
|
14089 | this.passwordFieldNames = [
|
14090 | 'password', 'pass word', 'passphrase', 'pass phrase',
|
14091 | 'pass', 'code', 'code word', 'codeword',
|
14092 | 'secret', 'secret word', 'personpwd',
|
14093 | 'key', 'keyword', 'key word', 'keyphrase', 'key phrase',
|
14094 | 'form_pw', 'wppassword', 'pin', 'pwd', 'pw', 'pword', 'passwd',
|
14095 | 'p', 'serial', 'serial#', 'license key', 'reg #',
|
14096 |
|
14097 | 'passwort',
|
14098 | ];
|
14099 | this.usernameFieldNames = [
|
14100 | 'user', 'name', 'user name', 'username', 'login name',
|
14101 | 'email', 'e-mail', 'id', 'userid', 'user id',
|
14102 | 'login', 'form_loginname', 'wpname', 'mail',
|
14103 | 'loginid', 'login id', 'log', 'personlogin',
|
14104 | 'first name', 'last name', 'card#', 'account #',
|
14105 | 'member', 'member #',
|
14106 |
|
14107 | 'nom', 'benutzername',
|
14108 | ];
|
14109 | this.notesFieldNames = [
|
14110 | 'note', 'notes', 'comment', 'comments', 'memo',
|
14111 | 'description', 'free form', 'freeform',
|
14112 | 'free text', 'freetext', 'free',
|
14113 |
|
14114 | 'kommentar',
|
14115 | ];
|
14116 | this.uriFieldNames = [
|
14117 | 'url', 'hyper link', 'hyperlink', 'link',
|
14118 | 'host', 'hostname', 'host name', 'server', 'address',
|
14119 | 'hyper ref', 'href', 'web', 'website', 'web site', 'site',
|
14120 | 'web-site', 'uri',
|
14121 |
|
14122 | 'ort', 'adresse',
|
14123 | ];
|
14124 | }
|
14125 | parseXml(data) {
|
14126 | const parser = new DOMParser();
|
14127 | const doc = parser.parseFromString(data, 'application/xml');
|
14128 | return doc != null && doc.querySelector('parsererror') == null ? doc : null;
|
14129 | }
|
14130 | parseCsv(data, header) {
|
14131 | data = this.splitNewLine(data).join('\n').trim();
|
14132 | const result = external_papaparse_["parse"](data, {
|
14133 | header: header,
|
14134 | encoding: 'UTF-8',
|
14135 | skipEmptyLines: false,
|
14136 | });
|
14137 | if (result.errors != null && result.errors.length > 0) {
|
14138 | result.errors.forEach((e) => {
|
14139 | if (e.row != null) {
|
14140 |
|
14141 | console.warn('Error parsing row ' + e.row + ': ' + e.message);
|
14142 | }
|
14143 | });
|
14144 | }
|
14145 | return result.data && result.data.length > 0 ? result.data : null;
|
14146 | }
|
14147 | parseSingleRowCsv(rowData) {
|
14148 | if (this.isNullOrWhitespace(rowData)) {
|
14149 | return null;
|
14150 | }
|
14151 | const parsedRow = this.parseCsv(rowData, false);
|
14152 | if (parsedRow != null && parsedRow.length > 0 && parsedRow[0].length > 0) {
|
14153 | return parsedRow[0];
|
14154 | }
|
14155 | return null;
|
14156 | }
|
14157 | makeUriArray(uri) {
|
14158 | if (uri == null) {
|
14159 | return null;
|
14160 | }
|
14161 | if (typeof uri === 'string') {
|
14162 | const loginUri = new loginUriView_LoginUriView();
|
14163 | loginUri.uri = this.fixUri(uri);
|
14164 | if (this.isNullOrWhitespace(loginUri.uri)) {
|
14165 | return null;
|
14166 | }
|
14167 | loginUri.match = null;
|
14168 | return [loginUri];
|
14169 | }
|
14170 | if (uri.length > 0) {
|
14171 | const returnArr = [];
|
14172 | uri.forEach((u) => {
|
14173 | const loginUri = new loginUriView_LoginUriView();
|
14174 | loginUri.uri = this.fixUri(u);
|
14175 | if (this.isNullOrWhitespace(loginUri.uri)) {
|
14176 | return;
|
14177 | }
|
14178 | loginUri.match = null;
|
14179 | returnArr.push(loginUri);
|
14180 | });
|
14181 | return returnArr.length === 0 ? null : returnArr;
|
14182 | }
|
14183 | return null;
|
14184 | }
|
14185 | fixUri(uri) {
|
14186 | if (uri == null) {
|
14187 | return null;
|
14188 | }
|
14189 | uri = uri.trim();
|
14190 | if (uri.indexOf('://') === -1 && uri.indexOf('.') >= 0) {
|
14191 | uri = 'http://' + uri;
|
14192 | }
|
14193 | if (uri.length > 1000) {
|
14194 | return uri.substring(0, 1000);
|
14195 | }
|
14196 | return uri;
|
14197 | }
|
14198 | nameFromUrl(url) {
|
14199 | const hostname = utils_Utils.getHostname(url);
|
14200 | if (this.isNullOrWhitespace(hostname)) {
|
14201 | return null;
|
14202 | }
|
14203 | return hostname.startsWith('www.') ? hostname.replace('www.', '') : hostname;
|
14204 | }
|
14205 | isNullOrWhitespace(str) {
|
14206 | return utils_Utils.isNullOrWhitespace(str);
|
14207 | }
|
14208 | getValueOrDefault(str, defaultValue = null) {
|
14209 | if (this.isNullOrWhitespace(str)) {
|
14210 | return defaultValue;
|
14211 | }
|
14212 | return str;
|
14213 | }
|
14214 | splitNewLine(str) {
|
14215 | return str.split(this.newLineRegex);
|
14216 | }
|
14217 |
|
14218 | getCardBrand(cardNum) {
|
14219 | if (this.isNullOrWhitespace(cardNum)) {
|
14220 | return null;
|
14221 | }
|
14222 |
|
14223 | let re = new RegExp('^4');
|
14224 | if (cardNum.match(re) != null) {
|
14225 | return 'Visa';
|
14226 | }
|
14227 |
|
14228 |
|
14229 | if (/^(5[1-5][0-9]{14}|2(22[1-9][0-9]{12}|2[3-9][0-9]{13}|[3-6][0-9]{14}|7[0-1][0-9]{13}|720[0-9]{12}))$/
|
14230 | .test(cardNum)) {
|
14231 | return 'Mastercard';
|
14232 | }
|
14233 |
|
14234 | re = new RegExp('^3[47]');
|
14235 | if (cardNum.match(re) != null) {
|
14236 | return 'Amex';
|
14237 | }
|
14238 |
|
14239 | re = new RegExp('^(6011|622(12[6-9]|1[3-9][0-9]|[2-8][0-9]{2}|9[0-1][0-9]|92[0-5]|64[4-9])|65)');
|
14240 | if (cardNum.match(re) != null) {
|
14241 | return 'Discover';
|
14242 | }
|
14243 |
|
14244 | re = new RegExp('^36');
|
14245 | if (cardNum.match(re) != null) {
|
14246 | return 'Diners Club';
|
14247 | }
|
14248 |
|
14249 | re = new RegExp('^30[0-5]');
|
14250 | if (cardNum.match(re) != null) {
|
14251 | return 'Diners Club';
|
14252 | }
|
14253 |
|
14254 | re = new RegExp('^35(2[89]|[3-8][0-9])');
|
14255 | if (cardNum.match(re) != null) {
|
14256 | return 'JCB';
|
14257 | }
|
14258 |
|
14259 | re = new RegExp('^(4026|417500|4508|4844|491(3|7))');
|
14260 | if (cardNum.match(re) != null) {
|
14261 | return 'Visa';
|
14262 | }
|
14263 | return null;
|
14264 | }
|
14265 | setCardExpiration(cipher, expiration) {
|
14266 | if (!this.isNullOrWhitespace(expiration)) {
|
14267 | const parts = expiration.split('/');
|
14268 | if (parts.length === 2) {
|
14269 | let month = null;
|
14270 | let year = null;
|
14271 | if (parts[0].length === 1 || parts[0].length === 2) {
|
14272 | month = parts[0];
|
14273 | if (month.length === 2 && month[0] === '0') {
|
14274 | month = month.substr(1, 1);
|
14275 | }
|
14276 | }
|
14277 | if (parts[1].length === 2 || parts[1].length === 4) {
|
14278 | year = month.length === 2 ? '20' + parts[1] : parts[1];
|
14279 | }
|
14280 | if (month != null && year != null) {
|
14281 | cipher.card.expMonth = month;
|
14282 | cipher.card.expYear = year;
|
14283 | return true;
|
14284 | }
|
14285 | }
|
14286 | }
|
14287 | return false;
|
14288 | }
|
14289 | moveFoldersToCollections(result) {
|
14290 | result.folderRelationships.forEach((r) => result.collectionRelationships.push(r));
|
14291 | result.collections = result.folders.map((f) => {
|
14292 | const collection = new collectionView_CollectionView();
|
14293 | collection.name = f.name;
|
14294 | return collection;
|
14295 | });
|
14296 | result.folderRelationships = [];
|
14297 | result.folders = [];
|
14298 | }
|
14299 | querySelectorDirectChild(parentEl, query) {
|
14300 | const els = this.querySelectorAllDirectChild(parentEl, query);
|
14301 | return els.length === 0 ? null : els[0];
|
14302 | }
|
14303 | querySelectorAllDirectChild(parentEl, query) {
|
14304 | return Array.from(parentEl.querySelectorAll(query)).filter((el) => el.parentNode === parentEl);
|
14305 | }
|
14306 | initLoginCipher() {
|
14307 | const cipher = new cipherView_CipherView();
|
14308 | cipher.favorite = false;
|
14309 | cipher.notes = '';
|
14310 | cipher.fields = [];
|
14311 | cipher.login = new LoginView();
|
14312 | cipher.type = CipherType.Login;
|
14313 | return cipher;
|
14314 | }
|
14315 | cleanupCipher(cipher) {
|
14316 | if (cipher == null) {
|
14317 | return;
|
14318 | }
|
14319 | if (cipher.type !== CipherType.Login) {
|
14320 | cipher.login = null;
|
14321 | }
|
14322 | if (this.isNullOrWhitespace(cipher.name)) {
|
14323 | cipher.name = '--';
|
14324 | }
|
14325 | if (this.isNullOrWhitespace(cipher.notes)) {
|
14326 | cipher.notes = null;
|
14327 | }
|
14328 | else {
|
14329 | cipher.notes = cipher.notes.trim();
|
14330 | }
|
14331 | if (cipher.fields != null && cipher.fields.length === 0) {
|
14332 | cipher.fields = null;
|
14333 | }
|
14334 | }
|
14335 | processKvp(cipher, key, value, type = FieldType.Text) {
|
14336 | if (this.isNullOrWhitespace(value)) {
|
14337 | return;
|
14338 | }
|
14339 | if (this.isNullOrWhitespace(key)) {
|
14340 | key = '';
|
14341 | }
|
14342 | if (value.length > 200 || value.trim().search(this.newLineRegex) > -1) {
|
14343 | if (cipher.notes == null) {
|
14344 | cipher.notes = '';
|
14345 | }
|
14346 | cipher.notes += (key + ': ' + this.splitNewLine(value).join('\n') + '\n');
|
14347 | }
|
14348 | else {
|
14349 | if (cipher.fields == null) {
|
14350 | cipher.fields = [];
|
14351 | }
|
14352 | const field = new FieldView();
|
14353 | field.type = type;
|
14354 | field.name = key;
|
14355 | field.value = value;
|
14356 | cipher.fields.push(field);
|
14357 | }
|
14358 | }
|
14359 | processFolder(result, folderName) {
|
14360 | let folderIndex = result.folders.length;
|
14361 | const hasFolder = !this.isNullOrWhitespace(folderName);
|
14362 | let addFolder = hasFolder;
|
14363 | if (hasFolder) {
|
14364 | for (let i = 0; i < result.folders.length; i++) {
|
14365 | if (result.folders[i].name === folderName) {
|
14366 | addFolder = false;
|
14367 | folderIndex = i;
|
14368 | break;
|
14369 | }
|
14370 | }
|
14371 | }
|
14372 | if (addFolder) {
|
14373 | const f = new FolderView();
|
14374 | f.name = folderName;
|
14375 | result.folders.push(f);
|
14376 | }
|
14377 | if (hasFolder) {
|
14378 | result.folderRelationships.push([result.ciphers.length, folderIndex]);
|
14379 | }
|
14380 | }
|
14381 | convertToNoteIfNeeded(cipher) {
|
14382 | if (cipher.type === CipherType.Login && this.isNullOrWhitespace(cipher.login.username) &&
|
14383 | this.isNullOrWhitespace(cipher.login.password) &&
|
14384 | (cipher.login.uris == null || cipher.login.uris.length === 0)) {
|
14385 | cipher.type = CipherType.SecureNote;
|
14386 | cipher.secureNote = new SecureNoteView();
|
14387 | cipher.secureNote.type = SecureNoteType.Generic;
|
14388 | }
|
14389 | }
|
14390 | }
|
14391 |
|
14392 |
|
14393 | class ImportResult {
|
14394 | constructor() {
|
14395 | this.success = false;
|
14396 | this.ciphers = [];
|
14397 | this.folders = [];
|
14398 | this.folderRelationships = [];
|
14399 | this.collections = [];
|
14400 | this.collectionRelationships = [];
|
14401 | }
|
14402 | }
|
14403 |
|
14404 |
|
14405 |
|
14406 |
|
14407 | class ascendoCsvImporter_AscendoCsvImporter extends baseImporter_BaseImporter {
|
14408 | parse(data) {
|
14409 | const result = new ImportResult();
|
14410 | const results = this.parseCsv(data, false);
|
14411 | if (results == null) {
|
14412 | result.success = false;
|
14413 | return result;
|
14414 | }
|
14415 | results.forEach((value) => {
|
14416 | if (value.length < 2) {
|
14417 | return;
|
14418 | }
|
14419 | const cipher = this.initLoginCipher();
|
14420 | cipher.notes = this.getValueOrDefault(value[value.length - 1]);
|
14421 | cipher.name = this.getValueOrDefault(value[0], '--');
|
14422 | if (value.length > 2 && (value.length % 2) === 0) {
|
14423 | for (let i = 0; i < value.length - 2; i += 2) {
|
14424 | const val = value[i + 2];
|
14425 | const field = value[i + 1];
|
14426 | if (this.isNullOrWhitespace(val) || this.isNullOrWhitespace(field)) {
|
14427 | continue;
|
14428 | }
|
14429 | const fieldLower = field.toLowerCase();
|
14430 | if (cipher.login.password == null && this.passwordFieldNames.indexOf(fieldLower) > -1) {
|
14431 | cipher.login.password = this.getValueOrDefault(val);
|
14432 | }
|
14433 | else if (cipher.login.username == null &&
|
14434 | this.usernameFieldNames.indexOf(fieldLower) > -1) {
|
14435 | cipher.login.username = this.getValueOrDefault(val);
|
14436 | }
|
14437 | else if ((cipher.login.uris == null || cipher.login.uris.length === 0) &&
|
14438 | this.uriFieldNames.indexOf(fieldLower) > -1) {
|
14439 | cipher.login.uris = this.makeUriArray(val);
|
14440 | }
|
14441 | else {
|
14442 | this.processKvp(cipher, field, val);
|
14443 | }
|
14444 | }
|
14445 | }
|
14446 | this.convertToNoteIfNeeded(cipher);
|
14447 | this.cleanupCipher(cipher);
|
14448 | result.ciphers.push(cipher);
|
14449 | });
|
14450 | result.success = true;
|
14451 | return result;
|
14452 | }
|
14453 | }
|
14454 |
|
14455 |
|
14456 |
|
14457 |
|
14458 | class avastCsvImporter_AvastCsvImporter extends baseImporter_BaseImporter {
|
14459 | parse(data) {
|
14460 | const result = new ImportResult();
|
14461 | const results = this.parseCsv(data, true);
|
14462 | if (results == null) {
|
14463 | result.success = false;
|
14464 | return result;
|
14465 | }
|
14466 | results.forEach((value) => {
|
14467 | const cipher = this.initLoginCipher();
|
14468 | cipher.name = this.getValueOrDefault(value.name);
|
14469 | cipher.login.uris = this.makeUriArray(value.web);
|
14470 | cipher.login.password = this.getValueOrDefault(value.password);
|
14471 | cipher.login.username = this.getValueOrDefault(value.login);
|
14472 | this.cleanupCipher(cipher);
|
14473 | result.ciphers.push(cipher);
|
14474 | });
|
14475 | result.success = true;
|
14476 | return result;
|
14477 | }
|
14478 | }
|
14479 |
|
14480 |
|
14481 |
|
14482 |
|
14483 |
|
14484 |
|
14485 | class avastJsonImporter_AvastJsonImporter extends baseImporter_BaseImporter {
|
14486 | parse(data) {
|
14487 | const result = new ImportResult();
|
14488 | const results = JSON.parse(data);
|
14489 | if (results == null) {
|
14490 | result.success = false;
|
14491 | return result;
|
14492 | }
|
14493 | if (results.logins != null) {
|
14494 | results.logins.forEach((value) => {
|
14495 | const cipher = this.initLoginCipher();
|
14496 | cipher.name = this.getValueOrDefault(value.custName);
|
14497 | cipher.notes = this.getValueOrDefault(value.note);
|
14498 | cipher.login.uris = this.makeUriArray(value.url);
|
14499 | cipher.login.password = this.getValueOrDefault(value.pwd);
|
14500 | cipher.login.username = this.getValueOrDefault(value.loginName);
|
14501 | this.cleanupCipher(cipher);
|
14502 | result.ciphers.push(cipher);
|
14503 | });
|
14504 | }
|
14505 | if (results.notes != null) {
|
14506 | results.notes.forEach((value) => {
|
14507 | const cipher = this.initLoginCipher();
|
14508 | cipher.type = CipherType.SecureNote;
|
14509 | cipher.secureNote.type = SecureNoteType.Generic;
|
14510 | cipher.name = this.getValueOrDefault(value.label);
|
14511 | cipher.notes = this.getValueOrDefault(value.text);
|
14512 | this.cleanupCipher(cipher);
|
14513 | result.ciphers.push(cipher);
|
14514 | });
|
14515 | }
|
14516 | if (results.cards != null) {
|
14517 | results.cards.forEach((value) => {
|
14518 | const cipher = this.initLoginCipher();
|
14519 | cipher.type = CipherType.Card;
|
14520 | cipher.name = this.getValueOrDefault(value.custName);
|
14521 | cipher.notes = this.getValueOrDefault(value.note);
|
14522 | cipher.card.cardholderName = this.getValueOrDefault(value.holderName);
|
14523 | cipher.card.number = this.getValueOrDefault(value.cardNumber);
|
14524 | cipher.card.code = this.getValueOrDefault(value.cvv);
|
14525 | cipher.card.brand = this.getCardBrand(cipher.card.number);
|
14526 | if (value.expirationDate != null) {
|
14527 | if (value.expirationDate.month != null) {
|
14528 | cipher.card.expMonth = value.expirationDate.month + '';
|
14529 | }
|
14530 | if (value.expirationDate.year != null) {
|
14531 | cipher.card.expYear = value.expirationDate.year + '';
|
14532 | }
|
14533 | }
|
14534 | this.cleanupCipher(cipher);
|
14535 | result.ciphers.push(cipher);
|
14536 | });
|
14537 | }
|
14538 | result.success = true;
|
14539 | return result;
|
14540 | }
|
14541 | }
|
14542 |
|
14543 |
|
14544 |
|
14545 |
|
14546 | class aviraCsvImporter_AviraCsvImporter extends baseImporter_BaseImporter {
|
14547 | parse(data) {
|
14548 | const result = new ImportResult();
|
14549 | const results = this.parseCsv(data, true);
|
14550 | if (results == null) {
|
14551 | result.success = false;
|
14552 | return result;
|
14553 | }
|
14554 | results.forEach((value) => {
|
14555 | const cipher = this.initLoginCipher();
|
14556 | cipher.name = this.getValueOrDefault(value.name, this.getValueOrDefault(this.nameFromUrl(value.website), '--'));
|
14557 | cipher.login.uris = this.makeUriArray(value.website);
|
14558 | cipher.login.password = this.getValueOrDefault(value.password);
|
14559 | if (this.isNullOrWhitespace(value.username) && !this.isNullOrWhitespace(value.secondary_username)) {
|
14560 | cipher.login.username = value.secondary_username;
|
14561 | }
|
14562 | else {
|
14563 | cipher.login.username = this.getValueOrDefault(value.username);
|
14564 | cipher.notes = this.getValueOrDefault(value.secondary_username);
|
14565 | }
|
14566 | this.cleanupCipher(cipher);
|
14567 | result.ciphers.push(cipher);
|
14568 | });
|
14569 | result.success = true;
|
14570 | return result;
|
14571 | }
|
14572 | }
|
14573 |
|
14574 |
|
14575 |
|
14576 |
|
14577 |
|
14578 |
|
14579 |
|
14580 |
|
14581 |
|
14582 |
|
14583 |
|
14584 |
|
14585 | class bitwardenCsvImporter_BitwardenCsvImporter extends baseImporter_BaseImporter {
|
14586 | parse(data) {
|
14587 | const result = new ImportResult();
|
14588 | const results = this.parseCsv(data, true);
|
14589 | if (results == null) {
|
14590 | result.success = false;
|
14591 | return result;
|
14592 | }
|
14593 | results.forEach((value) => {
|
14594 | if (this.organization && !this.isNullOrWhitespace(value.collections)) {
|
14595 | const collections = value.collections.split(',');
|
14596 | collections.forEach((col) => {
|
14597 | let addCollection = true;
|
14598 | let collectionIndex = result.collections.length;
|
14599 | for (let i = 0; i < result.collections.length; i++) {
|
14600 | if (result.collections[i].name === col) {
|
14601 | addCollection = false;
|
14602 | collectionIndex = i;
|
14603 | break;
|
14604 | }
|
14605 | }
|
14606 | if (addCollection) {
|
14607 | const collection = new collectionView_CollectionView();
|
14608 | collection.name = col;
|
14609 | result.collections.push(collection);
|
14610 | }
|
14611 | result.collectionRelationships.push([result.ciphers.length, collectionIndex]);
|
14612 | });
|
14613 | }
|
14614 | else if (!this.organization) {
|
14615 | this.processFolder(result, value.folder);
|
14616 | }
|
14617 | const cipher = new cipherView_CipherView();
|
14618 | cipher.favorite = !this.organization && this.getValueOrDefault(value.favorite, '0') !== '0' ? true : false;
|
14619 | cipher.type = CipherType.Login;
|
14620 | cipher.notes = this.getValueOrDefault(value.notes);
|
14621 | cipher.name = this.getValueOrDefault(value.name, '--');
|
14622 | if (!this.isNullOrWhitespace(value.fields)) {
|
14623 | const fields = this.splitNewLine(value.fields);
|
14624 | for (let i = 0; i < fields.length; i++) {
|
14625 | if (this.isNullOrWhitespace(fields[i])) {
|
14626 | continue;
|
14627 | }
|
14628 | const delimPosition = fields[i].lastIndexOf(': ');
|
14629 | if (delimPosition === -1) {
|
14630 | continue;
|
14631 | }
|
14632 | if (cipher.fields == null) {
|
14633 | cipher.fields = [];
|
14634 | }
|
14635 | const field = new FieldView();
|
14636 | field.name = fields[i].substr(0, delimPosition);
|
14637 | field.value = null;
|
14638 | field.type = FieldType.Text;
|
14639 | if (fields[i].length > (delimPosition + 2)) {
|
14640 | field.value = fields[i].substr(delimPosition + 2);
|
14641 | }
|
14642 | cipher.fields.push(field);
|
14643 | }
|
14644 | }
|
14645 | const valueType = value.type != null ? value.type.toLowerCase() : null;
|
14646 | switch (valueType) {
|
14647 | case 'note':
|
14648 | cipher.type = CipherType.SecureNote;
|
14649 | cipher.secureNote = new SecureNoteView();
|
14650 | cipher.secureNote.type = SecureNoteType.Generic;
|
14651 | break;
|
14652 | default:
|
14653 | cipher.type = CipherType.Login;
|
14654 | cipher.login = new LoginView();
|
14655 | cipher.login.totp = this.getValueOrDefault(value.login_totp || value.totp);
|
14656 | cipher.login.username = this.getValueOrDefault(value.login_username || value.username);
|
14657 | cipher.login.password = this.getValueOrDefault(value.login_password || value.password);
|
14658 | const uris = this.parseSingleRowCsv(value.login_uri || value.uri);
|
14659 | cipher.login.uris = this.makeUriArray(uris);
|
14660 | break;
|
14661 | }
|
14662 | result.ciphers.push(cipher);
|
14663 | });
|
14664 | result.success = true;
|
14665 | return result;
|
14666 | }
|
14667 | }
|
14668 |
|
14669 |
|
14670 |
|
14671 |
|
14672 |
|
14673 |
|
14674 |
|
14675 | class bitwardenJsonImporter_BitwardenJsonImporter extends baseImporter_BaseImporter {
|
14676 | parse(data) {
|
14677 | const result = new ImportResult();
|
14678 | const results = JSON.parse(data);
|
14679 | if (results == null || results.items == null || results.items.length === 0) {
|
14680 | result.success = false;
|
14681 | return result;
|
14682 | }
|
14683 | const groupingsMap = new Map();
|
14684 | if (this.organization && results.collections != null) {
|
14685 | results.collections.forEach((c) => {
|
14686 | const collection = collectionWithId_CollectionWithId.toView(c);
|
14687 | if (collection != null) {
|
14688 | collection.id = null;
|
14689 | collection.organizationId = null;
|
14690 | groupingsMap.set(c.id, result.collections.length);
|
14691 | result.collections.push(collection);
|
14692 | }
|
14693 | });
|
14694 | }
|
14695 | else if (!this.organization && results.folders != null) {
|
14696 | results.folders.forEach((f) => {
|
14697 | const folder = folderWithId_FolderWithId.toView(f);
|
14698 | if (folder != null) {
|
14699 | folder.id = null;
|
14700 | groupingsMap.set(f.id, result.folders.length);
|
14701 | result.folders.push(folder);
|
14702 | }
|
14703 | });
|
14704 | }
|
14705 | results.items.forEach((c) => {
|
14706 | const cipher = cipherWithIds_CipherWithIds.toView(c);
|
14707 |
|
14708 | cipher.id = null;
|
14709 | cipher.folderId = null;
|
14710 | cipher.organizationId = null;
|
14711 | cipher.collectionIds = null;
|
14712 |
|
14713 | if (cipher.passwordHistory != null && cipher.passwordHistory.length > 5) {
|
14714 | cipher.passwordHistory = cipher.passwordHistory.slice(0, 5);
|
14715 | }
|
14716 | if (!this.organization && c.folderId != null && groupingsMap.has(c.folderId)) {
|
14717 | result.folderRelationships.push([result.ciphers.length, groupingsMap.get(c.folderId)]);
|
14718 | }
|
14719 | else if (this.organization && c.collectionIds != null) {
|
14720 | c.collectionIds.forEach((cId) => {
|
14721 | if (groupingsMap.has(cId)) {
|
14722 | result.collectionRelationships.push([result.ciphers.length, groupingsMap.get(cId)]);
|
14723 | }
|
14724 | });
|
14725 | }
|
14726 | this.cleanupCipher(cipher);
|
14727 | result.ciphers.push(cipher);
|
14728 | });
|
14729 | result.success = true;
|
14730 | return result;
|
14731 | }
|
14732 | }
|
14733 |
|
14734 |
|
14735 |
|
14736 |
|
14737 | class blackBerryCsvImporter_BlackBerryCsvImporter extends baseImporter_BaseImporter {
|
14738 | parse(data) {
|
14739 | const result = new ImportResult();
|
14740 | const results = this.parseCsv(data, true);
|
14741 | if (results == null) {
|
14742 | result.success = false;
|
14743 | return result;
|
14744 | }
|
14745 | results.forEach((value) => {
|
14746 | if (value.grouping === 'list') {
|
14747 | return;
|
14748 | }
|
14749 | const cipher = this.initLoginCipher();
|
14750 | cipher.favorite = value.fav === '1';
|
14751 | cipher.name = this.getValueOrDefault(value.name);
|
14752 | cipher.notes = this.getValueOrDefault(value.extra);
|
14753 | if (value.grouping !== 'note') {
|
14754 | cipher.login.uris = this.makeUriArray(value.url);
|
14755 | cipher.login.password = this.getValueOrDefault(value.password);
|
14756 | cipher.login.username = this.getValueOrDefault(value.username);
|
14757 | }
|
14758 | this.convertToNoteIfNeeded(cipher);
|
14759 | this.cleanupCipher(cipher);
|
14760 | result.ciphers.push(cipher);
|
14761 | });
|
14762 | result.success = true;
|
14763 | return result;
|
14764 | }
|
14765 | }
|
14766 |
|
14767 |
|
14768 |
|
14769 |
|
14770 | class blurCsvImporter_BlurCsvImporter extends baseImporter_BaseImporter {
|
14771 | parse(data) {
|
14772 | const result = new ImportResult();
|
14773 | const results = this.parseCsv(data, true);
|
14774 | if (results == null) {
|
14775 | result.success = false;
|
14776 | return result;
|
14777 | }
|
14778 | results.forEach((value) => {
|
14779 | if (value.label === 'null') {
|
14780 | value.label = null;
|
14781 | }
|
14782 | const cipher = this.initLoginCipher();
|
14783 | cipher.name = this.getValueOrDefault(value.label, this.getValueOrDefault(this.nameFromUrl(value.domain), '--'));
|
14784 | cipher.login.uris = this.makeUriArray(value.domain);
|
14785 | cipher.login.password = this.getValueOrDefault(value.password);
|
14786 | if (this.isNullOrWhitespace(value.email) && !this.isNullOrWhitespace(value.username)) {
|
14787 | cipher.login.username = value.username;
|
14788 | }
|
14789 | else {
|
14790 | cipher.login.username = this.getValueOrDefault(value.email);
|
14791 | cipher.notes = this.getValueOrDefault(value.username);
|
14792 | }
|
14793 | this.cleanupCipher(cipher);
|
14794 | result.ciphers.push(cipher);
|
14795 | });
|
14796 | result.success = true;
|
14797 | return result;
|
14798 | }
|
14799 | }
|
14800 |
|
14801 |
|
14802 |
|
14803 |
|
14804 | const OfficialProps = [
|
14805 | '!group_id', '!group_name', 'title', 'username', 'password', 'URL', 'id',
|
14806 | ];
|
14807 | class buttercupCsvImporter_ButtercupCsvImporter extends baseImporter_BaseImporter {
|
14808 | parse(data) {
|
14809 | const result = new ImportResult();
|
14810 | const results = this.parseCsv(data, true);
|
14811 | if (results == null) {
|
14812 | result.success = false;
|
14813 | return result;
|
14814 | }
|
14815 | results.forEach((value) => {
|
14816 | this.processFolder(result, this.getValueOrDefault(value['!group_name']));
|
14817 | const cipher = this.initLoginCipher();
|
14818 | cipher.name = this.getValueOrDefault(value.title, '--');
|
14819 | cipher.login.username = this.getValueOrDefault(value.username);
|
14820 | cipher.login.password = this.getValueOrDefault(value.password);
|
14821 | cipher.login.uris = this.makeUriArray(value.URL);
|
14822 | let processingCustomFields = false;
|
14823 | for (const prop in value) {
|
14824 | if (value.hasOwnProperty(prop)) {
|
14825 | if (!processingCustomFields && OfficialProps.indexOf(prop) === -1) {
|
14826 | processingCustomFields = true;
|
14827 | }
|
14828 | if (processingCustomFields) {
|
14829 | this.processKvp(cipher, prop, value[prop]);
|
14830 | }
|
14831 | }
|
14832 | }
|
14833 | this.cleanupCipher(cipher);
|
14834 | result.ciphers.push(cipher);
|
14835 | });
|
14836 | if (this.organization) {
|
14837 | this.moveFoldersToCollections(result);
|
14838 | }
|
14839 | result.success = true;
|
14840 | return result;
|
14841 | }
|
14842 | }
|
14843 |
|
14844 |
|
14845 |
|
14846 |
|
14847 | class chromeCsvImporter_ChromeCsvImporter extends baseImporter_BaseImporter {
|
14848 | parse(data) {
|
14849 | const result = new ImportResult();
|
14850 | const results = this.parseCsv(data, true);
|
14851 | if (results == null) {
|
14852 | result.success = false;
|
14853 | return result;
|
14854 | }
|
14855 | results.forEach((value) => {
|
14856 | const cipher = this.initLoginCipher();
|
14857 | cipher.name = this.getValueOrDefault(value.name, '--');
|
14858 | cipher.login.username = this.getValueOrDefault(value.username);
|
14859 | cipher.login.password = this.getValueOrDefault(value.password);
|
14860 | cipher.login.uris = this.makeUriArray(value.url);
|
14861 | this.cleanupCipher(cipher);
|
14862 | result.ciphers.push(cipher);
|
14863 | });
|
14864 | result.success = true;
|
14865 | return result;
|
14866 | }
|
14867 | }
|
14868 |
|
14869 |
|
14870 |
|
14871 |
|
14872 | class clipperzHtmlImporter_ClipperzHtmlImporter extends baseImporter_BaseImporter {
|
14873 | parse(data) {
|
14874 | const result = new ImportResult();
|
14875 | const doc = this.parseXml(data);
|
14876 | if (doc == null) {
|
14877 | result.success = false;
|
14878 | return result;
|
14879 | }
|
14880 | const textarea = doc.querySelector('textarea');
|
14881 | if (textarea == null || this.isNullOrWhitespace(textarea.textContent)) {
|
14882 | result.errorMessage = 'Missing textarea.';
|
14883 | result.success = false;
|
14884 | return result;
|
14885 | }
|
14886 | const entries = JSON.parse(textarea.textContent);
|
14887 | entries.forEach((entry) => {
|
14888 | const cipher = this.initLoginCipher();
|
14889 | if (!this.isNullOrWhitespace(entry.label)) {
|
14890 | cipher.name = entry.label.split(' ')[0];
|
14891 | }
|
14892 | if (entry.data != null && !this.isNullOrWhitespace(entry.data.notes)) {
|
14893 | cipher.notes = entry.data.notes.split('\\n').join('\n');
|
14894 | }
|
14895 | if (entry.currentVersion != null && entry.currentVersion.fields != null) {
|
14896 | for (const property in entry.currentVersion.fields) {
|
14897 | if (!entry.currentVersion.fields.hasOwnProperty(property)) {
|
14898 | continue;
|
14899 | }
|
14900 | const field = entry.currentVersion.fields[property];
|
14901 | const actionType = field.actionType != null ? field.actionType.toLowerCase() : null;
|
14902 | switch (actionType) {
|
14903 | case 'password':
|
14904 | cipher.login.password = this.getValueOrDefault(field.value);
|
14905 | break;
|
14906 | case 'email':
|
14907 | case 'username':
|
14908 | case 'user':
|
14909 | case 'name':
|
14910 | cipher.login.username = this.getValueOrDefault(field.value);
|
14911 | break;
|
14912 | case 'url':
|
14913 | cipher.login.uris = this.makeUriArray(field.value);
|
14914 | break;
|
14915 | default:
|
14916 | const labelLower = field.label != null ? field.label.toLowerCase() : null;
|
14917 | if (cipher.login.password == null && this.passwordFieldNames.indexOf(labelLower) > -1) {
|
14918 | cipher.login.password = this.getValueOrDefault(field.value);
|
14919 | }
|
14920 | else if (cipher.login.username == null &&
|
14921 | this.usernameFieldNames.indexOf(labelLower) > -1) {
|
14922 | cipher.login.username = this.getValueOrDefault(field.value);
|
14923 | }
|
14924 | else if ((cipher.login.uris == null || cipher.login.uris.length === 0) &&
|
14925 | this.uriFieldNames.indexOf(labelLower) > -1) {
|
14926 | cipher.login.uris = this.makeUriArray(field.value);
|
14927 | }
|
14928 | else {
|
14929 | this.processKvp(cipher, field.label, field.value);
|
14930 | }
|
14931 | break;
|
14932 | }
|
14933 | }
|
14934 | }
|
14935 | this.convertToNoteIfNeeded(cipher);
|
14936 | this.cleanupCipher(cipher);
|
14937 | result.ciphers.push(cipher);
|
14938 | });
|
14939 | result.success = true;
|
14940 | return result;
|
14941 | }
|
14942 | }
|
14943 |
|
14944 |
|
14945 |
|
14946 |
|
14947 | class codebookCsvImporter_CodebookCsvImporter extends baseImporter_BaseImporter {
|
14948 | parse(data) {
|
14949 | const result = new ImportResult();
|
14950 | const results = this.parseCsv(data, true);
|
14951 | if (results == null) {
|
14952 | result.success = false;
|
14953 | return result;
|
14954 | }
|
14955 | results.forEach((value) => {
|
14956 | this.processFolder(result, this.getValueOrDefault(value.Category));
|
14957 | const cipher = this.initLoginCipher();
|
14958 | cipher.favorite = this.getValueOrDefault(value.Favorite) === 'True';
|
14959 | cipher.name = this.getValueOrDefault(value.Entry, '--');
|
14960 | cipher.notes = this.getValueOrDefault(value.Note);
|
14961 | cipher.login.username = this.getValueOrDefault(value.Username, value.Email);
|
14962 | cipher.login.password = this.getValueOrDefault(value.Password);
|
14963 | cipher.login.totp = this.getValueOrDefault(value.TOTP);
|
14964 | cipher.login.uris = this.makeUriArray(value.Website);
|
14965 | if (!this.isNullOrWhitespace(value.Username)) {
|
14966 | this.processKvp(cipher, 'Email', value.Email);
|
14967 | }
|
14968 | this.processKvp(cipher, 'Phone', value.Phone);
|
14969 | this.processKvp(cipher, 'PIN', value.PIN);
|
14970 | this.processKvp(cipher, 'Account', value.Account);
|
14971 | this.processKvp(cipher, 'Date', value.Date);
|
14972 | this.convertToNoteIfNeeded(cipher);
|
14973 | this.cleanupCipher(cipher);
|
14974 | result.ciphers.push(cipher);
|
14975 | });
|
14976 | if (this.organization) {
|
14977 | this.moveFoldersToCollections(result);
|
14978 | }
|
14979 | result.success = true;
|
14980 | return result;
|
14981 | }
|
14982 | }
|
14983 |
|
14984 |
|
14985 |
|
14986 |
|
14987 |
|
14988 |
|
14989 |
|
14990 |
|
14991 |
|
14992 |
|
14993 | const HandledResults = new Set(['ADDRESS', 'AUTHENTIFIANT', 'BANKSTATEMENT', 'IDCARD', 'IDENTITY',
|
14994 | 'PAYMENTMEANS_CREDITCARD', 'PAYMENTMEAN_PAYPAL', 'EMAIL']);
|
14995 | class dashlaneJsonImporter_DashlaneJsonImporter extends baseImporter_BaseImporter {
|
14996 | parse(data) {
|
14997 | this.result = new ImportResult();
|
14998 | const results = JSON.parse(data);
|
14999 | if (results == null || results.length === 0) {
|
15000 | this.result.success = false;
|
15001 | return this.result;
|
15002 | }
|
15003 | if (results.ADDRESS != null) {
|
15004 | this.processAddress(results.ADDRESS);
|
15005 | }
|
15006 | if (results.AUTHENTIFIANT != null) {
|
15007 | this.processAuth(results.AUTHENTIFIANT);
|
15008 | }
|
15009 | if (results.BANKSTATEMENT != null) {
|
15010 | this.processNote(results.BANKSTATEMENT, 'BankAccountName');
|
15011 | }
|
15012 | if (results.IDCARD != null) {
|
15013 | this.processNote(results.IDCARD, 'Fullname');
|
15014 | }
|
15015 | if (results.PAYMENTMEANS_CREDITCARD != null) {
|
15016 | this.processCard(results.PAYMENTMEANS_CREDITCARD);
|
15017 | }
|
15018 | if (results.IDENTITY != null) {
|
15019 | this.processIdentity(results.IDENTITY);
|
15020 | }
|
15021 | for (const key in results) {
|
15022 | if (results.hasOwnProperty(key) && !HandledResults.has(key)) {
|
15023 | this.processNote(results[key], null, 'Generic Note');
|
15024 | }
|
15025 | }
|
15026 | this.result.success = true;
|
15027 | return this.result;
|
15028 | }
|
15029 | processAuth(results) {
|
15030 | results.forEach((credential) => {
|
15031 | const cipher = this.initLoginCipher();
|
15032 | cipher.name = this.getValueOrDefault(credential.title);
|
15033 | cipher.login.username = this.getValueOrDefault(credential.login, this.getValueOrDefault(credential.secondaryLogin));
|
15034 | if (this.isNullOrWhitespace(cipher.login.username)) {
|
15035 | cipher.login.username = this.getValueOrDefault(credential.email);
|
15036 | }
|
15037 | else if (!this.isNullOrWhitespace(credential.email)) {
|
15038 | cipher.notes = ('Email: ' + credential.email + '\n');
|
15039 | }
|
15040 | cipher.login.password = this.getValueOrDefault(credential.password);
|
15041 | cipher.login.uris = this.makeUriArray(credential.domain);
|
15042 | cipher.notes += this.getValueOrDefault(credential.note, '');
|
15043 | this.convertToNoteIfNeeded(cipher);
|
15044 | this.cleanupCipher(cipher);
|
15045 | this.result.ciphers.push(cipher);
|
15046 | });
|
15047 | }
|
15048 | processIdentity(results) {
|
15049 | results.forEach((obj) => {
|
15050 | const cipher = new cipherView_CipherView();
|
15051 | cipher.identity = new identityView_IdentityView();
|
15052 | cipher.type = CipherType.Identity;
|
15053 | cipher.name = this.getValueOrDefault(obj.fullName, '');
|
15054 | const nameParts = cipher.name.split(' ');
|
15055 | if (nameParts.length > 0) {
|
15056 | cipher.identity.firstName = this.getValueOrDefault(nameParts[0]);
|
15057 | }
|
15058 | if (nameParts.length === 2) {
|
15059 | cipher.identity.lastName = this.getValueOrDefault(nameParts[1]);
|
15060 | }
|
15061 | else if (nameParts.length === 3) {
|
15062 | cipher.identity.middleName = this.getValueOrDefault(nameParts[1]);
|
15063 | cipher.identity.lastName = this.getValueOrDefault(nameParts[2]);
|
15064 | }
|
15065 | cipher.identity.username = this.getValueOrDefault(obj.pseudo);
|
15066 | this.cleanupCipher(cipher);
|
15067 | this.result.ciphers.push(cipher);
|
15068 | });
|
15069 | }
|
15070 | processAddress(results) {
|
15071 | results.forEach((obj) => {
|
15072 | const cipher = new cipherView_CipherView();
|
15073 | cipher.identity = new identityView_IdentityView();
|
15074 | cipher.type = CipherType.Identity;
|
15075 | cipher.name = this.getValueOrDefault(obj.addressName);
|
15076 | cipher.identity.address1 = this.getValueOrDefault(obj.addressFull);
|
15077 | cipher.identity.city = this.getValueOrDefault(obj.city);
|
15078 | cipher.identity.state = this.getValueOrDefault(obj.state);
|
15079 | cipher.identity.postalCode = this.getValueOrDefault(obj.zipcode);
|
15080 | cipher.identity.country = this.getValueOrDefault(obj.country);
|
15081 | if (cipher.identity.country != null) {
|
15082 | cipher.identity.country = cipher.identity.country.toUpperCase();
|
15083 | }
|
15084 | this.cleanupCipher(cipher);
|
15085 | this.result.ciphers.push(cipher);
|
15086 | });
|
15087 | }
|
15088 | processCard(results) {
|
15089 | results.forEach((obj) => {
|
15090 | const cipher = new cipherView_CipherView();
|
15091 | cipher.card = new CardView();
|
15092 | cipher.type = CipherType.Card;
|
15093 | cipher.name = this.getValueOrDefault(obj.bank);
|
15094 | cipher.card.number = this.getValueOrDefault(obj.cardNumber);
|
15095 | cipher.card.brand = this.getCardBrand(cipher.card.number);
|
15096 | cipher.card.cardholderName = this.getValueOrDefault(obj.owner);
|
15097 | if (!this.isNullOrWhitespace(cipher.card.brand)) {
|
15098 | if (this.isNullOrWhitespace(cipher.name)) {
|
15099 | cipher.name = cipher.card.brand;
|
15100 | }
|
15101 | else {
|
15102 | cipher.name += (' - ' + cipher.card.brand);
|
15103 | }
|
15104 | }
|
15105 | this.cleanupCipher(cipher);
|
15106 | this.result.ciphers.push(cipher);
|
15107 | });
|
15108 | }
|
15109 | processNote(results, nameProperty, name = null) {
|
15110 | results.forEach((obj) => {
|
15111 | const cipher = new cipherView_CipherView();
|
15112 | cipher.secureNote = new SecureNoteView();
|
15113 | cipher.type = CipherType.SecureNote;
|
15114 | cipher.secureNote.type = SecureNoteType.Generic;
|
15115 | if (name != null) {
|
15116 | cipher.name = name;
|
15117 | }
|
15118 | else {
|
15119 | cipher.name = this.getValueOrDefault(obj[nameProperty]);
|
15120 | }
|
15121 | for (const key in obj) {
|
15122 | if (obj.hasOwnProperty(key) && key !== nameProperty) {
|
15123 | this.processKvp(cipher, key, obj[key].toString());
|
15124 | }
|
15125 | }
|
15126 | this.cleanupCipher(cipher);
|
15127 | this.result.ciphers.push(cipher);
|
15128 | });
|
15129 | }
|
15130 | }
|
15131 |
|
15132 |
|
15133 |
|
15134 |
|
15135 |
|
15136 |
|
15137 | class encryptrCsvImporter_EncryptrCsvImporter extends baseImporter_BaseImporter {
|
15138 | parse(data) {
|
15139 | const result = new ImportResult();
|
15140 | const results = this.parseCsv(data, true);
|
15141 | if (results == null) {
|
15142 | result.success = false;
|
15143 | return result;
|
15144 | }
|
15145 | results.forEach((value) => {
|
15146 | const cipher = this.initLoginCipher();
|
15147 | cipher.name = this.getValueOrDefault(value.Label, '--');
|
15148 | cipher.notes = this.getValueOrDefault(value.Notes);
|
15149 | const text = this.getValueOrDefault(value.Text);
|
15150 | if (!this.isNullOrWhitespace(text)) {
|
15151 | if (this.isNullOrWhitespace(cipher.notes)) {
|
15152 | cipher.notes = text;
|
15153 | }
|
15154 | else {
|
15155 | cipher.notes += ('\n\n' + text);
|
15156 | }
|
15157 | }
|
15158 | const type = value['Entry Type'];
|
15159 | if (type === 'Password') {
|
15160 | cipher.login.username = this.getValueOrDefault(value.Username);
|
15161 | cipher.login.password = this.getValueOrDefault(value.Password);
|
15162 | cipher.login.uris = this.makeUriArray(value['Site URL']);
|
15163 | }
|
15164 | else if (type === 'Credit Card') {
|
15165 | cipher.type = CipherType.Card;
|
15166 | cipher.card = new CardView();
|
15167 | cipher.card.cardholderName = this.getValueOrDefault(value['Name on card']);
|
15168 | cipher.card.number = this.getValueOrDefault(value['Card Number']);
|
15169 | cipher.card.brand = this.getCardBrand(cipher.card.number);
|
15170 | cipher.card.code = this.getValueOrDefault(value.CVV);
|
15171 | const expiry = this.getValueOrDefault(value.Expiry);
|
15172 | if (!this.isNullOrWhitespace(expiry)) {
|
15173 | const expParts = expiry.split('/');
|
15174 | if (expParts.length > 1) {
|
15175 | cipher.card.expMonth = parseInt(expParts[0], null).toString();
|
15176 | cipher.card.expYear = (2000 + parseInt(expParts[1], null)).toString();
|
15177 | }
|
15178 | }
|
15179 | }
|
15180 | this.convertToNoteIfNeeded(cipher);
|
15181 | this.cleanupCipher(cipher);
|
15182 | result.ciphers.push(cipher);
|
15183 | });
|
15184 | result.success = true;
|
15185 | return result;
|
15186 | }
|
15187 | }
|
15188 |
|
15189 |
|
15190 |
|
15191 |
|
15192 |
|
15193 |
|
15194 |
|
15195 |
|
15196 | class enpassCsvImporter_EnpassCsvImporter extends baseImporter_BaseImporter {
|
15197 | parse(data) {
|
15198 | const result = new ImportResult();
|
15199 | const results = this.parseCsv(data, false);
|
15200 | if (results == null) {
|
15201 | result.success = false;
|
15202 | return result;
|
15203 | }
|
15204 | let firstRow = true;
|
15205 | results.forEach((value) => {
|
15206 | if (value.length < 2 || (firstRow && (value[0] === 'Title' || value[0] === 'title'))) {
|
15207 | firstRow = false;
|
15208 | return;
|
15209 | }
|
15210 | const cipher = this.initLoginCipher();
|
15211 | cipher.notes = this.getValueOrDefault(value[value.length - 1]);
|
15212 | cipher.name = this.getValueOrDefault(value[0], '--');
|
15213 | if (value.length === 2 || (!this.containsField(value, 'username') &&
|
15214 | !this.containsField(value, 'password') && !this.containsField(value, 'email') &&
|
15215 | !this.containsField(value, 'url'))) {
|
15216 | cipher.type = CipherType.SecureNote;
|
15217 | cipher.secureNote = new SecureNoteView();
|
15218 | cipher.secureNote.type = SecureNoteType.Generic;
|
15219 | }
|
15220 | if (this.containsField(value, 'cardholder') && this.containsField(value, 'number') &&
|
15221 | this.containsField(value, 'expiry date')) {
|
15222 | cipher.type = CipherType.Card;
|
15223 | cipher.card = new CardView();
|
15224 | }
|
15225 | if (value.length > 2 && (value.length % 2) === 0) {
|
15226 | for (let i = 0; i < value.length - 2; i += 2) {
|
15227 | const fieldValue = value[i + 2];
|
15228 | if (this.isNullOrWhitespace(fieldValue)) {
|
15229 | continue;
|
15230 | }
|
15231 | const fieldName = value[i + 1];
|
15232 | const fieldNameLower = fieldName.toLowerCase();
|
15233 | if (cipher.type === CipherType.Login) {
|
15234 | if (fieldNameLower === 'url' && (cipher.login.uris == null || cipher.login.uris.length === 0)) {
|
15235 | cipher.login.uris = this.makeUriArray(fieldValue);
|
15236 | continue;
|
15237 | }
|
15238 | else if ((fieldNameLower === 'username' || fieldNameLower === 'email') &&
|
15239 | this.isNullOrWhitespace(cipher.login.username)) {
|
15240 | cipher.login.username = fieldValue;
|
15241 | continue;
|
15242 | }
|
15243 | else if (fieldNameLower === 'password' && this.isNullOrWhitespace(cipher.login.password)) {
|
15244 | cipher.login.password = fieldValue;
|
15245 | continue;
|
15246 | }
|
15247 | else if (fieldNameLower === 'totp' && this.isNullOrWhitespace(cipher.login.totp)) {
|
15248 | cipher.login.totp = fieldValue;
|
15249 | continue;
|
15250 | }
|
15251 | }
|
15252 | else if (cipher.type === CipherType.Card) {
|
15253 | if (fieldNameLower === 'cardholder' && this.isNullOrWhitespace(cipher.card.cardholderName)) {
|
15254 | cipher.card.cardholderName = fieldValue;
|
15255 | continue;
|
15256 | }
|
15257 | else if (fieldNameLower === 'number' && this.isNullOrWhitespace(cipher.card.number)) {
|
15258 | cipher.card.number = fieldValue;
|
15259 | cipher.card.brand = this.getCardBrand(fieldValue);
|
15260 | continue;
|
15261 | }
|
15262 | else if (fieldNameLower === 'cvc' && this.isNullOrWhitespace(cipher.card.code)) {
|
15263 | cipher.card.code = fieldValue;
|
15264 | continue;
|
15265 | }
|
15266 | else if (fieldNameLower === 'expiry date' && this.isNullOrWhitespace(cipher.card.expMonth) &&
|
15267 | this.isNullOrWhitespace(cipher.card.expYear)) {
|
15268 | if (this.setCardExpiration(cipher, fieldValue)) {
|
15269 | continue;
|
15270 | }
|
15271 | }
|
15272 | else if (fieldNameLower === 'type') {
|
15273 |
|
15274 | continue;
|
15275 | }
|
15276 | }
|
15277 | this.processKvp(cipher, fieldName, fieldValue);
|
15278 | }
|
15279 | }
|
15280 | this.cleanupCipher(cipher);
|
15281 | result.ciphers.push(cipher);
|
15282 | });
|
15283 | result.success = true;
|
15284 | return result;
|
15285 | }
|
15286 | containsField(fields, name) {
|
15287 | if (fields == null || name == null) {
|
15288 | return false;
|
15289 | }
|
15290 | return fields.filter((f) => !this.isNullOrWhitespace(f) &&
|
15291 | f.toLowerCase() === name.toLowerCase()).length > 0;
|
15292 | }
|
15293 | }
|
15294 |
|
15295 |
|
15296 |
|
15297 |
|
15298 |
|
15299 |
|
15300 |
|
15301 |
|
15302 | class enpassJsonImporter_EnpassJsonImporter extends baseImporter_BaseImporter {
|
15303 | parse(data) {
|
15304 | const result = new ImportResult();
|
15305 | const results = JSON.parse(data);
|
15306 | if (results == null || results.items == null || results.items.length === 0) {
|
15307 | result.success = false;
|
15308 | return result;
|
15309 | }
|
15310 | const foldersMap = new Map();
|
15311 | const foldersIndexMap = new Map();
|
15312 | const folderTree = this.buildFolderTree(results.folders);
|
15313 | this.flattenFolderTree(null, folderTree, foldersMap);
|
15314 | foldersMap.forEach((val, key) => {
|
15315 | foldersIndexMap.set(key, result.folders.length);
|
15316 | const f = new FolderView();
|
15317 | f.name = val;
|
15318 | result.folders.push(f);
|
15319 | });
|
15320 | results.items.forEach((item) => {
|
15321 | if (item.folders != null && item.folders.length > 0 && foldersIndexMap.has(item.folders[0])) {
|
15322 | result.folderRelationships.push([result.ciphers.length, foldersIndexMap.get(item.folders[0])]);
|
15323 | }
|
15324 | const cipher = this.initLoginCipher();
|
15325 | cipher.name = this.getValueOrDefault(item.title);
|
15326 | cipher.favorite = item.favorite > 0;
|
15327 | if (item.template_type != null && item.fields != null && item.fields.length > 0) {
|
15328 | if (item.template_type.indexOf('login.') === 0 || item.template_type.indexOf('password.') === 0) {
|
15329 | this.processLogin(cipher, item.fields);
|
15330 | }
|
15331 | else if (item.template_type.indexOf('creditcard.') === 0) {
|
15332 | this.processCard(cipher, item.fields);
|
15333 | }
|
15334 | else if (item.template_type.indexOf('identity.') < 0 &&
|
15335 | item.fields.some((f) => f.type === 'password' && !this.isNullOrWhitespace(f.value))) {
|
15336 | this.processLogin(cipher, item.fields);
|
15337 | }
|
15338 | else {
|
15339 | this.processNote(cipher, item.fields);
|
15340 | }
|
15341 | }
|
15342 | cipher.notes += ('\n' + this.getValueOrDefault(item.note, ''));
|
15343 | this.convertToNoteIfNeeded(cipher);
|
15344 | this.cleanupCipher(cipher);
|
15345 | result.ciphers.push(cipher);
|
15346 | });
|
15347 | result.success = true;
|
15348 | return result;
|
15349 | }
|
15350 | processLogin(cipher, fields) {
|
15351 | const urls = [];
|
15352 | fields.forEach((field) => {
|
15353 | if (this.isNullOrWhitespace(field.value) || field.type === 'section') {
|
15354 | return;
|
15355 | }
|
15356 | if ((field.type === 'username' || field.type === 'email') &&
|
15357 | this.isNullOrWhitespace(cipher.login.username)) {
|
15358 | cipher.login.username = field.value;
|
15359 | }
|
15360 | else if (field.type === 'password' && this.isNullOrWhitespace(cipher.login.password)) {
|
15361 | cipher.login.password = field.value;
|
15362 | }
|
15363 | else if (field.type === 'totp' && this.isNullOrWhitespace(cipher.login.totp)) {
|
15364 | cipher.login.totp = field.value;
|
15365 | }
|
15366 | else if (field.type === 'url') {
|
15367 | urls.push(field.value);
|
15368 | }
|
15369 | else {
|
15370 | this.processKvp(cipher, field.label, field.value, field.sensitive === 1 ? FieldType.Hidden : FieldType.Text);
|
15371 | }
|
15372 | });
|
15373 | cipher.login.uris = this.makeUriArray(urls);
|
15374 | }
|
15375 | processCard(cipher, fields) {
|
15376 | cipher.card = new CardView();
|
15377 | cipher.type = CipherType.Card;
|
15378 | fields.forEach((field) => {
|
15379 | if (this.isNullOrWhitespace(field.value) || field.type === 'section' || field.type === 'ccType') {
|
15380 | return;
|
15381 | }
|
15382 | if (field.type === 'ccName' && this.isNullOrWhitespace(cipher.card.cardholderName)) {
|
15383 | cipher.card.cardholderName = field.value;
|
15384 | }
|
15385 | else if (field.type === 'ccNumber' && this.isNullOrWhitespace(cipher.card.number)) {
|
15386 | cipher.card.number = field.value;
|
15387 | cipher.card.brand = this.getCardBrand(cipher.card.number);
|
15388 | }
|
15389 | else if (field.type === 'ccCvc' && this.isNullOrWhitespace(cipher.card.code)) {
|
15390 | cipher.card.code = field.value;
|
15391 | }
|
15392 | else if (field.type === 'ccExpiry' && this.isNullOrWhitespace(cipher.card.expYear)) {
|
15393 | if (!this.setCardExpiration(cipher, field.value)) {
|
15394 | this.processKvp(cipher, field.label, field.value, field.sensitive === 1 ? FieldType.Hidden : FieldType.Text);
|
15395 | }
|
15396 | }
|
15397 | else {
|
15398 | this.processKvp(cipher, field.label, field.value, field.sensitive === 1 ? FieldType.Hidden : FieldType.Text);
|
15399 | }
|
15400 | });
|
15401 | }
|
15402 | processNote(cipher, fields) {
|
15403 | fields.forEach((field) => {
|
15404 | if (this.isNullOrWhitespace(field.value) || field.type === 'section') {
|
15405 | return;
|
15406 | }
|
15407 | this.processKvp(cipher, field.label, field.value, field.sensitive === 1 ? FieldType.Hidden : FieldType.Text);
|
15408 | });
|
15409 | }
|
15410 | buildFolderTree(folders) {
|
15411 | if (folders == null) {
|
15412 | return [];
|
15413 | }
|
15414 | const folderTree = [];
|
15415 | const map = new Map([]);
|
15416 | folders.forEach((obj) => {
|
15417 | map.set(obj.uuid, obj);
|
15418 | obj.children = [];
|
15419 | });
|
15420 | folders.forEach((obj) => {
|
15421 | if (obj.parent_uuid != null && obj.parent_uuid !== '' && map.has(obj.parent_uuid)) {
|
15422 | map.get(obj.parent_uuid).children.push(obj);
|
15423 | }
|
15424 | else {
|
15425 | folderTree.push(obj);
|
15426 | }
|
15427 | });
|
15428 | return folderTree;
|
15429 | }
|
15430 | flattenFolderTree(titlePrefix, tree, map) {
|
15431 | if (tree == null) {
|
15432 | return;
|
15433 | }
|
15434 | tree.forEach((f) => {
|
15435 | if (f.title != null && f.title.trim() !== '') {
|
15436 | let title = f.title.trim();
|
15437 | if (titlePrefix != null && titlePrefix.trim() !== '') {
|
15438 | title = titlePrefix + '/' + title;
|
15439 | }
|
15440 | map.set(f.uuid, title);
|
15441 | if (f.children != null && f.children.length !== 0) {
|
15442 | this.flattenFolderTree(title, f.children, map);
|
15443 | }
|
15444 | }
|
15445 | });
|
15446 | }
|
15447 | }
|
15448 |
|
15449 |
|
15450 |
|
15451 |
|
15452 | class firefoxCsvImporter_FirefoxCsvImporter extends baseImporter_BaseImporter {
|
15453 | parse(data) {
|
15454 | const result = new ImportResult();
|
15455 | const results = this.parseCsv(data, true);
|
15456 | if (results == null) {
|
15457 | result.success = false;
|
15458 | return result;
|
15459 | }
|
15460 | results.forEach((value) => {
|
15461 | const cipher = this.initLoginCipher();
|
15462 | cipher.name = this.getValueOrDefault(this.nameFromUrl(value.hostname), '--');
|
15463 | cipher.login.username = this.getValueOrDefault(value.username);
|
15464 | cipher.login.password = this.getValueOrDefault(value.password);
|
15465 | cipher.login.uris = this.makeUriArray(value.hostname);
|
15466 | this.cleanupCipher(cipher);
|
15467 | result.ciphers.push(cipher);
|
15468 | });
|
15469 | result.success = true;
|
15470 | return result;
|
15471 | }
|
15472 | }
|
15473 |
|
15474 |
|
15475 |
|
15476 |
|
15477 |
|
15478 |
|
15479 | class fsecureFskImporter_FSecureFskImporter extends baseImporter_BaseImporter {
|
15480 | parse(data) {
|
15481 | const result = new ImportResult();
|
15482 | const results = JSON.parse(data);
|
15483 | if (results == null || results.data == null) {
|
15484 | result.success = false;
|
15485 | return result;
|
15486 | }
|
15487 | for (const key in results.data) {
|
15488 | if (!results.data.hasOwnProperty(key)) {
|
15489 | continue;
|
15490 | }
|
15491 | const value = results.data[key];
|
15492 | const cipher = this.initLoginCipher();
|
15493 | cipher.name = this.getValueOrDefault(value.service);
|
15494 | cipher.notes = this.getValueOrDefault(value.notes);
|
15495 | if (value.style === 'website') {
|
15496 | cipher.login.username = this.getValueOrDefault(value.username);
|
15497 | cipher.login.password = this.getValueOrDefault(value.password);
|
15498 | cipher.login.uris = this.makeUriArray(value.url);
|
15499 | }
|
15500 | else if (value.style === 'creditcard') {
|
15501 | cipher.type = CipherType.Card;
|
15502 | cipher.card = new CardView();
|
15503 | cipher.card.cardholderName = this.getValueOrDefault(value.username);
|
15504 | cipher.card.number = this.getValueOrDefault(value.creditNumber);
|
15505 | cipher.card.brand = this.getCardBrand(cipher.card.number);
|
15506 | cipher.card.code = this.getValueOrDefault(value.creditCvv);
|
15507 | if (!this.isNullOrWhitespace(value.creditExpiry)) {
|
15508 | if (!this.setCardExpiration(cipher, value.creditExpiry)) {
|
15509 | this.processKvp(cipher, 'Expiration', value.creditExpiry);
|
15510 | }
|
15511 | }
|
15512 | if (!this.isNullOrWhitespace(value.password)) {
|
15513 | this.processKvp(cipher, 'PIN', value.password);
|
15514 | }
|
15515 | }
|
15516 | else {
|
15517 | continue;
|
15518 | }
|
15519 | this.convertToNoteIfNeeded(cipher);
|
15520 | this.cleanupCipher(cipher);
|
15521 | result.ciphers.push(cipher);
|
15522 | }
|
15523 | result.success = true;
|
15524 | return result;
|
15525 | }
|
15526 | }
|
15527 |
|
15528 |
|
15529 |
|
15530 |
|
15531 | class gnomeJsonImporter_GnomeJsonImporter extends baseImporter_BaseImporter {
|
15532 | parse(data) {
|
15533 | const result = new ImportResult();
|
15534 | const results = JSON.parse(data);
|
15535 | if (results == null || Object.keys(results).length === 0) {
|
15536 | result.success = false;
|
15537 | return result;
|
15538 | }
|
15539 | for (const keyRing in results) {
|
15540 | if (!results.hasOwnProperty(keyRing) || this.isNullOrWhitespace(keyRing) ||
|
15541 | results[keyRing].length === 0) {
|
15542 | continue;
|
15543 | }
|
15544 | results[keyRing].forEach((value) => {
|
15545 | if (this.isNullOrWhitespace(value.display_name) || value.display_name.indexOf('http') !== 0) {
|
15546 | return;
|
15547 | }
|
15548 | this.processFolder(result, keyRing);
|
15549 | const cipher = this.initLoginCipher();
|
15550 | cipher.name = value.display_name.replace('http://', '').replace('https://', '');
|
15551 | if (cipher.name.length > 30) {
|
15552 | cipher.name = cipher.name.substring(0, 30);
|
15553 | }
|
15554 | cipher.login.password = this.getValueOrDefault(value.secret);
|
15555 | cipher.login.uris = this.makeUriArray(value.display_name);
|
15556 | if (value.attributes != null) {
|
15557 | cipher.login.username = value.attributes != null ?
|
15558 | this.getValueOrDefault(value.attributes.username_value) : null;
|
15559 | for (const attr in value.attributes) {
|
15560 | if (!value.attributes.hasOwnProperty(attr) || attr === 'username_value' ||
|
15561 | attr === 'xdg:schema') {
|
15562 | continue;
|
15563 | }
|
15564 | this.processKvp(cipher, attr, value.attributes[attr]);
|
15565 | }
|
15566 | }
|
15567 | this.convertToNoteIfNeeded(cipher);
|
15568 | this.cleanupCipher(cipher);
|
15569 | result.ciphers.push(cipher);
|
15570 | });
|
15571 | }
|
15572 | if (this.organization) {
|
15573 | this.moveFoldersToCollections(result);
|
15574 | }
|
15575 | result.success = true;
|
15576 | return result;
|
15577 | }
|
15578 | }
|
15579 |
|
15580 |
|
15581 |
|
15582 |
|
15583 | const NotesHeader = 'Notes\n\n';
|
15584 | const ApplicationsHeader = 'Applications\n\n';
|
15585 | const WebsitesHeader = 'Websites\n\n';
|
15586 | const Delimiter = '\n---\n';
|
15587 | class kasperskyTxtImporter_KasperskyTxtImporter extends baseImporter_BaseImporter {
|
15588 | parse(data) {
|
15589 | const result = new ImportResult();
|
15590 | let notesData;
|
15591 | let applicationsData;
|
15592 | let websitesData;
|
15593 | let workingData = this.splitNewLine(data).join('\n');
|
15594 | if (workingData.indexOf(NotesHeader) !== -1) {
|
15595 | const parts = workingData.split(NotesHeader);
|
15596 | if (parts.length > 1) {
|
15597 | workingData = parts[0];
|
15598 | notesData = parts[1];
|
15599 | }
|
15600 | }
|
15601 | if (workingData.indexOf(ApplicationsHeader) !== -1) {
|
15602 | const parts = workingData.split(ApplicationsHeader);
|
15603 | if (parts.length > 1) {
|
15604 | workingData = parts[0];
|
15605 | applicationsData = parts[1];
|
15606 | }
|
15607 | }
|
15608 | if (workingData.indexOf(WebsitesHeader) === 0) {
|
15609 | const parts = workingData.split(WebsitesHeader);
|
15610 | if (parts.length > 1) {
|
15611 | workingData = parts[0];
|
15612 | websitesData = parts[1];
|
15613 | }
|
15614 | }
|
15615 | const notes = this.parseDataCategory(notesData);
|
15616 | const applications = this.parseDataCategory(applicationsData);
|
15617 | const websites = this.parseDataCategory(websitesData);
|
15618 | notes.forEach((n) => {
|
15619 | const cipher = this.initLoginCipher();
|
15620 | cipher.name = this.getValueOrDefault(n.get('Name'));
|
15621 | cipher.notes = this.getValueOrDefault(n.get('Text'));
|
15622 | this.cleanupCipher(cipher);
|
15623 | result.ciphers.push(cipher);
|
15624 | });
|
15625 | websites.concat(applications).forEach((w) => {
|
15626 | const cipher = this.initLoginCipher();
|
15627 | const nameKey = w.has('Website name') ? 'Website name' : 'Application';
|
15628 | cipher.name = this.getValueOrDefault(w.get(nameKey), '');
|
15629 | if (!this.isNullOrWhitespace(w.get('Login name'))) {
|
15630 | if (!this.isNullOrWhitespace(cipher.name)) {
|
15631 | cipher.name += ': ';
|
15632 | }
|
15633 | cipher.name += w.get('Login name');
|
15634 | }
|
15635 | cipher.notes = this.getValueOrDefault(w.get('Comment'));
|
15636 | if (w.has('Website URL')) {
|
15637 | cipher.login.uris = this.makeUriArray(w.get('Website URL'));
|
15638 | }
|
15639 | cipher.login.username = this.getValueOrDefault(w.get('Login'));
|
15640 | cipher.login.password = this.getValueOrDefault(w.get('Password'));
|
15641 | this.cleanupCipher(cipher);
|
15642 | result.ciphers.push(cipher);
|
15643 | });
|
15644 | result.success = true;
|
15645 | return result;
|
15646 | }
|
15647 | parseDataCategory(data) {
|
15648 | if (this.isNullOrWhitespace(data) || data.indexOf(Delimiter) === -1) {
|
15649 | return [];
|
15650 | }
|
15651 | const items = [];
|
15652 | data.split(Delimiter).forEach((p) => {
|
15653 | if (p.indexOf('\n') === -1) {
|
15654 | return;
|
15655 | }
|
15656 | const item = new Map();
|
15657 | let itemComment;
|
15658 | let itemCommentKey;
|
15659 | p.split('\n').forEach((l) => {
|
15660 | if (itemComment != null) {
|
15661 | itemComment += ('\n' + l);
|
15662 | return;
|
15663 | }
|
15664 | const colonIndex = l.indexOf(':');
|
15665 | let key;
|
15666 | let val;
|
15667 | if (colonIndex === -1) {
|
15668 | return;
|
15669 | }
|
15670 | else {
|
15671 | key = l.substring(0, colonIndex);
|
15672 | if (l.length > colonIndex + 1) {
|
15673 | val = l.substring(colonIndex + 2);
|
15674 | }
|
15675 | }
|
15676 | if (key != null) {
|
15677 | item.set(key, val);
|
15678 | }
|
15679 | if (key === 'Comment' || key === 'Text') {
|
15680 | itemComment = val;
|
15681 | itemCommentKey = key;
|
15682 | }
|
15683 | });
|
15684 | if (itemComment != null && itemCommentKey != null) {
|
15685 | item.set(itemCommentKey, itemComment);
|
15686 | }
|
15687 | if (item.size === 0) {
|
15688 | return;
|
15689 | }
|
15690 | items.push(item);
|
15691 | });
|
15692 | return items;
|
15693 | }
|
15694 | }
|
15695 |
|
15696 |
|
15697 |
|
15698 |
|
15699 |
|
15700 |
|
15701 | class keepass2XmlImporter_KeePass2XmlImporter extends baseImporter_BaseImporter {
|
15702 | constructor() {
|
15703 | super(...arguments);
|
15704 | this.result = new ImportResult();
|
15705 | }
|
15706 | parse(data) {
|
15707 | const doc = this.parseXml(data);
|
15708 | if (doc == null) {
|
15709 | this.result.success = false;
|
15710 | return this.result;
|
15711 | }
|
15712 | const rootGroup = doc.querySelector('KeePassFile > Root > Group');
|
15713 | if (rootGroup == null) {
|
15714 | this.result.errorMessage = 'Missing `KeePassFile > Root > Group` node.';
|
15715 | this.result.success = false;
|
15716 | return this.result;
|
15717 | }
|
15718 | this.traverse(rootGroup, true, '');
|
15719 | if (this.organization) {
|
15720 | this.moveFoldersToCollections(this.result);
|
15721 | }
|
15722 | this.result.success = true;
|
15723 | return this.result;
|
15724 | }
|
15725 | traverse(node, isRootNode, groupPrefixName) {
|
15726 | const folderIndex = this.result.folders.length;
|
15727 | let groupName = groupPrefixName;
|
15728 | if (!isRootNode) {
|
15729 | if (groupName !== '') {
|
15730 | groupName += '/';
|
15731 | }
|
15732 | const nameEl = this.querySelectorDirectChild(node, 'Name');
|
15733 | groupName += nameEl == null ? '-' : nameEl.textContent;
|
15734 | const folder = new FolderView();
|
15735 | folder.name = groupName;
|
15736 | this.result.folders.push(folder);
|
15737 | }
|
15738 | this.querySelectorAllDirectChild(node, 'Entry').forEach((entry) => {
|
15739 | const cipherIndex = this.result.ciphers.length;
|
15740 | const cipher = this.initLoginCipher();
|
15741 | this.querySelectorAllDirectChild(entry, 'String').forEach((entryString) => {
|
15742 | const valueEl = this.querySelectorDirectChild(entryString, 'Value');
|
15743 | const value = valueEl != null ? valueEl.textContent : null;
|
15744 | if (this.isNullOrWhitespace(value)) {
|
15745 | return;
|
15746 | }
|
15747 | const keyEl = this.querySelectorDirectChild(entryString, 'Key');
|
15748 | const key = keyEl != null ? keyEl.textContent : null;
|
15749 | if (key === 'URL') {
|
15750 | cipher.login.uris = this.makeUriArray(value);
|
15751 | }
|
15752 | else if (key === 'UserName') {
|
15753 | cipher.login.username = value;
|
15754 | }
|
15755 | else if (key === 'Password') {
|
15756 | cipher.login.password = value;
|
15757 | }
|
15758 | else if (key === 'Title') {
|
15759 | cipher.name = value;
|
15760 | }
|
15761 | else if (key === 'Notes') {
|
15762 | cipher.notes += (value + '\n');
|
15763 | }
|
15764 | else {
|
15765 | let type = FieldType.Text;
|
15766 | const attrs = valueEl.attributes;
|
15767 | if (attrs.length > 0 && attrs.ProtectInMemory != null &&
|
15768 | attrs.ProtectInMemory.value === 'True') {
|
15769 | type = FieldType.Hidden;
|
15770 | }
|
15771 | this.processKvp(cipher, key, value, type);
|
15772 | }
|
15773 | });
|
15774 | this.cleanupCipher(cipher);
|
15775 | this.result.ciphers.push(cipher);
|
15776 | if (!isRootNode) {
|
15777 | this.result.folderRelationships.push([cipherIndex, folderIndex]);
|
15778 | }
|
15779 | });
|
15780 | this.querySelectorAllDirectChild(node, 'Group').forEach((group) => {
|
15781 | this.traverse(group, false, groupName);
|
15782 | });
|
15783 | }
|
15784 | }
|
15785 |
|
15786 |
|
15787 |
|
15788 |
|
15789 | class keepassxCsvImporter_KeePassXCsvImporter extends baseImporter_BaseImporter {
|
15790 | parse(data) {
|
15791 | const result = new ImportResult();
|
15792 | const results = this.parseCsv(data, true);
|
15793 | if (results == null) {
|
15794 | result.success = false;
|
15795 | return result;
|
15796 | }
|
15797 | results.forEach((value) => {
|
15798 | if (this.isNullOrWhitespace(value.Title)) {
|
15799 | return;
|
15800 | }
|
15801 | value.Group = !this.isNullOrWhitespace(value.Group) && value.Group.startsWith('Root/') ?
|
15802 | value.Group.replace('Root/', '') : value.Group;
|
15803 | const groupName = !this.isNullOrWhitespace(value.Group) ? value.Group : null;
|
15804 | this.processFolder(result, groupName);
|
15805 | const cipher = this.initLoginCipher();
|
15806 | cipher.notes = this.getValueOrDefault(value.Notes);
|
15807 | cipher.name = this.getValueOrDefault(value.Title, '--');
|
15808 | cipher.login.username = this.getValueOrDefault(value.Username);
|
15809 | cipher.login.password = this.getValueOrDefault(value.Password);
|
15810 | cipher.login.uris = this.makeUriArray(value.URL);
|
15811 | this.cleanupCipher(cipher);
|
15812 | result.ciphers.push(cipher);
|
15813 | });
|
15814 | if (this.organization) {
|
15815 | this.moveFoldersToCollections(result);
|
15816 | }
|
15817 | result.success = true;
|
15818 | return result;
|
15819 | }
|
15820 | }
|
15821 |
|
15822 |
|
15823 |
|
15824 |
|
15825 | class keeperCsvImporter_KeeperCsvImporter extends baseImporter_BaseImporter {
|
15826 | parse(data) {
|
15827 | const result = new ImportResult();
|
15828 | const results = this.parseCsv(data, false);
|
15829 | if (results == null) {
|
15830 | result.success = false;
|
15831 | return result;
|
15832 | }
|
15833 | results.forEach((value) => {
|
15834 | if (value.length < 6) {
|
15835 | return;
|
15836 | }
|
15837 | this.processFolder(result, value[0]);
|
15838 | const cipher = this.initLoginCipher();
|
15839 | cipher.notes = this.getValueOrDefault(value[5]) + '\n';
|
15840 | cipher.name = this.getValueOrDefault(value[1], '--');
|
15841 | cipher.login.username = this.getValueOrDefault(value[2]);
|
15842 | cipher.login.password = this.getValueOrDefault(value[3]);
|
15843 | cipher.login.uris = this.makeUriArray(value[4]);
|
15844 | if (value.length > 7) {
|
15845 |
|
15846 | for (let i = 7; i < value.length; i = i + 2) {
|
15847 | this.processKvp(cipher, value[i], value[i + 1]);
|
15848 | }
|
15849 | }
|
15850 | this.cleanupCipher(cipher);
|
15851 | result.ciphers.push(cipher);
|
15852 | });
|
15853 | if (this.organization) {
|
15854 | this.moveFoldersToCollections(result);
|
15855 | }
|
15856 | result.success = true;
|
15857 | return result;
|
15858 | }
|
15859 | }
|
15860 |
|
15861 |
|
15862 |
|
15863 |
|
15864 |
|
15865 |
|
15866 |
|
15867 |
|
15868 |
|
15869 |
|
15870 |
|
15871 |
|
15872 | class lastpassCsvImporter_LastPassCsvImporter extends baseImporter_BaseImporter {
|
15873 | parse(data) {
|
15874 | const result = new ImportResult();
|
15875 | const results = this.parseCsv(data, true);
|
15876 | if (results == null) {
|
15877 | result.success = false;
|
15878 | return result;
|
15879 | }
|
15880 | results.forEach((value, index) => {
|
15881 | const cipherIndex = result.ciphers.length;
|
15882 | let folderIndex = result.folders.length;
|
15883 | let grouping = value.grouping;
|
15884 | if (grouping != null) {
|
15885 | grouping = grouping.replace(/\\/g, '/').replace(/[\x00-\x1F\x7F-\x9F]/g, '');
|
15886 | }
|
15887 | const hasFolder = this.getValueOrDefault(grouping, '(none)') !== '(none)';
|
15888 | let addFolder = hasFolder;
|
15889 | if (hasFolder) {
|
15890 | for (let i = 0; i < result.folders.length; i++) {
|
15891 | if (result.folders[i].name === grouping) {
|
15892 | addFolder = false;
|
15893 | folderIndex = i;
|
15894 | break;
|
15895 | }
|
15896 | }
|
15897 | }
|
15898 | const cipher = this.buildBaseCipher(value);
|
15899 | if (cipher.type === CipherType.Login) {
|
15900 | cipher.notes = this.getValueOrDefault(value.extra);
|
15901 | cipher.login = new LoginView();
|
15902 | cipher.login.uris = this.makeUriArray(value.url);
|
15903 | cipher.login.username = this.getValueOrDefault(value.username);
|
15904 | cipher.login.password = this.getValueOrDefault(value.password);
|
15905 | }
|
15906 | else if (cipher.type === CipherType.SecureNote) {
|
15907 | this.parseSecureNote(value, cipher);
|
15908 | }
|
15909 | else if (cipher.type === CipherType.Card) {
|
15910 | cipher.card = this.parseCard(value);
|
15911 | cipher.notes = this.getValueOrDefault(value.notes);
|
15912 | }
|
15913 | else if (cipher.type === CipherType.Identity) {
|
15914 | cipher.identity = this.parseIdentity(value);
|
15915 | cipher.notes = this.getValueOrDefault(value.notes);
|
15916 | if (!this.isNullOrWhitespace(value.ccnum)) {
|
15917 |
|
15918 | const cardCipher = this.buildBaseCipher(value);
|
15919 | cardCipher.identity = null;
|
15920 | cardCipher.type = CipherType.Card;
|
15921 | cardCipher.card = this.parseCard(value);
|
15922 | result.ciphers.push(cardCipher);
|
15923 | }
|
15924 | }
|
15925 | result.ciphers.push(cipher);
|
15926 | if (addFolder) {
|
15927 | const f = new FolderView();
|
15928 | f.name = grouping;
|
15929 | result.folders.push(f);
|
15930 | }
|
15931 | if (hasFolder) {
|
15932 | result.folderRelationships.push([cipherIndex, folderIndex]);
|
15933 | }
|
15934 | });
|
15935 | if (this.organization) {
|
15936 | this.moveFoldersToCollections(result);
|
15937 | }
|
15938 | result.success = true;
|
15939 | return result;
|
15940 | }
|
15941 | buildBaseCipher(value) {
|
15942 | const cipher = new cipherView_CipherView();
|
15943 | if (value.hasOwnProperty('profilename') && value.hasOwnProperty('profilelanguage')) {
|
15944 |
|
15945 | cipher.favorite = false;
|
15946 | cipher.name = this.getValueOrDefault(value.profilename, '--');
|
15947 | cipher.type = CipherType.Card;
|
15948 | if (!this.isNullOrWhitespace(value.title) || !this.isNullOrWhitespace(value.firstname) ||
|
15949 | !this.isNullOrWhitespace(value.lastname) || !this.isNullOrWhitespace(value.address1) ||
|
15950 | !this.isNullOrWhitespace(value.phone) || !this.isNullOrWhitespace(value.username) ||
|
15951 | !this.isNullOrWhitespace(value.email)) {
|
15952 | cipher.type = CipherType.Identity;
|
15953 | }
|
15954 | }
|
15955 | else {
|
15956 |
|
15957 | cipher.favorite = !this.organization && this.getValueOrDefault(value.fav, '0') === '1';
|
15958 | cipher.name = this.getValueOrDefault(value.name, '--');
|
15959 | cipher.type = value.url === 'http://sn' ? CipherType.SecureNote : CipherType.Login;
|
15960 | }
|
15961 | return cipher;
|
15962 | }
|
15963 | parseCard(value) {
|
15964 | const card = new CardView();
|
15965 | card.cardholderName = this.getValueOrDefault(value.ccname);
|
15966 | card.number = this.getValueOrDefault(value.ccnum);
|
15967 | card.code = this.getValueOrDefault(value.cccsc);
|
15968 | card.brand = this.getCardBrand(value.ccnum);
|
15969 | if (!this.isNullOrWhitespace(value.ccexp) && value.ccexp.indexOf('-') > -1) {
|
15970 | const ccexpParts = value.ccexp.split('-');
|
15971 | if (ccexpParts.length > 1) {
|
15972 | card.expYear = ccexpParts[0];
|
15973 | card.expMonth = ccexpParts[1];
|
15974 | if (card.expMonth.length === 2 && card.expMonth[0] === '0') {
|
15975 | card.expMonth = card.expMonth[1];
|
15976 | }
|
15977 | }
|
15978 | }
|
15979 | return card;
|
15980 | }
|
15981 | parseIdentity(value) {
|
15982 | const identity = new identityView_IdentityView();
|
15983 | identity.title = this.getValueOrDefault(value.title);
|
15984 | identity.firstName = this.getValueOrDefault(value.firstname);
|
15985 | identity.middleName = this.getValueOrDefault(value.middlename);
|
15986 | identity.lastName = this.getValueOrDefault(value.lastname);
|
15987 | identity.username = this.getValueOrDefault(value.username);
|
15988 | identity.company = this.getValueOrDefault(value.company);
|
15989 | identity.ssn = this.getValueOrDefault(value.ssn);
|
15990 | identity.address1 = this.getValueOrDefault(value.address1);
|
15991 | identity.address2 = this.getValueOrDefault(value.address2);
|
15992 | identity.address3 = this.getValueOrDefault(value.address3);
|
15993 | identity.city = this.getValueOrDefault(value.city);
|
15994 | identity.state = this.getValueOrDefault(value.state);
|
15995 | identity.postalCode = this.getValueOrDefault(value.zip);
|
15996 | identity.country = this.getValueOrDefault(value.country);
|
15997 | identity.email = this.getValueOrDefault(value.email);
|
15998 | identity.phone = this.getValueOrDefault(value.phone);
|
15999 | if (!this.isNullOrWhitespace(identity.title)) {
|
16000 | identity.title = identity.title.charAt(0).toUpperCase() + identity.title.slice(1);
|
16001 | }
|
16002 | return identity;
|
16003 | }
|
16004 | parseSecureNote(value, cipher) {
|
16005 | const extraParts = this.splitNewLine(value.extra);
|
16006 | let processedNote = false;
|
16007 | if (extraParts.length) {
|
16008 | const typeParts = extraParts[0].split(':');
|
16009 | if (typeParts.length > 1 && typeParts[0] === 'NoteType' &&
|
16010 | (typeParts[1] === 'Credit Card' || typeParts[1] === 'Address')) {
|
16011 | if (typeParts[1] === 'Credit Card') {
|
16012 | const mappedData = this.parseSecureNoteMapping(cipher, extraParts, {
|
16013 | 'Number': 'number',
|
16014 | 'Name on Card': 'cardholderName',
|
16015 | 'Security Code': 'code',
|
16016 |
|
16017 |
|
16018 | 'Expiration Date': 'expMonth',
|
16019 | });
|
16020 | if (this.isNullOrWhitespace(mappedData.expMonth) || mappedData.expMonth === ',') {
|
16021 |
|
16022 | mappedData.expMonth = undefined;
|
16023 | }
|
16024 | else {
|
16025 | const [monthString, year] = mappedData.expMonth.split(',');
|
16026 |
|
16027 | if (!this.isNullOrWhitespace(monthString)) {
|
16028 | const month = new Date(Date.parse(monthString.trim() + ' 1, 2012')).getMonth() + 1;
|
16029 | if (isNaN(month)) {
|
16030 | mappedData.expMonth = undefined;
|
16031 | }
|
16032 | else {
|
16033 | mappedData.expMonth = month.toString();
|
16034 | }
|
16035 | }
|
16036 | else {
|
16037 | mappedData.expMonth = undefined;
|
16038 | }
|
16039 | if (!this.isNullOrWhitespace(year)) {
|
16040 | mappedData.expYear = year;
|
16041 | }
|
16042 | }
|
16043 | cipher.type = CipherType.Card;
|
16044 | cipher.card = mappedData;
|
16045 | }
|
16046 | else if (typeParts[1] === 'Address') {
|
16047 | const mappedData = this.parseSecureNoteMapping(cipher, extraParts, {
|
16048 | 'Title': 'title',
|
16049 | 'First Name': 'firstName',
|
16050 | 'Last Name': 'lastName',
|
16051 | 'Middle Name': 'middleName',
|
16052 | 'Company': 'company',
|
16053 | 'Address 1': 'address1',
|
16054 | 'Address 2': 'address2',
|
16055 | 'Address 3': 'address3',
|
16056 | 'City / Town': 'city',
|
16057 | 'State': 'state',
|
16058 | 'Zip / Postal Code': 'postalCode',
|
16059 | 'Country': 'country',
|
16060 | 'Email Address': 'email',
|
16061 | 'Username': 'username',
|
16062 | });
|
16063 | cipher.type = CipherType.Identity;
|
16064 | cipher.identity = mappedData;
|
16065 | }
|
16066 | processedNote = true;
|
16067 | }
|
16068 | }
|
16069 | if (!processedNote) {
|
16070 | cipher.secureNote = new SecureNoteView();
|
16071 | cipher.secureNote.type = SecureNoteType.Generic;
|
16072 | cipher.notes = this.getValueOrDefault(value.extra);
|
16073 | }
|
16074 | }
|
16075 | parseSecureNoteMapping(cipher, extraParts, map) {
|
16076 | const dataObj = {};
|
16077 | let processingNotes = false;
|
16078 | extraParts.forEach((extraPart) => {
|
16079 | let key = null;
|
16080 | let val = null;
|
16081 | if (!processingNotes) {
|
16082 | if (this.isNullOrWhitespace(extraPart)) {
|
16083 | return;
|
16084 | }
|
16085 | const colonIndex = extraPart.indexOf(':');
|
16086 | if (colonIndex === -1) {
|
16087 | key = extraPart;
|
16088 | }
|
16089 | else {
|
16090 | key = extraPart.substring(0, colonIndex);
|
16091 | if (extraPart.length > colonIndex) {
|
16092 | val = extraPart.substring(colonIndex + 1);
|
16093 | }
|
16094 | }
|
16095 | if (this.isNullOrWhitespace(key) || this.isNullOrWhitespace(val) || key === 'NoteType') {
|
16096 | return;
|
16097 | }
|
16098 | }
|
16099 | if (processingNotes) {
|
16100 | cipher.notes += ('\n' + extraPart);
|
16101 | }
|
16102 | else if (key === 'Notes') {
|
16103 | if (!this.isNullOrWhitespace(cipher.notes)) {
|
16104 | cipher.notes += ('\n' + val);
|
16105 | }
|
16106 | else {
|
16107 | cipher.notes = val;
|
16108 | }
|
16109 | processingNotes = true;
|
16110 | }
|
16111 | else if (map.hasOwnProperty(key)) {
|
16112 | dataObj[map[key]] = val;
|
16113 | }
|
16114 | else {
|
16115 | this.processKvp(cipher, key, val);
|
16116 | }
|
16117 | });
|
16118 | return dataObj;
|
16119 | }
|
16120 | }
|
16121 |
|
16122 |
|
16123 |
|
16124 |
|
16125 | class logMeOnceCsvImporter_LogMeOnceCsvImporter extends baseImporter_BaseImporter {
|
16126 | parse(data) {
|
16127 | const result = new ImportResult();
|
16128 | const results = this.parseCsv(data, false);
|
16129 | if (results == null) {
|
16130 | result.success = false;
|
16131 | return result;
|
16132 | }
|
16133 | results.forEach((value) => {
|
16134 | if (value.length < 4) {
|
16135 | return;
|
16136 | }
|
16137 | const cipher = this.initLoginCipher();
|
16138 | cipher.name = this.getValueOrDefault(value[0], '--');
|
16139 | cipher.login.username = this.getValueOrDefault(value[2]);
|
16140 | cipher.login.password = this.getValueOrDefault(value[3]);
|
16141 | cipher.login.uris = this.makeUriArray(value[1]);
|
16142 | this.cleanupCipher(cipher);
|
16143 | result.ciphers.push(cipher);
|
16144 | });
|
16145 | result.success = true;
|
16146 | return result;
|
16147 | }
|
16148 | }
|
16149 |
|
16150 |
|
16151 |
|
16152 |
|
16153 | class meldiumCsvImporter_MeldiumCsvImporter extends baseImporter_BaseImporter {
|
16154 | parse(data) {
|
16155 | const result = new ImportResult();
|
16156 | const results = this.parseCsv(data, true);
|
16157 | if (results == null) {
|
16158 | result.success = false;
|
16159 | return result;
|
16160 | }
|
16161 | results.forEach((value) => {
|
16162 | const cipher = this.initLoginCipher();
|
16163 | cipher.name = this.getValueOrDefault(value.DisplayName, '--');
|
16164 | cipher.notes = this.getValueOrDefault(value.Notes);
|
16165 | cipher.login.username = this.getValueOrDefault(value.UserName);
|
16166 | cipher.login.password = this.getValueOrDefault(value.Password);
|
16167 | cipher.login.uris = this.makeUriArray(value.Url);
|
16168 | this.cleanupCipher(cipher);
|
16169 | result.ciphers.push(cipher);
|
16170 | });
|
16171 | result.success = true;
|
16172 | return result;
|
16173 | }
|
16174 | }
|
16175 |
|
16176 |
|
16177 |
|
16178 |
|
16179 |
|
16180 |
|
16181 |
|
16182 | class msecureCsvImporter_MSecureCsvImporter extends baseImporter_BaseImporter {
|
16183 | parse(data) {
|
16184 | const result = new ImportResult();
|
16185 | const results = this.parseCsv(data, false);
|
16186 | if (results == null) {
|
16187 | result.success = false;
|
16188 | return result;
|
16189 | }
|
16190 | results.forEach((value) => {
|
16191 | if (value.length < 3) {
|
16192 | return;
|
16193 | }
|
16194 | const folderName = this.getValueOrDefault(value[0], 'Unassigned') !== 'Unassigned' ? value[0] : null;
|
16195 | this.processFolder(result, folderName);
|
16196 | const cipher = this.initLoginCipher();
|
16197 | cipher.name = this.getValueOrDefault(value[2], '--');
|
16198 | if (value[1] === 'Web Logins' || value[1] === 'Login') {
|
16199 | cipher.login.uris = this.makeUriArray(value[4]);
|
16200 | cipher.login.username = this.getValueOrDefault(value[5]);
|
16201 | cipher.login.password = this.getValueOrDefault(value[6]);
|
16202 | cipher.notes = !this.isNullOrWhitespace(value[3]) ? value[3].split('\\n').join('\n') : null;
|
16203 | }
|
16204 | else if (value.length > 3) {
|
16205 | cipher.type = CipherType.SecureNote;
|
16206 | cipher.secureNote = new SecureNoteView();
|
16207 | cipher.secureNote.type = SecureNoteType.Generic;
|
16208 | for (let i = 3; i < value.length; i++) {
|
16209 | if (!this.isNullOrWhitespace(value[i])) {
|
16210 | cipher.notes += (value[i] + '\n');
|
16211 | }
|
16212 | }
|
16213 | }
|
16214 | if (!this.isNullOrWhitespace(value[1]) && cipher.type !== CipherType.Login) {
|
16215 | cipher.name = value[1] + ': ' + cipher.name;
|
16216 | }
|
16217 | this.cleanupCipher(cipher);
|
16218 | result.ciphers.push(cipher);
|
16219 | });
|
16220 | if (this.organization) {
|
16221 | this.moveFoldersToCollections(result);
|
16222 | }
|
16223 | result.success = true;
|
16224 | return result;
|
16225 | }
|
16226 | }
|
16227 |
|
16228 |
|
16229 |
|
16230 |
|
16231 |
|
16232 |
|
16233 |
|
16234 |
|
16235 |
|
16236 | class mykiCsvImporter_MykiCsvImporter extends baseImporter_BaseImporter {
|
16237 | parse(data) {
|
16238 | const result = new ImportResult();
|
16239 | const results = this.parseCsv(data, true);
|
16240 | if (results == null) {
|
16241 | result.success = false;
|
16242 | return result;
|
16243 | }
|
16244 | results.forEach((value) => {
|
16245 | const cipher = this.initLoginCipher();
|
16246 | cipher.name = this.getValueOrDefault(value.nickname, '--');
|
16247 | cipher.notes = this.getValueOrDefault(value.additionalInfo);
|
16248 | if (value.url !== undefined) {
|
16249 |
|
16250 | cipher.login.uris = this.makeUriArray(value.url);
|
16251 | cipher.login.username = this.getValueOrDefault(value.username);
|
16252 | cipher.login.password = this.getValueOrDefault(value.password);
|
16253 | cipher.login.totp = this.getValueOrDefault(value.twoFactAuthToken);
|
16254 | }
|
16255 | else if (value.cardNumber !== undefined) {
|
16256 |
|
16257 | cipher.card = new CardView();
|
16258 | cipher.type = CipherType.Card;
|
16259 | cipher.card.cardholderName = this.getValueOrDefault(value.cardName);
|
16260 | cipher.card.number = this.getValueOrDefault(value.cardNumber);
|
16261 | cipher.card.brand = this.getCardBrand(cipher.card.number);
|
16262 | cipher.card.expMonth = this.getValueOrDefault(value.exp_month);
|
16263 | cipher.card.expYear = this.getValueOrDefault(value.exp_year);
|
16264 | cipher.card.code = this.getValueOrDefault(value.cvv);
|
16265 | }
|
16266 | else if (value.firstName !== undefined) {
|
16267 |
|
16268 | cipher.identity = new identityView_IdentityView();
|
16269 | cipher.type = CipherType.Identity;
|
16270 | cipher.identity.title = this.getValueOrDefault(value.title);
|
16271 | cipher.identity.firstName = this.getValueOrDefault(value.firstName);
|
16272 | cipher.identity.middleName = this.getValueOrDefault(value.middleName);
|
16273 | cipher.identity.lastName = this.getValueOrDefault(value.lastName);
|
16274 | cipher.identity.phone = this.getValueOrDefault(value.number);
|
16275 | cipher.identity.email = this.getValueOrDefault(value.email);
|
16276 | cipher.identity.address1 = this.getValueOrDefault(value.firstAddressLine);
|
16277 | cipher.identity.address2 = this.getValueOrDefault(value.secondAddressLine);
|
16278 | cipher.identity.city = this.getValueOrDefault(value.city);
|
16279 | cipher.identity.country = this.getValueOrDefault(value.country);
|
16280 | cipher.identity.postalCode = this.getValueOrDefault(value.zipCode);
|
16281 | }
|
16282 | else if (value.content !== undefined) {
|
16283 |
|
16284 | cipher.secureNote = new SecureNoteView();
|
16285 | cipher.type = CipherType.SecureNote;
|
16286 | cipher.secureNote.type = SecureNoteType.Generic;
|
16287 | cipher.name = this.getValueOrDefault(value.title, '--');
|
16288 | cipher.notes = this.getValueOrDefault(value.content);
|
16289 | }
|
16290 | else {
|
16291 | return;
|
16292 | }
|
16293 | this.cleanupCipher(cipher);
|
16294 | result.ciphers.push(cipher);
|
16295 | });
|
16296 | result.success = true;
|
16297 | return result;
|
16298 | }
|
16299 | }
|
16300 |
|
16301 |
|
16302 |
|
16303 |
|
16304 |
|
16305 |
|
16306 |
|
16307 |
|
16308 |
|
16309 |
|
16310 |
|
16311 | class onepassword1PifImporter_OnePassword1PifImporter extends baseImporter_BaseImporter {
|
16312 | constructor() {
|
16313 | super(...arguments);
|
16314 | this.result = new ImportResult();
|
16315 | }
|
16316 | parse(data) {
|
16317 | data.split(this.newLineRegex).forEach((line) => {
|
16318 | if (this.isNullOrWhitespace(line) || line[0] !== '{') {
|
16319 | return;
|
16320 | }
|
16321 | const item = JSON.parse(line);
|
16322 | if (item.trashed === true) {
|
16323 | return;
|
16324 | }
|
16325 | const cipher = this.initLoginCipher();
|
16326 | if (this.isNullOrWhitespace(item.hmac)) {
|
16327 | this.processStandardItem(item, cipher);
|
16328 | }
|
16329 | else {
|
16330 | this.processWinOpVaultItem(item, cipher);
|
16331 | }
|
16332 | this.convertToNoteIfNeeded(cipher);
|
16333 | this.cleanupCipher(cipher);
|
16334 | this.result.ciphers.push(cipher);
|
16335 | });
|
16336 | this.result.success = true;
|
16337 | return this.result;
|
16338 | }
|
16339 | processWinOpVaultItem(item, cipher) {
|
16340 | if (item.overview != null) {
|
16341 | cipher.name = this.getValueOrDefault(item.overview.title);
|
16342 | if (item.overview.URLs != null) {
|
16343 | const urls = [];
|
16344 | item.overview.URLs.forEach((url) => {
|
16345 | if (!this.isNullOrWhitespace(url.u)) {
|
16346 | urls.push(url.u);
|
16347 | }
|
16348 | });
|
16349 | cipher.login.uris = this.makeUriArray(urls);
|
16350 | }
|
16351 | }
|
16352 | if (item.details != null) {
|
16353 | if (item.details.passwordHistory != null) {
|
16354 | this.parsePasswordHistory(item.details.passwordHistory, cipher);
|
16355 | }
|
16356 | if (!this.isNullOrWhitespace(item.details.ccnum) || !this.isNullOrWhitespace(item.details.cvv)) {
|
16357 | cipher.type = CipherType.Card;
|
16358 | cipher.card = new CardView();
|
16359 | }
|
16360 | else if (!this.isNullOrWhitespace(item.details.firstname) ||
|
16361 | !this.isNullOrWhitespace(item.details.address1)) {
|
16362 | cipher.type = CipherType.Identity;
|
16363 | cipher.identity = new identityView_IdentityView();
|
16364 | }
|
16365 | if (cipher.type === CipherType.Login && !this.isNullOrWhitespace(item.details.password)) {
|
16366 | cipher.login.password = item.details.password;
|
16367 | }
|
16368 | if (!this.isNullOrWhitespace(item.details.notesPlain)) {
|
16369 | cipher.notes = item.details.notesPlain.split(this.newLineRegex).join('\n') + '\n';
|
16370 | }
|
16371 | if (item.details.fields != null) {
|
16372 | this.parseFields(item.details.fields, cipher, 'designation', 'value', 'name');
|
16373 | }
|
16374 | if (item.details.sections != null) {
|
16375 | item.details.sections.forEach((section) => {
|
16376 | if (section.fields != null) {
|
16377 | this.parseFields(section.fields, cipher, 'n', 'v', 't');
|
16378 | }
|
16379 | });
|
16380 | }
|
16381 | }
|
16382 | }
|
16383 | processStandardItem(item, cipher) {
|
16384 | cipher.favorite = item.openContents && item.openContents.faveIndex ? true : false;
|
16385 | cipher.name = this.getValueOrDefault(item.title);
|
16386 | if (item.typeName === 'securenotes.SecureNote') {
|
16387 | cipher.type = CipherType.SecureNote;
|
16388 | cipher.secureNote = new SecureNoteView();
|
16389 | cipher.secureNote.type = SecureNoteType.Generic;
|
16390 | }
|
16391 | else if (item.typeName === 'wallet.financial.CreditCard') {
|
16392 | cipher.type = CipherType.Card;
|
16393 | cipher.card = new CardView();
|
16394 | }
|
16395 | else if (item.typeName === 'identities.Identity') {
|
16396 | cipher.type = CipherType.Identity;
|
16397 | cipher.identity = new identityView_IdentityView();
|
16398 | }
|
16399 | else {
|
16400 | cipher.login.uris = this.makeUriArray(item.location);
|
16401 | }
|
16402 | if (item.secureContents != null) {
|
16403 | if (item.secureContents.passwordHistory != null) {
|
16404 | this.parsePasswordHistory(item.secureContents.passwordHistory, cipher);
|
16405 | }
|
16406 | if (!this.isNullOrWhitespace(item.secureContents.notesPlain)) {
|
16407 | cipher.notes = item.secureContents.notesPlain.split(this.newLineRegex).join('\n') + '\n';
|
16408 | }
|
16409 | if (cipher.type === CipherType.Login) {
|
16410 | if (!this.isNullOrWhitespace(item.secureContents.password)) {
|
16411 | cipher.login.password = item.secureContents.password;
|
16412 | }
|
16413 | if (item.secureContents.URLs != null) {
|
16414 | const urls = [];
|
16415 | item.secureContents.URLs.forEach((u) => {
|
16416 | if (!this.isNullOrWhitespace(u.url)) {
|
16417 | urls.push(u.url);
|
16418 | }
|
16419 | });
|
16420 | if (urls.length > 0) {
|
16421 | cipher.login.uris = this.makeUriArray(urls);
|
16422 | }
|
16423 | }
|
16424 | }
|
16425 | if (item.secureContents.fields != null) {
|
16426 | this.parseFields(item.secureContents.fields, cipher, 'designation', 'value', 'name');
|
16427 | }
|
16428 | if (item.secureContents.sections != null) {
|
16429 | item.secureContents.sections.forEach((section) => {
|
16430 | if (section.fields != null) {
|
16431 | this.parseFields(section.fields, cipher, 'n', 'v', 't');
|
16432 | }
|
16433 | });
|
16434 | }
|
16435 | }
|
16436 | }
|
16437 | parsePasswordHistory(items, cipher) {
|
16438 | const maxSize = items.length > 5 ? 5 : items.length;
|
16439 | cipher.passwordHistory = items
|
16440 | .filter((h) => !this.isNullOrWhitespace(h.value) && h.time != null)
|
16441 | .sort((a, b) => b.time - a.time)
|
16442 | .slice(0, maxSize)
|
16443 | .map((h) => {
|
16444 | const ph = new PasswordHistoryView();
|
16445 | ph.password = h.value;
|
16446 | ph.lastUsedDate = new Date(('' + h.time).length >= 13 ? h.time : h.time * 1000);
|
16447 | return ph;
|
16448 | });
|
16449 | }
|
16450 | parseFields(fields, cipher, designationKey, valueKey, nameKey) {
|
16451 | fields.forEach((field) => {
|
16452 | if (field[valueKey] == null || field[valueKey].toString().trim() === '') {
|
16453 | return;
|
16454 | }
|
16455 | const fieldValue = field[valueKey].toString();
|
16456 | const fieldDesignation = field[designationKey] != null ? field[designationKey].toString() : null;
|
16457 | if (cipher.type === CipherType.Login) {
|
16458 | if (this.isNullOrWhitespace(cipher.login.username) && fieldDesignation === 'username') {
|
16459 | cipher.login.username = fieldValue;
|
16460 | return;
|
16461 | }
|
16462 | else if (this.isNullOrWhitespace(cipher.login.password) && fieldDesignation === 'password') {
|
16463 | cipher.login.password = fieldValue;
|
16464 | return;
|
16465 | }
|
16466 | else if (this.isNullOrWhitespace(cipher.login.totp) && fieldDesignation != null &&
|
16467 | fieldDesignation.startsWith('TOTP_')) {
|
16468 | cipher.login.totp = fieldValue;
|
16469 | return;
|
16470 | }
|
16471 | }
|
16472 | else if (cipher.type === CipherType.Card) {
|
16473 | if (this.isNullOrWhitespace(cipher.card.number) && fieldDesignation === 'ccnum') {
|
16474 | cipher.card.number = fieldValue;
|
16475 | cipher.card.brand = this.getCardBrand(fieldValue);
|
16476 | return;
|
16477 | }
|
16478 | else if (this.isNullOrWhitespace(cipher.card.code) && fieldDesignation === 'cvv') {
|
16479 | cipher.card.code = fieldValue;
|
16480 | return;
|
16481 | }
|
16482 | else if (this.isNullOrWhitespace(cipher.card.cardholderName) && fieldDesignation === 'cardholder') {
|
16483 | cipher.card.cardholderName = fieldValue;
|
16484 | return;
|
16485 | }
|
16486 | else if (this.isNullOrWhitespace(cipher.card.expiration) && fieldDesignation === 'expiry' &&
|
16487 | fieldValue.length === 6) {
|
16488 | cipher.card.expMonth = fieldValue.substr(4, 2);
|
16489 | if (cipher.card.expMonth[0] === '0') {
|
16490 | cipher.card.expMonth = cipher.card.expMonth.substr(1, 1);
|
16491 | }
|
16492 | cipher.card.expYear = fieldValue.substr(0, 4);
|
16493 | return;
|
16494 | }
|
16495 | else if (fieldDesignation === 'type') {
|
16496 |
|
16497 | return;
|
16498 | }
|
16499 | }
|
16500 | else if (cipher.type === CipherType.Identity) {
|
16501 | const identity = cipher.identity;
|
16502 | if (this.isNullOrWhitespace(identity.firstName) && fieldDesignation === 'firstname') {
|
16503 | identity.firstName = fieldValue;
|
16504 | return;
|
16505 | }
|
16506 | else if (this.isNullOrWhitespace(identity.lastName) && fieldDesignation === 'lastname') {
|
16507 | identity.lastName = fieldValue;
|
16508 | return;
|
16509 | }
|
16510 | else if (this.isNullOrWhitespace(identity.middleName) && fieldDesignation === 'initial') {
|
16511 | identity.middleName = fieldValue;
|
16512 | return;
|
16513 | }
|
16514 | else if (this.isNullOrWhitespace(identity.phone) && fieldDesignation === 'defphone') {
|
16515 | identity.phone = fieldValue;
|
16516 | return;
|
16517 | }
|
16518 | else if (this.isNullOrWhitespace(identity.company) && fieldDesignation === 'company') {
|
16519 | identity.company = fieldValue;
|
16520 | return;
|
16521 | }
|
16522 | else if (this.isNullOrWhitespace(identity.email) && fieldDesignation === 'email') {
|
16523 | identity.email = fieldValue;
|
16524 | return;
|
16525 | }
|
16526 | else if (this.isNullOrWhitespace(identity.username) && fieldDesignation === 'username') {
|
16527 | identity.username = fieldValue;
|
16528 | return;
|
16529 | }
|
16530 | else if (fieldDesignation === 'address') {
|
16531 |
|
16532 | const { street, city, country, zip } = field[valueKey];
|
16533 | identity.address1 = this.getValueOrDefault(street);
|
16534 | identity.city = this.getValueOrDefault(city);
|
16535 | if (!this.isNullOrWhitespace(country)) {
|
16536 | identity.country = country.toUpperCase();
|
16537 | }
|
16538 | identity.postalCode = this.getValueOrDefault(zip);
|
16539 | return;
|
16540 | }
|
16541 | }
|
16542 | const fieldName = this.isNullOrWhitespace(field[nameKey]) ? 'no_name' : field[nameKey];
|
16543 | if (fieldName === 'password' && cipher.passwordHistory != null &&
|
16544 | cipher.passwordHistory.some((h) => h.password === fieldValue)) {
|
16545 | return;
|
16546 | }
|
16547 | const fieldType = field.k === 'concealed' ? FieldType.Hidden : FieldType.Text;
|
16548 | this.processKvp(cipher, fieldName, fieldValue, fieldType);
|
16549 | });
|
16550 | }
|
16551 | }
|
16552 |
|
16553 |
|
16554 | class View {
|
16555 | }
|
16556 |
|
16557 |
|
16558 |
|
16559 |
|
16560 |
|
16561 |
|
16562 |
|
16563 |
|
16564 |
|
16565 |
|
16566 |
|
16567 |
|
16568 |
|
16569 |
|
16570 |
|
16571 |
|
16572 |
|
16573 | const IgnoredProperties = ['ainfo', 'autosubmit', 'notesplain', 'ps', 'scope', 'tags', 'title', 'uuid'];
|
16574 | class onepasswordWinCsvImporter_OnePasswordWinCsvImporter extends baseImporter_BaseImporter {
|
16575 | parse(data) {
|
16576 | const result = new ImportResult();
|
16577 | const results = this.parseCsv(data, true);
|
16578 | if (results == null) {
|
16579 | result.success = false;
|
16580 | return result;
|
16581 | }
|
16582 | results.forEach((value) => {
|
16583 | if (this.isNullOrWhitespace(this.getProp(value, 'title'))) {
|
16584 | return;
|
16585 | }
|
16586 | const cipher = this.initLoginCipher();
|
16587 | cipher.name = this.getValueOrDefault(this.getProp(value, 'title'), '--');
|
16588 | cipher.notes = this.getValueOrDefault(this.getProp(value, 'notesPlain'), '') + '\n';
|
16589 | if (!this.isNullOrWhitespace(this.getProp(value, 'number')) &&
|
16590 | !this.isNullOrWhitespace(this.getProp(value, 'expiry date'))) {
|
16591 | cipher.type = CipherType.Card;
|
16592 | cipher.card = new CardView();
|
16593 | }
|
16594 | let altUsername = null;
|
16595 | for (const property in value) {
|
16596 | if (!value.hasOwnProperty(property) || this.isNullOrWhitespace(value[property])) {
|
16597 | continue;
|
16598 | }
|
16599 | const lowerProp = property.toLowerCase();
|
16600 | if (cipher.type === CipherType.Login) {
|
16601 | if (this.isNullOrWhitespace(cipher.login.password) && lowerProp === 'password') {
|
16602 | cipher.login.password = value[property];
|
16603 | continue;
|
16604 | }
|
16605 | else if (this.isNullOrWhitespace(cipher.login.username) && lowerProp === 'username') {
|
16606 | cipher.login.username = value[property];
|
16607 | continue;
|
16608 | }
|
16609 | else if ((cipher.login.uris == null || cipher.login.uri.length === 0) && lowerProp === 'urls') {
|
16610 | const urls = value[property].split(this.newLineRegex);
|
16611 | cipher.login.uris = this.makeUriArray(urls);
|
16612 | continue;
|
16613 | }
|
16614 | }
|
16615 | else if (cipher.type === CipherType.Card) {
|
16616 | if (this.isNullOrWhitespace(cipher.card.number) && lowerProp === 'number') {
|
16617 | cipher.card.number = value[property];
|
16618 | cipher.card.brand = this.getCardBrand(this.getProp(value, 'number'));
|
16619 | continue;
|
16620 | }
|
16621 | else if (this.isNullOrWhitespace(cipher.card.code) && lowerProp === 'verification number') {
|
16622 | cipher.card.code = value[property];
|
16623 | continue;
|
16624 | }
|
16625 | else if (this.isNullOrWhitespace(cipher.card.cardholderName) && lowerProp === 'cardholder name') {
|
16626 | cipher.card.cardholderName = value[property];
|
16627 | continue;
|
16628 | }
|
16629 | else if (this.isNullOrWhitespace(cipher.card.expiration) && lowerProp === 'expiry date' &&
|
16630 | value[property].length === 6) {
|
16631 | cipher.card.expMonth = value[property].substr(4, 2);
|
16632 | if (cipher.card.expMonth[0] === '0') {
|
16633 | cipher.card.expMonth = cipher.card.expMonth.substr(1, 1);
|
16634 | }
|
16635 | cipher.card.expYear = value[property].substr(0, 4);
|
16636 | continue;
|
16637 | }
|
16638 | else if (lowerProp === 'type') {
|
16639 |
|
16640 | continue;
|
16641 | }
|
16642 | }
|
16643 | if (IgnoredProperties.indexOf(lowerProp) === -1 && !lowerProp.startsWith('section:') &&
|
16644 | !lowerProp.startsWith('section ')) {
|
16645 | if (altUsername == null && lowerProp === 'email') {
|
16646 | altUsername = value[property];
|
16647 | }
|
16648 | this.processKvp(cipher, property, value[property]);
|
16649 | }
|
16650 | }
|
16651 | if (cipher.type === CipherType.Login && !this.isNullOrWhitespace(altUsername) &&
|
16652 | this.isNullOrWhitespace(cipher.login.username) && altUsername.indexOf('://') === -1) {
|
16653 | cipher.login.username = altUsername;
|
16654 | }
|
16655 | this.convertToNoteIfNeeded(cipher);
|
16656 | this.cleanupCipher(cipher);
|
16657 | result.ciphers.push(cipher);
|
16658 | });
|
16659 | result.success = true;
|
16660 | return result;
|
16661 | }
|
16662 | getProp(obj, name) {
|
16663 | return obj[name] || obj[name.toUpperCase()];
|
16664 | }
|
16665 | }
|
16666 |
|
16667 |
|
16668 |
|
16669 |
|
16670 |
|
16671 | class padlockCsvImporter_PadlockCsvImporter extends baseImporter_BaseImporter {
|
16672 | parse(data) {
|
16673 | const result = new ImportResult();
|
16674 | const results = this.parseCsv(data, false);
|
16675 | if (results == null) {
|
16676 | result.success = false;
|
16677 | return result;
|
16678 | }
|
16679 | let headers = null;
|
16680 | results.forEach((value) => {
|
16681 | if (headers == null) {
|
16682 | headers = value.map((v) => v);
|
16683 | return;
|
16684 | }
|
16685 | if (value.length < 2 || value.length !== headers.length) {
|
16686 | return;
|
16687 | }
|
16688 | if (!this.isNullOrWhitespace(value[1])) {
|
16689 | if (this.organization) {
|
16690 | const tags = value[1].split(',');
|
16691 | tags.forEach((tag) => {
|
16692 | tag = tag.trim();
|
16693 | let addCollection = true;
|
16694 | let collectionIndex = result.collections.length;
|
16695 | for (let i = 0; i < result.collections.length; i++) {
|
16696 | if (result.collections[i].name === tag) {
|
16697 | addCollection = false;
|
16698 | collectionIndex = i;
|
16699 | break;
|
16700 | }
|
16701 | }
|
16702 | if (addCollection) {
|
16703 | const collection = new collectionView_CollectionView();
|
16704 | collection.name = tag;
|
16705 | result.collections.push(collection);
|
16706 | }
|
16707 | result.collectionRelationships.push([result.ciphers.length, collectionIndex]);
|
16708 | });
|
16709 | }
|
16710 | else {
|
16711 | const tags = value[1].split(',');
|
16712 | const tag = tags.length > 0 ? tags[0].trim() : null;
|
16713 | this.processFolder(result, tag);
|
16714 | }
|
16715 | }
|
16716 | const cipher = this.initLoginCipher();
|
16717 | cipher.name = this.getValueOrDefault(value[0], '--');
|
16718 | for (let i = 2; i < value.length; i++) {
|
16719 | const header = headers[i].trim().toLowerCase();
|
16720 | if (this.isNullOrWhitespace(value[i]) || this.isNullOrWhitespace(header)) {
|
16721 | continue;
|
16722 | }
|
16723 | if (this.usernameFieldNames.indexOf(header) > -1) {
|
16724 | cipher.login.username = value[i];
|
16725 | }
|
16726 | else if (this.passwordFieldNames.indexOf(header) > -1) {
|
16727 | cipher.login.password = value[i];
|
16728 | }
|
16729 | else if (this.uriFieldNames.indexOf(header) > -1) {
|
16730 | cipher.login.uris = this.makeUriArray(value[i]);
|
16731 | }
|
16732 | else {
|
16733 | this.processKvp(cipher, headers[i], value[i]);
|
16734 | }
|
16735 | }
|
16736 | this.cleanupCipher(cipher);
|
16737 | result.ciphers.push(cipher);
|
16738 | });
|
16739 | result.success = true;
|
16740 | return result;
|
16741 | }
|
16742 | }
|
16743 |
|
16744 |
|
16745 |
|
16746 |
|
16747 | class passkeepCsvImporter_PassKeepCsvImporter extends baseImporter_BaseImporter {
|
16748 | parse(data) {
|
16749 | const result = new ImportResult();
|
16750 | const results = this.parseCsv(data, true);
|
16751 | if (results == null) {
|
16752 | result.success = false;
|
16753 | return result;
|
16754 | }
|
16755 | results.forEach((value) => {
|
16756 | this.processFolder(result, this.getValue('category', value));
|
16757 | const cipher = this.initLoginCipher();
|
16758 | cipher.notes = this.getValue('description', value);
|
16759 | cipher.name = this.getValueOrDefault(this.getValue('title', value), '--');
|
16760 | cipher.login.username = this.getValue('username', value);
|
16761 | cipher.login.password = this.getValue('password', value);
|
16762 | cipher.login.uris = this.makeUriArray(this.getValue('site', value));
|
16763 | this.processKvp(cipher, 'Password 2', this.getValue('password2', value));
|
16764 | this.cleanupCipher(cipher);
|
16765 | result.ciphers.push(cipher);
|
16766 | });
|
16767 | if (this.organization) {
|
16768 | this.moveFoldersToCollections(result);
|
16769 | }
|
16770 | result.success = true;
|
16771 | return result;
|
16772 | }
|
16773 | getValue(key, value) {
|
16774 | return this.getValueOrDefault(value[key], this.getValueOrDefault(value[(' ' + key)]));
|
16775 | }
|
16776 | }
|
16777 |
|
16778 |
|
16779 |
|
16780 |
|
16781 | class passmanJsonImporter_PassmanJsonImporter extends baseImporter_BaseImporter {
|
16782 | parse(data) {
|
16783 | const result = new ImportResult();
|
16784 | const results = JSON.parse(data);
|
16785 | if (results == null || results.length === 0) {
|
16786 | result.success = false;
|
16787 | return result;
|
16788 | }
|
16789 | results.forEach((credential) => {
|
16790 | if (credential.tags != null && credential.tags.length > 0) {
|
16791 | const folderName = credential.tags[0].text;
|
16792 | this.processFolder(result, folderName);
|
16793 | }
|
16794 | const cipher = this.initLoginCipher();
|
16795 | cipher.name = credential.label;
|
16796 | cipher.login.username = this.getValueOrDefault(credential.username);
|
16797 | if (this.isNullOrWhitespace(cipher.login.username)) {
|
16798 | cipher.login.username = this.getValueOrDefault(credential.email);
|
16799 | }
|
16800 | else if (!this.isNullOrWhitespace(credential.email)) {
|
16801 | cipher.notes = ('Email: ' + credential.email + '\n');
|
16802 | }
|
16803 | cipher.login.password = this.getValueOrDefault(credential.password);
|
16804 | cipher.login.uris = this.makeUriArray(credential.url);
|
16805 | cipher.notes += this.getValueOrDefault(credential.description, '');
|
16806 | if (credential.otp != null) {
|
16807 | cipher.login.totp = this.getValueOrDefault(credential.otp.secret);
|
16808 | }
|
16809 | if (credential.custom_fields != null) {
|
16810 | credential.custom_fields.forEach((customField) => {
|
16811 | switch (customField.field_type) {
|
16812 | case 'text':
|
16813 | case 'password':
|
16814 | this.processKvp(cipher, customField.label, customField.value);
|
16815 | break;
|
16816 | }
|
16817 | });
|
16818 | }
|
16819 | this.convertToNoteIfNeeded(cipher);
|
16820 | this.cleanupCipher(cipher);
|
16821 | result.ciphers.push(cipher);
|
16822 | });
|
16823 | if (this.organization) {
|
16824 | this.moveFoldersToCollections(result);
|
16825 | }
|
16826 | result.success = true;
|
16827 | return result;
|
16828 | }
|
16829 | }
|
16830 |
|
16831 |
|
16832 |
|
16833 |
|
16834 |
|
16835 | class passpackCsvImporter_PasspackCsvImporter extends baseImporter_BaseImporter {
|
16836 | parse(data) {
|
16837 | const result = new ImportResult();
|
16838 | const results = this.parseCsv(data, true);
|
16839 | if (results == null) {
|
16840 | result.success = false;
|
16841 | return result;
|
16842 | }
|
16843 | results.forEach((value) => {
|
16844 | const tagsJson = !this.isNullOrWhitespace(value.Tags) ? JSON.parse(value.Tags) : null;
|
16845 | const tags = tagsJson != null && tagsJson.tags != null && tagsJson.tags.length > 0 ?
|
16846 | tagsJson.tags.map((tagJson) => {
|
16847 | try {
|
16848 | const t = JSON.parse(tagJson);
|
16849 | return this.getValueOrDefault(t.tag);
|
16850 | }
|
16851 | catch (_a) { }
|
16852 | return null;
|
16853 | }).filter((t) => !this.isNullOrWhitespace(t)) : null;
|
16854 | if (this.organization && tags != null && tags.length > 0) {
|
16855 | tags.forEach((tag) => {
|
16856 | let addCollection = true;
|
16857 | let collectionIndex = result.collections.length;
|
16858 | for (let i = 0; i < result.collections.length; i++) {
|
16859 | if (result.collections[i].name === tag) {
|
16860 | addCollection = false;
|
16861 | collectionIndex = i;
|
16862 | break;
|
16863 | }
|
16864 | }
|
16865 | if (addCollection) {
|
16866 | const collection = new collectionView_CollectionView();
|
16867 | collection.name = tag;
|
16868 | result.collections.push(collection);
|
16869 | }
|
16870 | result.collectionRelationships.push([result.ciphers.length, collectionIndex]);
|
16871 | });
|
16872 | }
|
16873 | else if (!this.organization && tags != null && tags.length > 0) {
|
16874 | this.processFolder(result, tags[0]);
|
16875 | }
|
16876 | const cipher = this.initLoginCipher();
|
16877 | cipher.notes = this.getValueOrDefault(value.Notes, '');
|
16878 | cipher.notes += ('\n\n' + this.getValueOrDefault(value['Shared Notes'], '') + '\n');
|
16879 | cipher.name = this.getValueOrDefault(value['Entry Name'], '--');
|
16880 | cipher.login.username = this.getValueOrDefault(value['User ID']);
|
16881 | cipher.login.password = this.getValueOrDefault(value.Password);
|
16882 | cipher.login.uris = this.makeUriArray(value.URL);
|
16883 | if (value.__parsed_extra != null && value.__parsed_extra.length > 0) {
|
16884 | value.__parsed_extra.forEach((extra) => {
|
16885 | if (!this.isNullOrWhitespace(extra)) {
|
16886 | cipher.notes += ('\n' + extra);
|
16887 | }
|
16888 | });
|
16889 | }
|
16890 | const fieldsJson = !this.isNullOrWhitespace(value['Extra Fields']) ?
|
16891 | JSON.parse(value['Extra Fields']) : null;
|
16892 | const fields = fieldsJson != null && fieldsJson.extraFields != null &&
|
16893 | fieldsJson.extraFields.length > 0 ? fieldsJson.extraFields.map((fieldJson) => {
|
16894 | try {
|
16895 | return JSON.parse(fieldJson);
|
16896 | }
|
16897 | catch (_a) { }
|
16898 | return null;
|
16899 | }) : null;
|
16900 | if (fields != null) {
|
16901 | fields.forEach((f) => {
|
16902 | if (f != null) {
|
16903 | this.processKvp(cipher, f.name, f.data);
|
16904 | }
|
16905 | });
|
16906 | }
|
16907 | this.cleanupCipher(cipher);
|
16908 | result.ciphers.push(cipher);
|
16909 | });
|
16910 | result.success = true;
|
16911 | return result;
|
16912 | }
|
16913 | }
|
16914 |
|
16915 |
|
16916 |
|
16917 |
|
16918 | class passwordAgentCsvImporter_PasswordAgentCsvImporter extends baseImporter_BaseImporter {
|
16919 | parse(data) {
|
16920 | const result = new ImportResult();
|
16921 | const results = this.parseCsv(data, false);
|
16922 | if (results == null) {
|
16923 | result.success = false;
|
16924 | return result;
|
16925 | }
|
16926 | let newVersion = true;
|
16927 | results.forEach((value) => {
|
16928 | if (value.length !== 5 && value.length < 9) {
|
16929 | return;
|
16930 | }
|
16931 | const altFormat = value.length === 10 && value[0] === '0';
|
16932 | const cipher = this.initLoginCipher();
|
16933 | cipher.name = this.getValueOrDefault(value[altFormat ? 1 : 0], '--');
|
16934 | cipher.login.username = this.getValueOrDefault(value[altFormat ? 2 : 1]);
|
16935 | cipher.login.password = this.getValueOrDefault(value[altFormat ? 3 : 2]);
|
16936 | if (value.length === 5) {
|
16937 | newVersion = false;
|
16938 | cipher.notes = this.getValueOrDefault(value[4]);
|
16939 | cipher.login.uris = this.makeUriArray(value[3]);
|
16940 | }
|
16941 | else {
|
16942 | const folder = this.getValueOrDefault(value[altFormat ? 9 : 8], '(None)');
|
16943 | let folderName = folder !== '(None)' ? folder.split('\\').join('/') : null;
|
16944 | if (folderName != null) {
|
16945 | folderName = folder.split(' > ').join('/');
|
16946 | folderName = folder.split('>').join('/');
|
16947 | }
|
16948 | this.processFolder(result, folderName);
|
16949 | cipher.notes = this.getValueOrDefault(value[altFormat ? 5 : 3]);
|
16950 | cipher.login.uris = this.makeUriArray(value[4]);
|
16951 | }
|
16952 | this.convertToNoteIfNeeded(cipher);
|
16953 | this.cleanupCipher(cipher);
|
16954 | result.ciphers.push(cipher);
|
16955 | });
|
16956 | if (newVersion && this.organization) {
|
16957 | this.moveFoldersToCollections(result);
|
16958 | }
|
16959 | result.success = true;
|
16960 | return result;
|
16961 | }
|
16962 | }
|
16963 |
|
16964 |
|
16965 |
|
16966 |
|
16967 |
|
16968 |
|
16969 |
|
16970 | class passwordBossJsonImporter_PasswordBossJsonImporter extends baseImporter_BaseImporter {
|
16971 | parse(data) {
|
16972 | const result = new ImportResult();
|
16973 | const results = JSON.parse(data);
|
16974 | if (results == null || results.items == null) {
|
16975 | result.success = false;
|
16976 | return result;
|
16977 | }
|
16978 | const foldersMap = new Map();
|
16979 | results.folders.forEach((value) => {
|
16980 | foldersMap.set(value.id, value.name);
|
16981 | });
|
16982 | const foldersIndexMap = new Map();
|
16983 | foldersMap.forEach((val, key) => {
|
16984 | foldersIndexMap.set(key, result.folders.length);
|
16985 | const f = new FolderView();
|
16986 | f.name = val;
|
16987 | result.folders.push(f);
|
16988 | });
|
16989 | results.items.forEach((value) => {
|
16990 | const cipher = this.initLoginCipher();
|
16991 | cipher.name = this.getValueOrDefault(value.name, '--');
|
16992 | cipher.login.uris = this.makeUriArray(value.login_url);
|
16993 | if (value.folder != null && foldersIndexMap.has(value.folder)) {
|
16994 | result.folderRelationships.push([result.ciphers.length, foldersIndexMap.get(value.folder)]);
|
16995 | }
|
16996 | if (value.identifiers == null) {
|
16997 | return;
|
16998 | }
|
16999 | if (!this.isNullOrWhitespace(value.identifiers.notes)) {
|
17000 | cipher.notes = value.identifiers.notes.split('\\r\\n').join('\n').split('\\n').join('\n');
|
17001 | }
|
17002 | if (value.type === 'CreditCard') {
|
17003 | cipher.card = new CardView();
|
17004 | cipher.type = CipherType.Card;
|
17005 | }
|
17006 | for (const property in value.identifiers) {
|
17007 | if (!value.identifiers.hasOwnProperty(property)) {
|
17008 | continue;
|
17009 | }
|
17010 | const valObj = value.identifiers[property];
|
17011 | const val = valObj != null ? valObj.toString() : null;
|
17012 | if (this.isNullOrWhitespace(val) || property === 'notes' || property === 'ignoreItemInSecurityScore') {
|
17013 | continue;
|
17014 | }
|
17015 | if (property === 'custom_fields') {
|
17016 | valObj.forEach((cf) => {
|
17017 | this.processKvp(cipher, cf.name, cf.value);
|
17018 | });
|
17019 | continue;
|
17020 | }
|
17021 | if (cipher.type === CipherType.Card) {
|
17022 | if (property === 'cardNumber') {
|
17023 | cipher.card.number = val;
|
17024 | cipher.card.brand = this.getCardBrand(val);
|
17025 | continue;
|
17026 | }
|
17027 | else if (property === 'nameOnCard') {
|
17028 | cipher.card.cardholderName = val;
|
17029 | continue;
|
17030 | }
|
17031 | else if (property === 'security_code') {
|
17032 | cipher.card.code = val;
|
17033 | continue;
|
17034 | }
|
17035 | else if (property === 'expires') {
|
17036 | try {
|
17037 | const expDate = new Date(val);
|
17038 | cipher.card.expYear = expDate.getFullYear().toString();
|
17039 | cipher.card.expMonth = (expDate.getMonth() + 1).toString();
|
17040 | }
|
17041 | catch (_a) { }
|
17042 | continue;
|
17043 | }
|
17044 | else if (property === 'cardType') {
|
17045 | continue;
|
17046 | }
|
17047 | }
|
17048 | else {
|
17049 | if ((property === 'username' || property === 'email') &&
|
17050 | this.isNullOrWhitespace(cipher.login.username)) {
|
17051 | cipher.login.username = val;
|
17052 | continue;
|
17053 | }
|
17054 | else if (property === 'password') {
|
17055 | cipher.login.password = val;
|
17056 | continue;
|
17057 | }
|
17058 | else if (property === 'totp') {
|
17059 | cipher.login.totp = val;
|
17060 | continue;
|
17061 | }
|
17062 | else if ((cipher.login.uris == null || cipher.login.uris.length === 0) &&
|
17063 | this.uriFieldNames.indexOf(property) > -1) {
|
17064 | cipher.login.uris = this.makeUriArray(val);
|
17065 | continue;
|
17066 | }
|
17067 | }
|
17068 | this.processKvp(cipher, property, val);
|
17069 | }
|
17070 | this.convertToNoteIfNeeded(cipher);
|
17071 | this.cleanupCipher(cipher);
|
17072 | result.ciphers.push(cipher);
|
17073 | });
|
17074 | result.success = true;
|
17075 | return result;
|
17076 | }
|
17077 | }
|
17078 |
|
17079 |
|
17080 |
|
17081 |
|
17082 | class passwordDragonXmlImporter_PasswordDragonXmlImporter extends baseImporter_BaseImporter {
|
17083 | parse(data) {
|
17084 | const result = new ImportResult();
|
17085 | const doc = this.parseXml(data);
|
17086 | if (doc == null) {
|
17087 | result.success = false;
|
17088 | return result;
|
17089 | }
|
17090 | const records = doc.querySelectorAll('PasswordManager > record');
|
17091 | Array.from(records).forEach((record) => {
|
17092 | const category = this.querySelectorDirectChild(record, 'Category');
|
17093 | const categoryText = category != null && !this.isNullOrWhitespace(category.textContent) &&
|
17094 | category.textContent !== 'Unfiled' ? category.textContent : null;
|
17095 | this.processFolder(result, categoryText);
|
17096 | const accountName = this.querySelectorDirectChild(record, 'Account-Name');
|
17097 | const userId = this.querySelectorDirectChild(record, 'User-Id');
|
17098 | const password = this.querySelectorDirectChild(record, 'Password');
|
17099 | const url = this.querySelectorDirectChild(record, 'URL');
|
17100 | const notes = this.querySelectorDirectChild(record, 'Notes');
|
17101 | const cipher = this.initLoginCipher();
|
17102 | cipher.name = accountName != null ? this.getValueOrDefault(accountName.textContent, '--') : '--';
|
17103 | cipher.notes = notes != null ? this.getValueOrDefault(notes.textContent) : '';
|
17104 | cipher.login.username = userId != null ? this.getValueOrDefault(userId.textContent) : null;
|
17105 | cipher.login.password = password != null ? this.getValueOrDefault(password.textContent) : null;
|
17106 | cipher.login.uris = url != null ? this.makeUriArray(url.textContent) : null;
|
17107 | const attributes = [];
|
17108 | for (let i = 1; i <= 10; i++) {
|
17109 | attributes.push('Attribute-' + i);
|
17110 | }
|
17111 | this.querySelectorAllDirectChild(record, attributes.join(',')).forEach((attr) => {
|
17112 | if (this.isNullOrWhitespace(attr.textContent) || attr.textContent === 'null') {
|
17113 | return;
|
17114 | }
|
17115 | this.processKvp(cipher, attr.tagName, attr.textContent);
|
17116 | });
|
17117 | this.cleanupCipher(cipher);
|
17118 | result.ciphers.push(cipher);
|
17119 | });
|
17120 | if (this.organization) {
|
17121 | this.moveFoldersToCollections(result);
|
17122 | }
|
17123 | result.success = true;
|
17124 | return result;
|
17125 | }
|
17126 | }
|
17127 |
|
17128 |
|
17129 |
|
17130 |
|
17131 | class passwordSafeXmlImporter_PasswordSafeXmlImporter extends baseImporter_BaseImporter {
|
17132 | parse(data) {
|
17133 | const result = new ImportResult();
|
17134 | const doc = this.parseXml(data);
|
17135 | if (doc == null) {
|
17136 | result.success = false;
|
17137 | return result;
|
17138 | }
|
17139 | const passwordSafe = doc.querySelector('passwordsafe');
|
17140 | if (passwordSafe == null) {
|
17141 | result.errorMessage = 'Missing `passwordsafe` node.';
|
17142 | result.success = false;
|
17143 | return result;
|
17144 | }
|
17145 | const notesDelimiter = passwordSafe.getAttribute('delimiter');
|
17146 | const entries = doc.querySelectorAll('passwordsafe > entry');
|
17147 | Array.from(entries).forEach((entry) => {
|
17148 | const group = this.querySelectorDirectChild(entry, 'group');
|
17149 | const groupText = group != null && !this.isNullOrWhitespace(group.textContent) ?
|
17150 | group.textContent.split('.').join('/') : null;
|
17151 | this.processFolder(result, groupText);
|
17152 | const title = this.querySelectorDirectChild(entry, 'title');
|
17153 | const username = this.querySelectorDirectChild(entry, 'username');
|
17154 | const email = this.querySelectorDirectChild(entry, 'email');
|
17155 | const password = this.querySelectorDirectChild(entry, 'password');
|
17156 | const url = this.querySelectorDirectChild(entry, 'url');
|
17157 | const notes = this.querySelectorDirectChild(entry, 'notes');
|
17158 | const cipher = this.initLoginCipher();
|
17159 | cipher.name = title != null ? this.getValueOrDefault(title.textContent, '--') : '--';
|
17160 | cipher.notes = notes != null ?
|
17161 | this.getValueOrDefault(notes.textContent, '').split(notesDelimiter).join('\n') : null;
|
17162 | cipher.login.username = username != null ? this.getValueOrDefault(username.textContent) : null;
|
17163 | cipher.login.password = password != null ? this.getValueOrDefault(password.textContent) : null;
|
17164 | cipher.login.uris = url != null ? this.makeUriArray(url.textContent) : null;
|
17165 | if (this.isNullOrWhitespace(cipher.login.username) && email != null) {
|
17166 | cipher.login.username = this.getValueOrDefault(email.textContent);
|
17167 | }
|
17168 | else if (email != null && !this.isNullOrWhitespace(email.textContent)) {
|
17169 | cipher.notes = this.isNullOrWhitespace(cipher.notes) ? 'Email: ' + email.textContent
|
17170 | : (cipher.notes + '\n' + 'Email: ' + email.textContent);
|
17171 | }
|
17172 | this.cleanupCipher(cipher);
|
17173 | result.ciphers.push(cipher);
|
17174 | });
|
17175 | if (this.organization) {
|
17176 | this.moveFoldersToCollections(result);
|
17177 | }
|
17178 | result.success = true;
|
17179 | return result;
|
17180 | }
|
17181 | }
|
17182 |
|
17183 |
|
17184 |
|
17185 |
|
17186 | class passwordWalletTxtImporter_PasswordWalletTxtImporter extends baseImporter_BaseImporter {
|
17187 | parse(data) {
|
17188 | const result = new ImportResult();
|
17189 | const results = this.parseCsv(data, false);
|
17190 | if (results == null) {
|
17191 | result.success = false;
|
17192 | return result;
|
17193 | }
|
17194 | results.forEach((value) => {
|
17195 | if (value.length < 1) {
|
17196 | return;
|
17197 | }
|
17198 | if (value.length > 5) {
|
17199 | this.processFolder(result, value[5]);
|
17200 | }
|
17201 | const cipher = this.initLoginCipher();
|
17202 | cipher.name = this.getValueOrDefault(value[0], '--');
|
17203 | if (value.length > 4) {
|
17204 | cipher.notes = this.getValueOrDefault(value[4], '').split('¬').join('\n');
|
17205 | }
|
17206 | if (value.length > 2) {
|
17207 | cipher.login.username = this.getValueOrDefault(value[2]);
|
17208 | }
|
17209 | if (value.length > 3) {
|
17210 | cipher.login.password = this.getValueOrDefault(value[3]);
|
17211 | }
|
17212 | if (value.length > 1) {
|
17213 | cipher.login.uris = this.makeUriArray(value[1]);
|
17214 | }
|
17215 | this.cleanupCipher(cipher);
|
17216 | result.ciphers.push(cipher);
|
17217 | });
|
17218 | if (this.organization) {
|
17219 | this.moveFoldersToCollections(result);
|
17220 | }
|
17221 | result.success = true;
|
17222 | return result;
|
17223 | }
|
17224 | }
|
17225 |
|
17226 |
|
17227 |
|
17228 |
|
17229 |
|
17230 |
|
17231 | class rememBearCsvImporter_RememBearCsvImporter extends baseImporter_BaseImporter {
|
17232 | parse(data) {
|
17233 | const result = new ImportResult();
|
17234 | const results = this.parseCsv(data, true);
|
17235 | if (results == null) {
|
17236 | result.success = false;
|
17237 | return result;
|
17238 | }
|
17239 | results.forEach((value) => {
|
17240 | if (value.trash === 'true') {
|
17241 | return;
|
17242 | }
|
17243 | const cipher = this.initLoginCipher();
|
17244 | cipher.name = this.getValueOrDefault(value.name);
|
17245 | cipher.notes = this.getValueOrDefault(value.notes);
|
17246 | if (value.type === 'LoginItem') {
|
17247 | cipher.login.uris = this.makeUriArray(value.website);
|
17248 | cipher.login.password = this.getValueOrDefault(value.password);
|
17249 | cipher.login.username = this.getValueOrDefault(value.username);
|
17250 | }
|
17251 | else if (value.type === 'CreditCardItem') {
|
17252 | cipher.type = CipherType.Card;
|
17253 | cipher.card = new CardView();
|
17254 | cipher.card.cardholderName = this.getValueOrDefault(value.cardholder);
|
17255 | cipher.card.number = this.getValueOrDefault(value.number);
|
17256 | cipher.card.brand = this.getCardBrand(cipher.card.number);
|
17257 | cipher.card.code = this.getValueOrDefault(value.verification);
|
17258 | try {
|
17259 | const expMonth = this.getValueOrDefault(value.expiryMonth);
|
17260 | if (expMonth != null) {
|
17261 | const expMonthNumber = parseInt(expMonth, null);
|
17262 | if (expMonthNumber != null && expMonthNumber >= 1 && expMonthNumber <= 12) {
|
17263 | cipher.card.expMonth = expMonthNumber.toString();
|
17264 | }
|
17265 | }
|
17266 | }
|
17267 | catch (_a) { }
|
17268 | try {
|
17269 | const expYear = this.getValueOrDefault(value.expiryYear);
|
17270 | if (expYear != null) {
|
17271 | const expYearNumber = parseInt(expYear, null);
|
17272 | if (expYearNumber != null) {
|
17273 | cipher.card.expYear = expYearNumber.toString();
|
17274 | }
|
17275 | }
|
17276 | }
|
17277 | catch (_b) { }
|
17278 | const pin = this.getValueOrDefault(value.pin);
|
17279 | if (pin != null) {
|
17280 | this.processKvp(cipher, 'PIN', pin);
|
17281 | }
|
17282 | const zip = this.getValueOrDefault(value.zipCode);
|
17283 | if (zip != null) {
|
17284 | this.processKvp(cipher, 'Zip Code', zip);
|
17285 | }
|
17286 | }
|
17287 | this.cleanupCipher(cipher);
|
17288 | result.ciphers.push(cipher);
|
17289 | });
|
17290 | result.success = true;
|
17291 | return result;
|
17292 | }
|
17293 | }
|
17294 |
|
17295 |
|
17296 |
|
17297 |
|
17298 | class roboformCsvImporter_RoboFormCsvImporter extends baseImporter_BaseImporter {
|
17299 | parse(data) {
|
17300 | const result = new ImportResult();
|
17301 | const results = this.parseCsv(data, true);
|
17302 | if (results == null) {
|
17303 | result.success = false;
|
17304 | return result;
|
17305 | }
|
17306 | let i = 1;
|
17307 | results.forEach((value) => {
|
17308 | const folder = !this.isNullOrWhitespace(value.Folder) && value.Folder.startsWith('/') ?
|
17309 | value.Folder.replace('/', '') : value.Folder;
|
17310 | const folderName = !this.isNullOrWhitespace(folder) ? folder : null;
|
17311 | this.processFolder(result, folderName);
|
17312 | const cipher = this.initLoginCipher();
|
17313 | cipher.notes = this.getValueOrDefault(value.Note);
|
17314 | cipher.name = this.getValueOrDefault(value.Name, '--');
|
17315 | cipher.login.username = this.getValueOrDefault(value.Login);
|
17316 | cipher.login.password = this.getValueOrDefault(value.Pwd);
|
17317 | cipher.login.uris = this.makeUriArray(value.Url);
|
17318 | if (!this.isNullOrWhitespace(value.Rf_fields)) {
|
17319 | let fields = [value.Rf_fields];
|
17320 | if (value.__parsed_extra != null && value.__parsed_extra.length > 0) {
|
17321 | fields = fields.concat(value.__parsed_extra);
|
17322 | }
|
17323 | fields.forEach((field) => {
|
17324 | const parts = field.split(':');
|
17325 | if (parts.length < 3) {
|
17326 | return;
|
17327 | }
|
17328 | const key = parts[0] === '-no-name-' ? null : parts[0];
|
17329 | const val = parts.length === 4 && parts[2] === 'rck' ? parts[1] : parts[2];
|
17330 | this.processKvp(cipher, key, val);
|
17331 | });
|
17332 | }
|
17333 | this.convertToNoteIfNeeded(cipher);
|
17334 | this.cleanupCipher(cipher);
|
17335 | if (i === results.length && cipher.name === '--' && this.isNullOrWhitespace(cipher.login.password)) {
|
17336 | return;
|
17337 | }
|
17338 | result.ciphers.push(cipher);
|
17339 | i++;
|
17340 | });
|
17341 | if (this.organization) {
|
17342 | this.moveFoldersToCollections(result);
|
17343 | }
|
17344 | result.success = true;
|
17345 | return result;
|
17346 | }
|
17347 | }
|
17348 |
|
17349 |
|
17350 |
|
17351 |
|
17352 |
|
17353 |
|
17354 |
|
17355 |
|
17356 | class safeInCloudXmlImporter_SafeInCloudXmlImporter extends baseImporter_BaseImporter {
|
17357 | parse(data) {
|
17358 | const result = new ImportResult();
|
17359 | const doc = this.parseXml(data);
|
17360 | if (doc == null) {
|
17361 | result.success = false;
|
17362 | return result;
|
17363 | }
|
17364 | const db = doc.querySelector('database');
|
17365 | if (db == null) {
|
17366 | result.errorMessage = 'Missing `database` node.';
|
17367 | result.success = false;
|
17368 | return result;
|
17369 | }
|
17370 | const foldersMap = new Map();
|
17371 | Array.from(doc.querySelectorAll('database > label')).forEach((labelEl) => {
|
17372 | const name = labelEl.getAttribute('name');
|
17373 | const id = labelEl.getAttribute('id');
|
17374 | if (!this.isNullOrWhitespace(name) && !this.isNullOrWhitespace(id)) {
|
17375 | foldersMap.set(id, result.folders.length);
|
17376 | const folder = new FolderView();
|
17377 | folder.name = name;
|
17378 | result.folders.push(folder);
|
17379 | }
|
17380 | });
|
17381 | Array.from(doc.querySelectorAll('database > card')).forEach((cardEl) => {
|
17382 | if (cardEl.getAttribute('template') === 'true') {
|
17383 | return;
|
17384 | }
|
17385 | const labelIdEl = this.querySelectorDirectChild(cardEl, 'label_id');
|
17386 | if (labelIdEl != null) {
|
17387 | const labelId = labelIdEl.textContent;
|
17388 | if (!this.isNullOrWhitespace(labelId) && foldersMap.has(labelId)) {
|
17389 | result.folderRelationships.push([result.ciphers.length, foldersMap.get(labelId)]);
|
17390 | }
|
17391 | }
|
17392 | const cipher = this.initLoginCipher();
|
17393 | cipher.name = this.getValueOrDefault(cardEl.getAttribute('title'), '--');
|
17394 | const cardType = cardEl.getAttribute('type');
|
17395 | if (cardType === 'note') {
|
17396 | cipher.type = CipherType.SecureNote;
|
17397 | cipher.secureNote = new SecureNoteView();
|
17398 | cipher.secureNote.type = SecureNoteType.Generic;
|
17399 | }
|
17400 | else {
|
17401 | Array.from(this.querySelectorAllDirectChild(cardEl, 'field')).forEach((fieldEl) => {
|
17402 | const text = fieldEl.textContent;
|
17403 | if (this.isNullOrWhitespace(text)) {
|
17404 | return;
|
17405 | }
|
17406 | const name = fieldEl.getAttribute('name');
|
17407 | const fieldType = this.getValueOrDefault(fieldEl.getAttribute('type'), '').toLowerCase();
|
17408 | if (fieldType === 'login') {
|
17409 | cipher.login.username = text;
|
17410 | }
|
17411 | else if (fieldType === 'password') {
|
17412 | cipher.login.password = text;
|
17413 | }
|
17414 | else if (fieldType === 'one_time_password') {
|
17415 | cipher.login.totp = text;
|
17416 | }
|
17417 | else if (fieldType === 'notes') {
|
17418 | cipher.notes += (text + '\n');
|
17419 | }
|
17420 | else if (fieldType === 'weblogin' || fieldType === 'website') {
|
17421 | cipher.login.uris = this.makeUriArray(text);
|
17422 | }
|
17423 | else {
|
17424 | this.processKvp(cipher, name, text);
|
17425 | }
|
17426 | });
|
17427 | }
|
17428 | Array.from(this.querySelectorAllDirectChild(cardEl, 'notes')).forEach((notesEl) => {
|
17429 | cipher.notes += (notesEl.textContent + '\n');
|
17430 | });
|
17431 | this.cleanupCipher(cipher);
|
17432 | result.ciphers.push(cipher);
|
17433 | });
|
17434 | if (this.organization) {
|
17435 | this.moveFoldersToCollections(result);
|
17436 | }
|
17437 | result.success = true;
|
17438 | return result;
|
17439 | }
|
17440 | }
|
17441 |
|
17442 |
|
17443 |
|
17444 |
|
17445 | class saferpassCsvImport_SaferPassCsvImporter extends baseImporter_BaseImporter {
|
17446 | parse(data) {
|
17447 | const result = new ImportResult();
|
17448 | const results = this.parseCsv(data, true);
|
17449 | if (results == null) {
|
17450 | result.success = false;
|
17451 | return result;
|
17452 | }
|
17453 | results.forEach((value) => {
|
17454 | const cipher = this.initLoginCipher();
|
17455 | cipher.name = this.getValueOrDefault(this.nameFromUrl(value.url), '--');
|
17456 | cipher.notes = this.getValueOrDefault(value.notes);
|
17457 | cipher.login.username = this.getValueOrDefault(value.username);
|
17458 | cipher.login.password = this.getValueOrDefault(value.password);
|
17459 | cipher.login.uris = this.makeUriArray(value.url);
|
17460 | this.cleanupCipher(cipher);
|
17461 | result.ciphers.push(cipher);
|
17462 | });
|
17463 | result.success = true;
|
17464 | return result;
|
17465 | }
|
17466 | }
|
17467 |
|
17468 |
|
17469 |
|
17470 |
|
17471 | class secureSafeCsvImporter_SecureSafeCsvImporter extends baseImporter_BaseImporter {
|
17472 | parse(data) {
|
17473 | const result = new ImportResult();
|
17474 | const results = this.parseCsv(data, true);
|
17475 | if (results == null) {
|
17476 | result.success = false;
|
17477 | return result;
|
17478 | }
|
17479 | results.forEach((value) => {
|
17480 | const cipher = this.initLoginCipher();
|
17481 | cipher.name = this.getValueOrDefault(value.Title);
|
17482 | cipher.notes = this.getValueOrDefault(value.Comment);
|
17483 | cipher.login.uris = this.makeUriArray(value.Url);
|
17484 | cipher.login.password = this.getValueOrDefault(value.Password);
|
17485 | cipher.login.username = this.getValueOrDefault(value.Username);
|
17486 | this.cleanupCipher(cipher);
|
17487 | result.ciphers.push(cipher);
|
17488 | });
|
17489 | result.success = true;
|
17490 | return result;
|
17491 | }
|
17492 | }
|
17493 |
|
17494 |
|
17495 |
|
17496 |
|
17497 | class splashIdCsvImporter_SplashIdCsvImporter extends baseImporter_BaseImporter {
|
17498 | parse(data) {
|
17499 | const result = new ImportResult();
|
17500 | const results = this.parseCsv(data, false);
|
17501 | if (results == null) {
|
17502 | result.success = false;
|
17503 | return result;
|
17504 | }
|
17505 | results.forEach((value) => {
|
17506 | if (value.length < 3) {
|
17507 | return;
|
17508 | }
|
17509 | this.processFolder(result, this.getValueOrDefault(value[value.length - 1]));
|
17510 | const cipher = this.initLoginCipher();
|
17511 | cipher.notes = this.getValueOrDefault(value[value.length - 2], '');
|
17512 | cipher.name = this.getValueOrDefault(value[1], '--');
|
17513 | if (value[0] === 'Web Logins' || value[0] === 'Servers' || value[0] === 'Email Accounts') {
|
17514 | cipher.login.username = this.getValueOrDefault(value[2]);
|
17515 | cipher.login.password = this.getValueOrDefault(value[3]);
|
17516 | cipher.login.uris = this.makeUriArray(value[4]);
|
17517 | this.parseFieldsToNotes(cipher, 5, value);
|
17518 | }
|
17519 | else {
|
17520 | this.parseFieldsToNotes(cipher, 2, value);
|
17521 | }
|
17522 | this.convertToNoteIfNeeded(cipher);
|
17523 | this.cleanupCipher(cipher);
|
17524 | result.ciphers.push(cipher);
|
17525 | });
|
17526 | if (this.organization) {
|
17527 | this.moveFoldersToCollections(result);
|
17528 | }
|
17529 | result.success = true;
|
17530 | return result;
|
17531 | }
|
17532 | parseFieldsToNotes(cipher, startIndex, value) {
|
17533 |
|
17534 | for (let i = startIndex; i < value.length - 3; i++) {
|
17535 | if (this.isNullOrWhitespace(value[i])) {
|
17536 | continue;
|
17537 | }
|
17538 | cipher.notes += (value[i] + '\n');
|
17539 | }
|
17540 | }
|
17541 | }
|
17542 |
|
17543 |
|
17544 |
|
17545 |
|
17546 | class stickyPasswordXmlImporter_StickyPasswordXmlImporter extends baseImporter_BaseImporter {
|
17547 | parse(data) {
|
17548 | const result = new ImportResult();
|
17549 | const doc = this.parseXml(data);
|
17550 | if (doc == null) {
|
17551 | result.success = false;
|
17552 | return result;
|
17553 | }
|
17554 | const loginNodes = doc.querySelectorAll('root > Database > Logins > Login');
|
17555 | Array.from(loginNodes).forEach((loginNode) => {
|
17556 | const accountId = loginNode.getAttribute('ID');
|
17557 | if (this.isNullOrWhitespace(accountId)) {
|
17558 | return;
|
17559 | }
|
17560 | const usernameText = loginNode.getAttribute('Name');
|
17561 | const passwordText = loginNode.getAttribute('Password');
|
17562 | let titleText = null;
|
17563 | let linkText = null;
|
17564 | let notesText = null;
|
17565 | let groupId = null;
|
17566 | let groupText = null;
|
17567 | const accountLogin = doc.querySelector('root > Database > Accounts > Account > ' +
|
17568 | 'LoginLinks > Login[SourceLoginID="' + accountId + '"]');
|
17569 | if (accountLogin != null) {
|
17570 | const account = accountLogin.parentElement.parentElement;
|
17571 | if (account != null) {
|
17572 | titleText = account.getAttribute('Name');
|
17573 | linkText = account.getAttribute('Link');
|
17574 | groupId = account.getAttribute('ParentID');
|
17575 | notesText = account.getAttribute('Comments');
|
17576 | if (!this.isNullOrWhitespace(notesText)) {
|
17577 | notesText = notesText.split('/n').join('\n');
|
17578 | }
|
17579 | }
|
17580 | }
|
17581 | if (!this.isNullOrWhitespace(groupId)) {
|
17582 | groupText = this.buildGroupText(doc, groupId, '');
|
17583 | this.processFolder(result, groupText);
|
17584 | }
|
17585 | const cipher = this.initLoginCipher();
|
17586 | cipher.name = this.getValueOrDefault(titleText, '--');
|
17587 | cipher.notes = this.getValueOrDefault(notesText);
|
17588 | cipher.login.username = this.getValueOrDefault(usernameText);
|
17589 | cipher.login.password = this.getValueOrDefault(passwordText);
|
17590 | cipher.login.uris = this.makeUriArray(linkText);
|
17591 | this.cleanupCipher(cipher);
|
17592 | result.ciphers.push(cipher);
|
17593 | });
|
17594 | if (this.organization) {
|
17595 | this.moveFoldersToCollections(result);
|
17596 | }
|
17597 | result.success = true;
|
17598 | return result;
|
17599 | }
|
17600 | buildGroupText(doc, groupId, groupText) {
|
17601 | const group = doc.querySelector('root > Database > Groups > Group[ID="' + groupId + '"]');
|
17602 | if (group == null) {
|
17603 | return groupText;
|
17604 | }
|
17605 | if (!this.isNullOrWhitespace(groupText)) {
|
17606 | groupText = '/' + groupText;
|
17607 | }
|
17608 | groupText = group.getAttribute('Name') + groupText;
|
17609 | return this.buildGroupText(doc, group.getAttribute('ParentID'), groupText);
|
17610 | }
|
17611 | }
|
17612 |
|
17613 |
|
17614 |
|
17615 |
|
17616 |
|
17617 |
|
17618 |
|
17619 |
|
17620 | const PropertiesToIgnore = ['kind', 'autologin', 'favorite', 'hexcolor', 'protectedwithpassword', 'subdomainonly',
|
17621 | 'type', 'tk_export_version', 'note', 'title', 'document_content',
|
17622 | ];
|
17623 | class truekeyCsvImporter_TrueKeyCsvImporter extends baseImporter_BaseImporter {
|
17624 | parse(data) {
|
17625 | const result = new ImportResult();
|
17626 | const results = this.parseCsv(data, true);
|
17627 | if (results == null) {
|
17628 | result.success = false;
|
17629 | return result;
|
17630 | }
|
17631 | results.forEach((value) => {
|
17632 | const cipher = this.initLoginCipher();
|
17633 | cipher.favorite = this.getValueOrDefault(value.favorite, '').toLowerCase() === 'true';
|
17634 | cipher.name = this.getValueOrDefault(value.name, '--');
|
17635 | cipher.notes = this.getValueOrDefault(value.memo, '');
|
17636 | cipher.login.username = this.getValueOrDefault(value.login);
|
17637 | cipher.login.password = this.getValueOrDefault(value.password);
|
17638 | cipher.login.uris = this.makeUriArray(value.url);
|
17639 | if (value.kind !== 'login') {
|
17640 | cipher.name = this.getValueOrDefault(value.title, '--');
|
17641 | cipher.notes = this.getValueOrDefault(value.note, '');
|
17642 | }
|
17643 | if (value.kind === 'cc') {
|
17644 | cipher.type = CipherType.Card;
|
17645 | cipher.card = new CardView();
|
17646 | cipher.card.cardholderName = this.getValueOrDefault(value.cardholder);
|
17647 | cipher.card.number = this.getValueOrDefault(value.number);
|
17648 | cipher.card.brand = this.getCardBrand(cipher.card.number);
|
17649 | if (!this.isNullOrWhitespace(value.expiryDate)) {
|
17650 | try {
|
17651 | const expDate = new Date(value.expiryDate);
|
17652 | cipher.card.expYear = expDate.getFullYear().toString();
|
17653 | cipher.card.expMonth = (expDate.getMonth() + 1).toString();
|
17654 | }
|
17655 | catch (_a) { }
|
17656 | }
|
17657 | }
|
17658 | else if (value.kind !== 'login') {
|
17659 | cipher.type = CipherType.SecureNote;
|
17660 | cipher.secureNote = new SecureNoteView();
|
17661 | cipher.secureNote.type = SecureNoteType.Generic;
|
17662 | if (!this.isNullOrWhitespace(cipher.notes)) {
|
17663 | cipher.notes = this.getValueOrDefault(value.document_content, '');
|
17664 | }
|
17665 | for (const property in value) {
|
17666 | if (value.hasOwnProperty(property) && PropertiesToIgnore.indexOf(property.toLowerCase()) < 0 &&
|
17667 | !this.isNullOrWhitespace(value[property])) {
|
17668 | this.processKvp(cipher, property, value[property]);
|
17669 | }
|
17670 | }
|
17671 | }
|
17672 | this.cleanupCipher(cipher);
|
17673 | result.ciphers.push(cipher);
|
17674 | });
|
17675 | result.success = true;
|
17676 | return result;
|
17677 | }
|
17678 | }
|
17679 |
|
17680 |
|
17681 |
|
17682 |
|
17683 | class upmCsvImporter_UpmCsvImporter extends baseImporter_BaseImporter {
|
17684 | parse(data) {
|
17685 | const result = new ImportResult();
|
17686 | const results = this.parseCsv(data, false);
|
17687 | if (results == null) {
|
17688 | result.success = false;
|
17689 | return result;
|
17690 | }
|
17691 | results.forEach((value) => {
|
17692 | if (value.length !== 5) {
|
17693 | return;
|
17694 | }
|
17695 | const cipher = this.initLoginCipher();
|
17696 | cipher.name = this.getValueOrDefault(value[0], '--');
|
17697 | cipher.notes = this.getValueOrDefault(value[4]);
|
17698 | cipher.login.username = this.getValueOrDefault(value[1]);
|
17699 | cipher.login.password = this.getValueOrDefault(value[2]);
|
17700 | cipher.login.uris = this.makeUriArray(value[3]);
|
17701 | this.cleanupCipher(cipher);
|
17702 | result.ciphers.push(cipher);
|
17703 | });
|
17704 | result.success = true;
|
17705 | return result;
|
17706 | }
|
17707 | }
|
17708 |
|
17709 |
|
17710 |
|
17711 |
|
17712 | class zohoVaultCsvImporter_ZohoVaultCsvImporter extends baseImporter_BaseImporter {
|
17713 | parse(data) {
|
17714 | const result = new ImportResult();
|
17715 | const results = this.parseCsv(data, true);
|
17716 | if (results == null) {
|
17717 | result.success = false;
|
17718 | return result;
|
17719 | }
|
17720 | results.forEach((value) => {
|
17721 | if (this.isNullOrWhitespace(value['Password Name']) && this.isNullOrWhitespace(value['Secret Name'])) {
|
17722 | return;
|
17723 | }
|
17724 | this.processFolder(result, this.getValueOrDefault(value.ChamberName));
|
17725 | const cipher = this.initLoginCipher();
|
17726 | cipher.favorite = this.getValueOrDefault(value.Favorite, '0') === '1';
|
17727 | cipher.notes = this.getValueOrDefault(value.Notes);
|
17728 | cipher.name = this.getValueOrDefault(value['Password Name'], this.getValueOrDefault(value['Secret Name'], '--'));
|
17729 | cipher.login.uris = this.makeUriArray(this.getValueOrDefault(value['Password URL'], this.getValueOrDefault(value['Secret URL'])));
|
17730 | this.parseData(cipher, value.SecretData);
|
17731 | this.parseData(cipher, value.CustomData);
|
17732 | this.convertToNoteIfNeeded(cipher);
|
17733 | this.cleanupCipher(cipher);
|
17734 | result.ciphers.push(cipher);
|
17735 | });
|
17736 | if (this.organization) {
|
17737 | this.moveFoldersToCollections(result);
|
17738 | }
|
17739 | result.success = true;
|
17740 | return result;
|
17741 | }
|
17742 | parseData(cipher, data) {
|
17743 | if (this.isNullOrWhitespace(data)) {
|
17744 | return;
|
17745 | }
|
17746 | const dataLines = this.splitNewLine(data);
|
17747 | dataLines.forEach((line) => {
|
17748 | const delimPosition = line.indexOf(':');
|
17749 | if (delimPosition < 0) {
|
17750 | return;
|
17751 | }
|
17752 | const field = line.substring(0, delimPosition);
|
17753 | const value = line.length > delimPosition ? line.substring(delimPosition + 1) : null;
|
17754 | if (this.isNullOrWhitespace(field) || this.isNullOrWhitespace(value) || field === 'SecretType') {
|
17755 | return;
|
17756 | }
|
17757 | const fieldLower = field.toLowerCase();
|
17758 | if (cipher.login.username == null && this.usernameFieldNames.indexOf(fieldLower) > -1) {
|
17759 | cipher.login.username = value;
|
17760 | }
|
17761 | else if (cipher.login.password == null && this.passwordFieldNames.indexOf(fieldLower) > -1) {
|
17762 | cipher.login.password = value;
|
17763 | }
|
17764 | else {
|
17765 | this.processKvp(cipher, field, value);
|
17766 | }
|
17767 | });
|
17768 | }
|
17769 | }
|
17770 |
|
17771 |
|
17772 | var import_service_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
17773 | return new (P || (P = Promise))(function (resolve, reject) {
|
17774 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
17775 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
17776 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
17777 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
17778 | });
|
17779 | };
|
17780 |
|
17781 |
|
17782 |
|
17783 |
|
17784 |
|
17785 |
|
17786 |
|
17787 |
|
17788 |
|
17789 |
|
17790 |
|
17791 |
|
17792 |
|
17793 |
|
17794 |
|
17795 |
|
17796 |
|
17797 |
|
17798 |
|
17799 |
|
17800 |
|
17801 |
|
17802 |
|
17803 |
|
17804 |
|
17805 |
|
17806 |
|
17807 |
|
17808 |
|
17809 |
|
17810 |
|
17811 |
|
17812 |
|
17813 |
|
17814 |
|
17815 |
|
17816 |
|
17817 |
|
17818 |
|
17819 |
|
17820 |
|
17821 |
|
17822 |
|
17823 |
|
17824 |
|
17825 |
|
17826 |
|
17827 |
|
17828 |
|
17829 |
|
17830 |
|
17831 |
|
17832 |
|
17833 |
|
17834 |
|
17835 |
|
17836 |
|
17837 | class import_service_ImportService {
|
17838 | constructor(cipherService, folderService, apiService, i18nService, collectionService) {
|
17839 | this.cipherService = cipherService;
|
17840 | this.folderService = folderService;
|
17841 | this.apiService = apiService;
|
17842 | this.i18nService = i18nService;
|
17843 | this.collectionService = collectionService;
|
17844 | this.featuredImportOptions = [
|
17845 | { id: 'bitwardenjson', name: 'Bitwarden (json)' },
|
17846 | { id: 'bitwardencsv', name: 'Bitwarden (csv)' },
|
17847 | { id: 'lastpasscsv', name: 'LastPass (csv)' },
|
17848 | { id: 'chromecsv', name: 'Chrome (csv)' },
|
17849 | { id: 'firefoxcsv', name: 'Firefox (csv)' },
|
17850 | { id: 'keepass2xml', name: 'KeePass 2 (xml)' },
|
17851 | { id: '1password1pif', name: '1Password (1pif)' },
|
17852 | { id: 'dashlanejson', name: 'Dashlane (json)' },
|
17853 | ];
|
17854 | this.regularImportOptions = [
|
17855 | { id: 'keepassxcsv', name: 'KeePassX (csv)' },
|
17856 | { id: '1passwordwincsv', name: '1Password 6 and 7 Windows (csv)' },
|
17857 | { id: 'roboformcsv', name: 'RoboForm (csv)' },
|
17858 | { id: 'keepercsv', name: 'Keeper (csv)' },
|
17859 | { id: 'enpasscsv', name: 'Enpass (csv)' },
|
17860 | { id: 'enpassjson', name: 'Enpass (json)' },
|
17861 | { id: 'safeincloudxml', name: 'SafeInCloud (xml)' },
|
17862 | { id: 'pwsafexml', name: 'Password Safe (xml)' },
|
17863 | { id: 'stickypasswordxml', name: 'Sticky Password (xml)' },
|
17864 | { id: 'msecurecsv', name: 'mSecure (csv)' },
|
17865 | { id: 'truekeycsv', name: 'True Key (csv)' },
|
17866 | { id: 'passwordbossjson', name: 'Password Boss (json)' },
|
17867 | { id: 'zohovaultcsv', name: 'Zoho Vault (csv)' },
|
17868 | { id: 'splashidcsv', name: 'SplashID (csv)' },
|
17869 | { id: 'passworddragonxml', name: 'Password Dragon (xml)' },
|
17870 | { id: 'padlockcsv', name: 'Padlock (csv)' },
|
17871 | { id: 'passboltcsv', name: 'Passbolt (csv)' },
|
17872 | { id: 'clipperzhtml', name: 'Clipperz (html)' },
|
17873 | { id: 'aviracsv', name: 'Avira (csv)' },
|
17874 | { id: 'saferpasscsv', name: 'SaferPass (csv)' },
|
17875 | { id: 'upmcsv', name: 'Universal Password Manager (csv)' },
|
17876 | { id: 'ascendocsv', name: 'Ascendo DataVault (csv)' },
|
17877 | { id: 'meldiumcsv', name: 'Meldium (csv)' },
|
17878 | { id: 'passkeepcsv', name: 'PassKeep (csv)' },
|
17879 | { id: 'operacsv', name: 'Opera (csv)' },
|
17880 | { id: 'vivaldicsv', name: 'Vivaldi (csv)' },
|
17881 | { id: 'gnomejson', name: 'GNOME Passwords and Keys/Seahorse (json)' },
|
17882 | { id: 'blurcsv', name: 'Blur (csv)' },
|
17883 | { id: 'passwordagentcsv', name: 'Password Agent (csv)' },
|
17884 | { id: 'passpackcsv', name: 'Passpack (csv)' },
|
17885 | { id: 'passmanjson', name: 'Passman (json)' },
|
17886 | { id: 'avastcsv', name: 'Avast Passwords (csv)' },
|
17887 | { id: 'avastjson', name: 'Avast Passwords (json)' },
|
17888 | { id: 'fsecurefsk', name: 'F-Secure KEY (fsk)' },
|
17889 | { id: 'kasperskytxt', name: 'Kaspersky Password Manager (txt)' },
|
17890 | { id: 'remembearcsv', name: 'RememBear (csv)' },
|
17891 | { id: 'passwordwallettxt', name: 'PasswordWallet (txt)' },
|
17892 | { id: 'mykicsv', name: 'Myki (csv)' },
|
17893 | { id: 'securesafecsv', name: 'SecureSafe (csv)' },
|
17894 | { id: 'logmeoncecsv', name: 'LogMeOnce (csv)' },
|
17895 | { id: 'blackberrycsv', name: 'BlackBerry Password Keeper (csv)' },
|
17896 | { id: 'buttercupcsv', name: 'Buttercup (csv)' },
|
17897 | { id: 'codebookcsv', name: 'Codebook (csv)' },
|
17898 | { id: 'encryptrcsv', name: 'Encryptr (csv)' },
|
17899 | ];
|
17900 | }
|
17901 | getImportOptions() {
|
17902 | return this.featuredImportOptions.concat(this.regularImportOptions);
|
17903 | }
|
17904 | import(importer, fileContents, organizationId = null) {
|
17905 | return import_service_awaiter(this, void 0, void 0, function* () {
|
17906 | const importResult = yield importer.parse(fileContents);
|
17907 | if (importResult.success) {
|
17908 | if (importResult.folders.length === 0 && importResult.ciphers.length === 0) {
|
17909 | return new Error(this.i18nService.t('importNothingError'));
|
17910 | }
|
17911 | else if (importResult.ciphers.length > 0) {
|
17912 | const halfway = Math.floor(importResult.ciphers.length / 2);
|
17913 | const last = importResult.ciphers.length - 1;
|
17914 | if (this.badData(importResult.ciphers[0]) &&
|
17915 | this.badData(importResult.ciphers[halfway]) &&
|
17916 | this.badData(importResult.ciphers[last])) {
|
17917 | return new Error(this.i18nService.t('importFormatError'));
|
17918 | }
|
17919 | }
|
17920 | yield this.postImport(importResult, organizationId);
|
17921 | return null;
|
17922 | }
|
17923 | else {
|
17924 | return new Error(this.i18nService.t('importFormatError'));
|
17925 | }
|
17926 | });
|
17927 | }
|
17928 | getImporter(format, organization = false) {
|
17929 | const importer = this.getImporterInstance(format);
|
17930 | if (importer == null) {
|
17931 | return null;
|
17932 | }
|
17933 | importer.organization = organization;
|
17934 | return importer;
|
17935 | }
|
17936 | getImporterInstance(format) {
|
17937 | if (format == null || format === '') {
|
17938 | return null;
|
17939 | }
|
17940 | switch (format) {
|
17941 | case 'bitwardencsv':
|
17942 | return new bitwardenCsvImporter_BitwardenCsvImporter();
|
17943 | case 'bitwardenjson':
|
17944 | return new bitwardenJsonImporter_BitwardenJsonImporter();
|
17945 | case 'lastpasscsv':
|
17946 | case 'passboltcsv':
|
17947 | return new lastpassCsvImporter_LastPassCsvImporter();
|
17948 | case 'keepassxcsv':
|
17949 | return new keepassxCsvImporter_KeePassXCsvImporter();
|
17950 | case 'aviracsv':
|
17951 | return new aviraCsvImporter_AviraCsvImporter();
|
17952 | case 'blurcsv':
|
17953 | return new blurCsvImporter_BlurCsvImporter();
|
17954 | case 'safeincloudxml':
|
17955 | return new safeInCloudXmlImporter_SafeInCloudXmlImporter();
|
17956 | case 'padlockcsv':
|
17957 | return new padlockCsvImporter_PadlockCsvImporter();
|
17958 | case 'keepass2xml':
|
17959 | return new keepass2XmlImporter_KeePass2XmlImporter();
|
17960 | case 'chromecsv':
|
17961 | case 'operacsv':
|
17962 | case 'vivaldicsv':
|
17963 | return new chromeCsvImporter_ChromeCsvImporter();
|
17964 | case 'firefoxcsv':
|
17965 | return new firefoxCsvImporter_FirefoxCsvImporter();
|
17966 | case 'upmcsv':
|
17967 | return new upmCsvImporter_UpmCsvImporter();
|
17968 | case 'saferpasscsv':
|
17969 | return new saferpassCsvImport_SaferPassCsvImporter();
|
17970 | case 'meldiumcsv':
|
17971 | return new meldiumCsvImporter_MeldiumCsvImporter();
|
17972 | case '1password1pif':
|
17973 | return new onepassword1PifImporter_OnePassword1PifImporter();
|
17974 | case '1passwordwincsv':
|
17975 | return new onepasswordWinCsvImporter_OnePasswordWinCsvImporter();
|
17976 | case 'keepercsv':
|
17977 | return new keeperCsvImporter_KeeperCsvImporter();
|
17978 | case 'passworddragonxml':
|
17979 | return new passwordDragonXmlImporter_PasswordDragonXmlImporter();
|
17980 | case 'enpasscsv':
|
17981 | return new enpassCsvImporter_EnpassCsvImporter();
|
17982 | case 'enpassjson':
|
17983 | return new enpassJsonImporter_EnpassJsonImporter();
|
17984 | case 'pwsafexml':
|
17985 | return new passwordSafeXmlImporter_PasswordSafeXmlImporter();
|
17986 | case 'dashlanejson':
|
17987 | return new dashlaneJsonImporter_DashlaneJsonImporter();
|
17988 | case 'msecurecsv':
|
17989 | return new msecureCsvImporter_MSecureCsvImporter();
|
17990 | case 'stickypasswordxml':
|
17991 | return new stickyPasswordXmlImporter_StickyPasswordXmlImporter();
|
17992 | case 'truekeycsv':
|
17993 | return new truekeyCsvImporter_TrueKeyCsvImporter();
|
17994 | case 'clipperzhtml':
|
17995 | return new clipperzHtmlImporter_ClipperzHtmlImporter();
|
17996 | case 'roboformcsv':
|
17997 | return new roboformCsvImporter_RoboFormCsvImporter();
|
17998 | case 'ascendocsv':
|
17999 | return new ascendoCsvImporter_AscendoCsvImporter();
|
18000 | case 'passwordbossjson':
|
18001 | return new passwordBossJsonImporter_PasswordBossJsonImporter();
|
18002 | case 'zohovaultcsv':
|
18003 | return new zohoVaultCsvImporter_ZohoVaultCsvImporter();
|
18004 | case 'splashidcsv':
|
18005 | return new splashIdCsvImporter_SplashIdCsvImporter();
|
18006 | case 'passkeepcsv':
|
18007 | return new passkeepCsvImporter_PassKeepCsvImporter();
|
18008 | case 'gnomejson':
|
18009 | return new gnomeJsonImporter_GnomeJsonImporter();
|
18010 | case 'passwordagentcsv':
|
18011 | return new passwordAgentCsvImporter_PasswordAgentCsvImporter();
|
18012 | case 'passpackcsv':
|
18013 | return new passpackCsvImporter_PasspackCsvImporter();
|
18014 | case 'passmanjson':
|
18015 | return new passmanJsonImporter_PassmanJsonImporter();
|
18016 | case 'avastcsv':
|
18017 | return new avastCsvImporter_AvastCsvImporter();
|
18018 | case 'avastjson':
|
18019 | return new avastJsonImporter_AvastJsonImporter();
|
18020 | case 'fsecurefsk':
|
18021 | return new fsecureFskImporter_FSecureFskImporter();
|
18022 | case 'kasperskytxt':
|
18023 | return new kasperskyTxtImporter_KasperskyTxtImporter();
|
18024 | case 'remembearcsv':
|
18025 | return new rememBearCsvImporter_RememBearCsvImporter();
|
18026 | case 'passwordwallettxt':
|
18027 | return new passwordWalletTxtImporter_PasswordWalletTxtImporter();
|
18028 | case 'mykicsv':
|
18029 | return new mykiCsvImporter_MykiCsvImporter();
|
18030 | case 'securesafecsv':
|
18031 | return new secureSafeCsvImporter_SecureSafeCsvImporter();
|
18032 | case 'logmeoncecsv':
|
18033 | return new logMeOnceCsvImporter_LogMeOnceCsvImporter();
|
18034 | case 'blackberrycsv':
|
18035 | return new blackBerryCsvImporter_BlackBerryCsvImporter();
|
18036 | case 'buttercupcsv':
|
18037 | return new buttercupCsvImporter_ButtercupCsvImporter();
|
18038 | case 'codebookcsv':
|
18039 | return new codebookCsvImporter_CodebookCsvImporter();
|
18040 | case 'encryptrcsv':
|
18041 | return new encryptrCsvImporter_EncryptrCsvImporter();
|
18042 | default:
|
18043 | return null;
|
18044 | }
|
18045 | }
|
18046 | postImport(importResult, organizationId = null) {
|
18047 | return import_service_awaiter(this, void 0, void 0, function* () {
|
18048 | if (organizationId == null) {
|
18049 | const request = new ImportCiphersRequest();
|
18050 | for (let i = 0; i < importResult.ciphers.length; i++) {
|
18051 | const c = yield this.cipherService.encrypt(importResult.ciphers[i]);
|
18052 | request.ciphers.push(new cipherRequest_CipherRequest(c));
|
18053 | }
|
18054 | if (importResult.folders != null) {
|
18055 | for (let i = 0; i < importResult.folders.length; i++) {
|
18056 | const f = yield this.folderService.encrypt(importResult.folders[i]);
|
18057 | request.folders.push(new FolderRequest(f));
|
18058 | }
|
18059 | }
|
18060 | if (importResult.folderRelationships != null) {
|
18061 | importResult.folderRelationships.forEach((r) => request.folderRelationships.push(new KvpRequest(r[0], r[1])));
|
18062 | }
|
18063 | return yield this.apiService.postImportCiphers(request);
|
18064 | }
|
18065 | else {
|
18066 | const request = new ImportOrganizationCiphersRequest();
|
18067 | for (let i = 0; i < importResult.ciphers.length; i++) {
|
18068 | importResult.ciphers[i].organizationId = organizationId;
|
18069 | const c = yield this.cipherService.encrypt(importResult.ciphers[i]);
|
18070 | request.ciphers.push(new cipherRequest_CipherRequest(c));
|
18071 | }
|
18072 | if (importResult.collections != null) {
|
18073 | for (let i = 0; i < importResult.collections.length; i++) {
|
18074 | importResult.collections[i].organizationId = organizationId;
|
18075 | const c = yield this.collectionService.encrypt(importResult.collections[i]);
|
18076 | request.collections.push(new CollectionRequest(c));
|
18077 | }
|
18078 | }
|
18079 | if (importResult.collectionRelationships != null) {
|
18080 | importResult.collectionRelationships.forEach((r) => request.collectionRelationships.push(new KvpRequest(r[0], r[1])));
|
18081 | }
|
18082 | return yield this.apiService.postImportOrganizationCiphers(organizationId, request);
|
18083 | }
|
18084 | });
|
18085 | }
|
18086 | badData(c) {
|
18087 | return (c.name == null || c.name === '--') &&
|
18088 | (c.type === CipherType.Login && c.login != null && utils_Utils.isNullOrWhitespace(c.login.password));
|
18089 | }
|
18090 | }
|
18091 |
|
18092 |
|
18093 | var external_lowdb_ = __webpack_require__(11);
|
18094 |
|
18095 |
|
18096 | var FileSync_ = __webpack_require__(14);
|
18097 |
|
18098 |
|
18099 | var external_readline_ = __webpack_require__(15);
|
18100 |
|
18101 |
|
18102 |
|
18103 |
|
18104 |
|
18105 | class nodeUtils_NodeUtils {
|
18106 | static mkdirpSync(targetDir, mode = '700', relative = false, relativeDir = null) {
|
18107 | const initialDir = external_path_["isAbsolute"](targetDir) ? external_path_["sep"] : '';
|
18108 | const baseDir = relative ? (relativeDir != null ? relativeDir : __dirname) : '.';
|
18109 | targetDir.split(external_path_["sep"]).reduce((parentDir, childDir) => {
|
18110 | const dir = external_path_["resolve"](baseDir, parentDir, childDir);
|
18111 | if (!external_fs_["existsSync"](dir)) {
|
18112 | external_fs_["mkdirSync"](dir, mode);
|
18113 | }
|
18114 | return dir;
|
18115 | }, initialDir);
|
18116 | }
|
18117 | static readFirstLine(fileName) {
|
18118 | return new Promise((resolve, reject) => {
|
18119 | const readStream = external_fs_["createReadStream"](fileName, { encoding: 'utf8' });
|
18120 | const readInterface = external_readline_["createInterface"](readStream);
|
18121 | readInterface
|
18122 | .on('line', (line) => {
|
18123 | readStream.close();
|
18124 | resolve(line);
|
18125 | })
|
18126 | .on('error', (err) => reject(err));
|
18127 | });
|
18128 | }
|
18129 | }
|
18130 |
|
18131 |
|
18132 |
|
18133 |
|
18134 |
|
18135 |
|
18136 |
|
18137 |
|
18138 | class lowdbStorage_service_LowdbStorageService {
|
18139 | constructor(defaults, dir, allowCache = false) {
|
18140 | this.allowCache = allowCache;
|
18141 | this.defaults = defaults;
|
18142 | let adapter;
|
18143 | if (utils_Utils.isNode && dir != null) {
|
18144 | if (!external_fs_["existsSync"](dir)) {
|
18145 | nodeUtils_NodeUtils.mkdirpSync(dir, '700');
|
18146 | }
|
18147 | this.dataFilePath = external_path_["join"](dir, 'data.json');
|
18148 | adapter = new FileSync_(this.dataFilePath);
|
18149 | }
|
18150 | try {
|
18151 | this.db = external_lowdb_(adapter);
|
18152 | }
|
18153 | catch (e) {
|
18154 | if (e instanceof SyntaxError) {
|
18155 | adapter.write({});
|
18156 | this.db = external_lowdb_(adapter);
|
18157 | }
|
18158 | else {
|
18159 | throw e;
|
18160 | }
|
18161 | }
|
18162 | }
|
18163 | init() {
|
18164 | if (this.defaults != null) {
|
18165 | this.readForNoCache();
|
18166 | this.db.defaults(this.defaults).write();
|
18167 | }
|
18168 | }
|
18169 | get(key) {
|
18170 | this.readForNoCache();
|
18171 | const val = this.db.get(key).value();
|
18172 | if (val == null) {
|
18173 | return Promise.resolve(null);
|
18174 | }
|
18175 | return Promise.resolve(val);
|
18176 | }
|
18177 | save(key, obj) {
|
18178 | this.readForNoCache();
|
18179 | this.db.set(key, obj).write();
|
18180 | return Promise.resolve();
|
18181 | }
|
18182 | remove(key) {
|
18183 | this.readForNoCache();
|
18184 | this.db.unset(key).write();
|
18185 | return Promise.resolve();
|
18186 | }
|
18187 | readForNoCache() {
|
18188 | if (!this.allowCache) {
|
18189 | this.db.read();
|
18190 | }
|
18191 | }
|
18192 | }
|
18193 |
|
18194 |
|
18195 | var external_form_data_ = __webpack_require__(16);
|
18196 |
|
18197 |
|
18198 | var external_https_proxy_agent_ = __webpack_require__(17);
|
18199 |
|
18200 |
|
18201 | var external_node_fetch_ = __webpack_require__(4);
|
18202 | var external_node_fetch_default = __webpack_require__.n(external_node_fetch_);
|
18203 |
|
18204 |
|
18205 |
|
18206 | class apiKeyResponse_ApiKeyResponse extends BaseResponse {
|
18207 | constructor(response) {
|
18208 | super(response);
|
18209 | this.apiKey = this.getResponseProperty('ApiKey');
|
18210 | }
|
18211 | }
|
18212 |
|
18213 |
|
18214 |
|
18215 | class billingResponse_BillingResponse extends BaseResponse {
|
18216 | constructor(response) {
|
18217 | super(response);
|
18218 | this.invoices = [];
|
18219 | this.transactions = [];
|
18220 | this.balance = this.getResponseProperty('Balance');
|
18221 | const paymentSource = this.getResponseProperty('PaymentSource');
|
18222 | const transactions = this.getResponseProperty('Transactions');
|
18223 | const invoices = this.getResponseProperty('Invoices');
|
18224 | this.paymentSource = paymentSource == null ? null : new billingResponse_BillingSourceResponse(paymentSource);
|
18225 | if (transactions != null) {
|
18226 | this.transactions = transactions.map((t) => new billingResponse_BillingTransactionResponse(t));
|
18227 | }
|
18228 | if (invoices != null) {
|
18229 | this.invoices = invoices.map((i) => new billingResponse_BillingInvoiceResponse(i));
|
18230 | }
|
18231 | }
|
18232 | }
|
18233 | class billingResponse_BillingSourceResponse extends BaseResponse {
|
18234 | constructor(response) {
|
18235 | super(response);
|
18236 | this.type = this.getResponseProperty('Type');
|
18237 | this.cardBrand = this.getResponseProperty('CardBrand');
|
18238 | this.description = this.getResponseProperty('Description');
|
18239 | this.needsVerification = this.getResponseProperty('NeedsVerification');
|
18240 | }
|
18241 | }
|
18242 | class billingResponse_BillingInvoiceResponse extends BaseResponse {
|
18243 | constructor(response) {
|
18244 | super(response);
|
18245 | this.url = this.getResponseProperty('Url');
|
18246 | this.pdfUrl = this.getResponseProperty('PdfUrl');
|
18247 | this.number = this.getResponseProperty('Number');
|
18248 | this.paid = this.getResponseProperty('Paid');
|
18249 | this.date = this.getResponseProperty('Date');
|
18250 | this.amount = this.getResponseProperty('Amount');
|
18251 | }
|
18252 | }
|
18253 | class billingResponse_BillingTransactionResponse extends BaseResponse {
|
18254 | constructor(response) {
|
18255 | super(response);
|
18256 | this.createdDate = this.getResponseProperty('CreatedDate');
|
18257 | this.amount = this.getResponseProperty('Amount');
|
18258 | this.refunded = this.getResponseProperty('Refunded');
|
18259 | this.partiallyRefunded = this.getResponseProperty('PartiallyRefunded');
|
18260 | this.refundedAmount = this.getResponseProperty('RefundedAmount');
|
18261 | this.type = this.getResponseProperty('Type');
|
18262 | this.paymentMethodType = this.getResponseProperty('PaymentMethodType');
|
18263 | this.details = this.getResponseProperty('Details');
|
18264 | }
|
18265 | }
|
18266 |
|
18267 |
|
18268 |
|
18269 | class breachAccountResponse_BreachAccountResponse extends BaseResponse {
|
18270 | constructor(response) {
|
18271 | super(response);
|
18272 | this.addedDate = this.getResponseProperty('AddedDate');
|
18273 | this.breachDate = this.getResponseProperty('BreachDate');
|
18274 | this.dataClasses = this.getResponseProperty('DataClasses');
|
18275 | this.description = this.getResponseProperty('Description');
|
18276 | this.domain = this.getResponseProperty('Domain');
|
18277 | this.isActive = this.getResponseProperty('IsActive');
|
18278 | this.isVerified = this.getResponseProperty('IsVerified');
|
18279 | this.logoPath = this.getResponseProperty('LogoPath');
|
18280 | this.modifiedDate = this.getResponseProperty('ModifiedDate');
|
18281 | this.name = this.getResponseProperty('Name');
|
18282 | this.pwnCount = this.getResponseProperty('PwnCount');
|
18283 | this.title = this.getResponseProperty('Title');
|
18284 | }
|
18285 | }
|
18286 |
|
18287 |
|
18288 |
|
18289 | class attachmentResponse_AttachmentResponse extends BaseResponse {
|
18290 | constructor(response) {
|
18291 | super(response);
|
18292 | this.id = this.getResponseProperty('Id');
|
18293 | this.url = this.getResponseProperty('Url');
|
18294 | this.fileName = this.getResponseProperty('FileName');
|
18295 | this.key = this.getResponseProperty('Key');
|
18296 | this.size = this.getResponseProperty('Size');
|
18297 | this.sizeName = this.getResponseProperty('SizeName');
|
18298 | }
|
18299 | }
|
18300 |
|
18301 |
|
18302 |
|
18303 | class passwordHistoryResponse_PasswordHistoryResponse extends BaseResponse {
|
18304 | constructor(response) {
|
18305 | super(response);
|
18306 | this.password = this.getResponseProperty('Password');
|
18307 | this.lastUsedDate = this.getResponseProperty('LastUsedDate');
|
18308 | }
|
18309 | }
|
18310 |
|
18311 |
|
18312 |
|
18313 |
|
18314 |
|
18315 |
|
18316 |
|
18317 |
|
18318 |
|
18319 |
|
18320 | class cipherResponse_CipherResponse extends BaseResponse {
|
18321 | constructor(response) {
|
18322 | super(response);
|
18323 | this.id = this.getResponseProperty('Id');
|
18324 | this.organizationId = this.getResponseProperty('OrganizationId');
|
18325 | this.folderId = this.getResponseProperty('FolderId') || null;
|
18326 | this.type = this.getResponseProperty('Type');
|
18327 | this.name = this.getResponseProperty('Name');
|
18328 | this.notes = this.getResponseProperty('Notes');
|
18329 | this.favorite = this.getResponseProperty('Favorite') || false;
|
18330 | this.edit = this.getResponseProperty('Edit') || true;
|
18331 | this.organizationUseTotp = this.getResponseProperty('OrganizationUseTotp');
|
18332 | this.revisionDate = this.getResponseProperty('RevisionDate');
|
18333 | this.collectionIds = this.getResponseProperty('CollectionIds');
|
18334 | this.deletedDate = this.getResponseProperty('DeletedDate');
|
18335 | const login = this.getResponseProperty('Login');
|
18336 | if (login != null) {
|
18337 | this.login = new loginApi_LoginApi(login);
|
18338 | }
|
18339 | const card = this.getResponseProperty('Card');
|
18340 | if (card != null) {
|
18341 | this.card = new cardApi_CardApi(card);
|
18342 | }
|
18343 | const identity = this.getResponseProperty('Identity');
|
18344 | if (identity != null) {
|
18345 | this.identity = new identityApi_IdentityApi(identity);
|
18346 | }
|
18347 | const secureNote = this.getResponseProperty('SecureNote');
|
18348 | if (secureNote != null) {
|
18349 | this.secureNote = new secureNoteApi_SecureNoteApi(secureNote);
|
18350 | }
|
18351 | const fields = this.getResponseProperty('Fields');
|
18352 | if (fields != null) {
|
18353 | this.fields = fields.map((f) => new fieldApi_FieldApi(f));
|
18354 | }
|
18355 | const attachments = this.getResponseProperty('Attachments');
|
18356 | if (attachments != null) {
|
18357 | this.attachments = attachments.map((a) => new attachmentResponse_AttachmentResponse(a));
|
18358 | }
|
18359 | const passwordHistory = this.getResponseProperty('PasswordHistory');
|
18360 | if (passwordHistory != null) {
|
18361 | this.passwordHistory = passwordHistory.map((h) => new passwordHistoryResponse_PasswordHistoryResponse(h));
|
18362 | }
|
18363 | }
|
18364 | }
|
18365 |
|
18366 |
|
18367 |
|
18368 | class selectionReadOnlyResponse_SelectionReadOnlyResponse extends BaseResponse {
|
18369 | constructor(response) {
|
18370 | super(response);
|
18371 | this.id = this.getResponseProperty('Id');
|
18372 | this.readOnly = this.getResponseProperty('ReadOnly');
|
18373 | }
|
18374 | }
|
18375 |
|
18376 |
|
18377 |
|
18378 |
|
18379 | class collectionResponse_CollectionResponse extends BaseResponse {
|
18380 | constructor(response) {
|
18381 | super(response);
|
18382 | this.id = this.getResponseProperty('Id');
|
18383 | this.organizationId = this.getResponseProperty('OrganizationId');
|
18384 | this.name = this.getResponseProperty('Name');
|
18385 | this.externalId = this.getResponseProperty('ExternalId');
|
18386 | }
|
18387 | }
|
18388 | class CollectionDetailsResponse extends collectionResponse_CollectionResponse {
|
18389 | constructor(response) {
|
18390 | super(response);
|
18391 | this.readOnly = this.getResponseProperty('ReadOnly') || false;
|
18392 | }
|
18393 | }
|
18394 | class collectionResponse_CollectionGroupDetailsResponse extends collectionResponse_CollectionResponse {
|
18395 | constructor(response) {
|
18396 | super(response);
|
18397 | this.groups = [];
|
18398 | const groups = this.getResponseProperty('Groups');
|
18399 | if (groups != null) {
|
18400 | this.groups = groups.map((g) => new selectionReadOnlyResponse_SelectionReadOnlyResponse(g));
|
18401 | }
|
18402 | }
|
18403 | }
|
18404 |
|
18405 |
|
18406 |
|
18407 | class globalDomainResponse_GlobalDomainResponse extends BaseResponse {
|
18408 | constructor(response) {
|
18409 | super(response);
|
18410 | this.type = this.getResponseProperty('Type');
|
18411 | this.domains = this.getResponseProperty('Domains');
|
18412 | this.excluded = this.getResponseProperty('Excluded');
|
18413 | }
|
18414 | }
|
18415 |
|
18416 |
|
18417 |
|
18418 |
|
18419 | class domainsResponse_DomainsResponse extends BaseResponse {
|
18420 | constructor(response) {
|
18421 | super(response);
|
18422 | this.globalEquivalentDomains = [];
|
18423 | this.equivalentDomains = this.getResponseProperty('EquivalentDomains');
|
18424 | const globalEquivalentDomains = this.getResponseProperty('GlobalEquivalentDomains');
|
18425 | if (globalEquivalentDomains != null) {
|
18426 | this.globalEquivalentDomains = globalEquivalentDomains.map((d) => new globalDomainResponse_GlobalDomainResponse(d));
|
18427 | }
|
18428 | else {
|
18429 | this.globalEquivalentDomains = [];
|
18430 | }
|
18431 | }
|
18432 | }
|
18433 |
|
18434 |
|
18435 |
|
18436 | class errorResponse_ErrorResponse extends BaseResponse {
|
18437 | constructor(response, status, identityResponse) {
|
18438 | super(response);
|
18439 | let errorModel = null;
|
18440 | if (response != null) {
|
18441 | const responseErrorModel = this.getResponseProperty('ErrorModel');
|
18442 | if (responseErrorModel && identityResponse) {
|
18443 | errorModel = responseErrorModel;
|
18444 | }
|
18445 | else {
|
18446 | errorModel = response;
|
18447 | }
|
18448 | }
|
18449 | if (errorModel) {
|
18450 | this.message = this.getResponseProperty('Message', errorModel);
|
18451 | this.validationErrors = this.getResponseProperty('ValidationErrors', errorModel);
|
18452 | }
|
18453 | else {
|
18454 | if (status === 429) {
|
18455 | this.message = 'Rate limit exceeded. Try again later.';
|
18456 | }
|
18457 | }
|
18458 | this.statusCode = status;
|
18459 | }
|
18460 | getSingleMessage() {
|
18461 | if (this.validationErrors == null) {
|
18462 | return this.message;
|
18463 | }
|
18464 | for (const key in this.validationErrors) {
|
18465 | if (!this.validationErrors.hasOwnProperty(key)) {
|
18466 | continue;
|
18467 | }
|
18468 | if (this.validationErrors[key].length) {
|
18469 | return this.validationErrors[key][0];
|
18470 | }
|
18471 | }
|
18472 | return this.message;
|
18473 | }
|
18474 | getAllMessages() {
|
18475 | const messages = [];
|
18476 | if (this.validationErrors == null) {
|
18477 | return messages;
|
18478 | }
|
18479 | for (const key in this.validationErrors) {
|
18480 | if (!this.validationErrors.hasOwnProperty(key)) {
|
18481 | continue;
|
18482 | }
|
18483 | this.validationErrors[key].forEach((item) => {
|
18484 | let prefix = '';
|
18485 | if (key.indexOf('[') > -1 && key.indexOf(']') > -1) {
|
18486 | const lastSep = key.lastIndexOf('.');
|
18487 | prefix = key.substr(0, lastSep > -1 ? lastSep : key.length) + ': ';
|
18488 | }
|
18489 | messages.push(prefix + item);
|
18490 | });
|
18491 | }
|
18492 | return messages;
|
18493 | }
|
18494 | }
|
18495 |
|
18496 |
|
18497 |
|
18498 | class eventResponse_EventResponse extends BaseResponse {
|
18499 | constructor(response) {
|
18500 | super(response);
|
18501 | this.type = this.getResponseProperty('Type');
|
18502 | this.userId = this.getResponseProperty('UserId');
|
18503 | this.organizationId = this.getResponseProperty('OrganizationId');
|
18504 | this.cipherId = this.getResponseProperty('CipherId');
|
18505 | this.collectionId = this.getResponseProperty('CollectionId');
|
18506 | this.groupId = this.getResponseProperty('GroupId');
|
18507 | this.organizationUserId = this.getResponseProperty('OrganizationUserId');
|
18508 | this.actingUserId = this.getResponseProperty('ActingUserId');
|
18509 | this.date = this.getResponseProperty('Date');
|
18510 | this.deviceType = this.getResponseProperty('DeviceType');
|
18511 | this.ipAddress = this.getResponseProperty('IpAddress');
|
18512 | }
|
18513 | }
|
18514 |
|
18515 |
|
18516 |
|
18517 | class folderResponse_FolderResponse extends BaseResponse {
|
18518 | constructor(response) {
|
18519 | super(response);
|
18520 | this.id = this.getResponseProperty('Id');
|
18521 | this.name = this.getResponseProperty('Name');
|
18522 | this.revisionDate = this.getResponseProperty('RevisionDate');
|
18523 | }
|
18524 | }
|
18525 |
|
18526 |
|
18527 |
|
18528 |
|
18529 | class groupResponse_GroupResponse extends BaseResponse {
|
18530 | constructor(response) {
|
18531 | super(response);
|
18532 | this.id = this.getResponseProperty('Id');
|
18533 | this.organizationId = this.getResponseProperty('OrganizationId');
|
18534 | this.name = this.getResponseProperty('Name');
|
18535 | this.accessAll = this.getResponseProperty('AccessAll');
|
18536 | this.externalId = this.getResponseProperty('ExternalId');
|
18537 | }
|
18538 | }
|
18539 | class groupResponse_GroupDetailsResponse extends groupResponse_GroupResponse {
|
18540 | constructor(response) {
|
18541 | super(response);
|
18542 | this.collections = [];
|
18543 | const collections = this.getResponseProperty('Collections');
|
18544 | if (collections != null) {
|
18545 | this.collections = collections.map((c) => new selectionReadOnlyResponse_SelectionReadOnlyResponse(c));
|
18546 | }
|
18547 | }
|
18548 | }
|
18549 |
|
18550 |
|
18551 |
|
18552 | class identityTokenResponse_IdentityTokenResponse extends BaseResponse {
|
18553 | constructor(response) {
|
18554 | super(response);
|
18555 | this.accessToken = response.access_token;
|
18556 | this.expiresIn = response.expires_in;
|
18557 | this.refreshToken = response.refresh_token;
|
18558 | this.tokenType = response.token_type;
|
18559 | this.privateKey = this.getResponseProperty('PrivateKey');
|
18560 | this.key = this.getResponseProperty('Key');
|
18561 | this.twoFactorToken = this.getResponseProperty('TwoFactorToken');
|
18562 | }
|
18563 | }
|
18564 |
|
18565 |
|
18566 |
|
18567 | class identityTwoFactorResponse_IdentityTwoFactorResponse extends BaseResponse {
|
18568 | constructor(response) {
|
18569 | super(response);
|
18570 | this.twoFactorProviders2 = new Map();
|
18571 | this.twoFactorProviders = this.getResponseProperty('TwoFactorProviders');
|
18572 | const twoFactorProviders2 = this.getResponseProperty('TwoFactorProviders2');
|
18573 | if (twoFactorProviders2 != null) {
|
18574 | for (const prop in twoFactorProviders2) {
|
18575 | if (twoFactorProviders2.hasOwnProperty(prop)) {
|
18576 | this.twoFactorProviders2.set(parseInt(prop, null), twoFactorProviders2[prop]);
|
18577 | }
|
18578 | }
|
18579 | }
|
18580 | }
|
18581 | }
|
18582 |
|
18583 |
|
18584 |
|
18585 | class listResponse_ListResponse extends BaseResponse {
|
18586 | constructor(response, t) {
|
18587 | super(response);
|
18588 | const data = this.getResponseProperty('Data');
|
18589 | this.data = data == null ? [] : data.map((dr) => new t(dr));
|
18590 | this.continuationToken = this.getResponseProperty('ContinuationToken');
|
18591 | }
|
18592 | }
|
18593 |
|
18594 |
|
18595 |
|
18596 | class organizationResponse_OrganizationResponse extends BaseResponse {
|
18597 | constructor(response) {
|
18598 | super(response);
|
18599 | this.id = this.getResponseProperty('Id');
|
18600 | this.name = this.getResponseProperty('Name');
|
18601 | this.businessName = this.getResponseProperty('BusinessName');
|
18602 | this.businessAddress1 = this.getResponseProperty('BusinessAddress1');
|
18603 | this.businessAddress2 = this.getResponseProperty('BusinessAddress2');
|
18604 | this.businessAddress3 = this.getResponseProperty('BusinessAddress3');
|
18605 | this.businessCountry = this.getResponseProperty('BusinessCountry');
|
18606 | this.businessTaxNumber = this.getResponseProperty('BusinessTaxNumber');
|
18607 | this.billingEmail = this.getResponseProperty('BillingEmail');
|
18608 | this.plan = this.getResponseProperty('Plan');
|
18609 | this.planType = this.getResponseProperty('PlanType');
|
18610 | this.seats = this.getResponseProperty('Seats');
|
18611 | this.maxCollections = this.getResponseProperty('MaxCollections');
|
18612 | this.maxStorageGb = this.getResponseProperty('MaxStorageGb');
|
18613 | this.useGroups = this.getResponseProperty('UseGroups');
|
18614 | this.useDirectory = this.getResponseProperty('UseDirectory');
|
18615 | this.useEvents = this.getResponseProperty('UseEvents');
|
18616 | this.useTotp = this.getResponseProperty('UseTotp');
|
18617 | this.use2fa = this.getResponseProperty('Use2fa');
|
18618 | this.useApi = this.getResponseProperty('UseApi');
|
18619 | }
|
18620 | }
|
18621 |
|
18622 |
|
18623 |
|
18624 | class subscriptionResponse_SubscriptionResponse extends BaseResponse {
|
18625 | constructor(response) {
|
18626 | super(response);
|
18627 | this.storageName = this.getResponseProperty('StorageName');
|
18628 | this.storageGb = this.getResponseProperty('StorageGb');
|
18629 | this.maxStorageGb = this.getResponseProperty('MaxStorageGb');
|
18630 | this.license = this.getResponseProperty('License');
|
18631 | this.expiration = this.getResponseProperty('Expiration');
|
18632 | this.usingInAppPurchase = this.getResponseProperty('UsingInAppPurchase');
|
18633 | const subscription = this.getResponseProperty('Subscription');
|
18634 | const upcomingInvoice = this.getResponseProperty('UpcomingInvoice');
|
18635 | this.subscription = subscription == null ? null : new subscriptionResponse_BillingSubscriptionResponse(subscription);
|
18636 | this.upcomingInvoice = upcomingInvoice == null ? null :
|
18637 | new subscriptionResponse_BillingSubscriptionUpcomingInvoiceResponse(upcomingInvoice);
|
18638 | }
|
18639 | }
|
18640 | class subscriptionResponse_BillingSubscriptionResponse extends BaseResponse {
|
18641 | constructor(response) {
|
18642 | super(response);
|
18643 | this.items = [];
|
18644 | this.trialEndDate = this.getResponseProperty('TrialStartDate');
|
18645 | this.trialEndDate = this.getResponseProperty('TrialEndDate');
|
18646 | this.periodStartDate = this.getResponseProperty('PeriodStartDate');
|
18647 | this.periodEndDate = this.getResponseProperty('PeriodEndDate');
|
18648 | this.cancelledDate = this.getResponseProperty('CancelledDate');
|
18649 | this.cancelAtEndDate = this.getResponseProperty('CancelAtEndDate');
|
18650 | this.status = this.getResponseProperty('Status');
|
18651 | this.cancelled = this.getResponseProperty('Cancelled');
|
18652 | const items = this.getResponseProperty('Items');
|
18653 | if (items != null) {
|
18654 | this.items = items.map((i) => new subscriptionResponse_BillingSubscriptionItemResponse(i));
|
18655 | }
|
18656 | }
|
18657 | }
|
18658 | class subscriptionResponse_BillingSubscriptionItemResponse extends BaseResponse {
|
18659 | constructor(response) {
|
18660 | super(response);
|
18661 | this.name = this.getResponseProperty('Name');
|
18662 | this.amount = this.getResponseProperty('Amount');
|
18663 | this.quantity = this.getResponseProperty('Quantity');
|
18664 | this.interval = this.getResponseProperty('Interval');
|
18665 | }
|
18666 | }
|
18667 | class subscriptionResponse_BillingSubscriptionUpcomingInvoiceResponse extends BaseResponse {
|
18668 | constructor(response) {
|
18669 | super(response);
|
18670 | this.date = this.getResponseProperty('Date');
|
18671 | this.amount = this.getResponseProperty('Amount');
|
18672 | }
|
18673 | }
|
18674 |
|
18675 |
|
18676 |
|
18677 |
|
18678 | class organizationSubscriptionResponse_OrganizationSubscriptionResponse extends organizationResponse_OrganizationResponse {
|
18679 | constructor(response) {
|
18680 | super(response);
|
18681 | this.storageName = this.getResponseProperty('StorageName');
|
18682 | this.storageGb = this.getResponseProperty('StorageGb');
|
18683 | const subscription = this.getResponseProperty('Subscription');
|
18684 | this.subscription = subscription == null ? null : new subscriptionResponse_BillingSubscriptionResponse(subscription);
|
18685 | const upcomingInvoice = this.getResponseProperty('UpcomingInvoice');
|
18686 | this.upcomingInvoice = upcomingInvoice == null ? null :
|
18687 | new subscriptionResponse_BillingSubscriptionUpcomingInvoiceResponse(upcomingInvoice);
|
18688 | this.expiration = this.getResponseProperty('Expiration');
|
18689 | }
|
18690 | }
|
18691 |
|
18692 |
|
18693 |
|
18694 |
|
18695 | class organizationUserResponse_OrganizationUserResponse extends BaseResponse {
|
18696 | constructor(response) {
|
18697 | super(response);
|
18698 | this.id = this.getResponseProperty('Id');
|
18699 | this.userId = this.getResponseProperty('UserId');
|
18700 | this.type = this.getResponseProperty('Type');
|
18701 | this.status = this.getResponseProperty('Status');
|
18702 | this.accessAll = this.getResponseProperty('AccessAll');
|
18703 | }
|
18704 | }
|
18705 | class OrganizationUserUserDetailsResponse extends organizationUserResponse_OrganizationUserResponse {
|
18706 | constructor(response) {
|
18707 | super(response);
|
18708 | this.name = this.getResponseProperty('Name');
|
18709 | this.email = this.getResponseProperty('Email');
|
18710 | this.twoFactorEnabled = this.getResponseProperty('TwoFactorEnabled');
|
18711 | }
|
18712 | }
|
18713 | class organizationUserResponse_OrganizationUserDetailsResponse extends organizationUserResponse_OrganizationUserResponse {
|
18714 | constructor(response) {
|
18715 | super(response);
|
18716 | this.collections = [];
|
18717 | const collections = this.getResponseProperty('Collections');
|
18718 | if (collections != null) {
|
18719 | this.collections = collections.map((c) => new selectionReadOnlyResponse_SelectionReadOnlyResponse(c));
|
18720 | }
|
18721 | }
|
18722 | }
|
18723 |
|
18724 |
|
18725 |
|
18726 | class profileOrganizationResponse_ProfileOrganizationResponse extends BaseResponse {
|
18727 | constructor(response) {
|
18728 | super(response);
|
18729 | this.id = this.getResponseProperty('Id');
|
18730 | this.name = this.getResponseProperty('Name');
|
18731 | this.usePolicies = this.getResponseProperty('UsePolicies');
|
18732 | this.useGroups = this.getResponseProperty('UseGroups');
|
18733 | this.useDirectory = this.getResponseProperty('UseDirectory');
|
18734 | this.useEvents = this.getResponseProperty('UseEvents');
|
18735 | this.useTotp = this.getResponseProperty('UseTotp');
|
18736 | this.use2fa = this.getResponseProperty('Use2fa');
|
18737 | this.useApi = this.getResponseProperty('UseApi');
|
18738 | this.selfHost = this.getResponseProperty('SelfHost');
|
18739 | this.usersGetPremium = this.getResponseProperty('UsersGetPremium');
|
18740 | this.seats = this.getResponseProperty('Seats');
|
18741 | this.maxCollections = this.getResponseProperty('MaxCollections');
|
18742 | this.maxStorageGb = this.getResponseProperty('MaxStorageGb');
|
18743 | this.key = this.getResponseProperty('Key');
|
18744 | this.status = this.getResponseProperty('Status');
|
18745 | this.type = this.getResponseProperty('Type');
|
18746 | this.enabled = this.getResponseProperty('Enabled');
|
18747 | }
|
18748 | }
|
18749 |
|
18750 |
|
18751 |
|
18752 |
|
18753 | class profileResponse_ProfileResponse extends BaseResponse {
|
18754 | constructor(response) {
|
18755 | super(response);
|
18756 | this.organizations = [];
|
18757 | this.id = this.getResponseProperty('Id');
|
18758 | this.name = this.getResponseProperty('Name');
|
18759 | this.email = this.getResponseProperty('Email');
|
18760 | this.emailVerified = this.getResponseProperty('EmailVerified');
|
18761 | this.masterPasswordHint = this.getResponseProperty('MasterPasswordHint');
|
18762 | this.premium = this.getResponseProperty('Premium');
|
18763 | this.culture = this.getResponseProperty('Culture');
|
18764 | this.twoFactorEnabled = this.getResponseProperty('TwoFactorEnabled');
|
18765 | this.key = this.getResponseProperty('Key');
|
18766 | this.privateKey = this.getResponseProperty('PrivateKey');
|
18767 | this.securityStamp = this.getResponseProperty('SecurityStamp');
|
18768 | const organizations = this.getResponseProperty('Organizations');
|
18769 | if (organizations != null) {
|
18770 | this.organizations = organizations.map((o) => new profileOrganizationResponse_ProfileOrganizationResponse(o));
|
18771 | }
|
18772 | }
|
18773 | }
|
18774 |
|
18775 |
|
18776 |
|
18777 |
|
18778 | class paymentResponse_PaymentResponse extends BaseResponse {
|
18779 | constructor(response) {
|
18780 | super(response);
|
18781 | const userProfile = this.getResponseProperty('UserProfile');
|
18782 | if (userProfile != null) {
|
18783 | this.userProfile = new profileResponse_ProfileResponse(userProfile);
|
18784 | }
|
18785 | this.paymentIntentClientSecret = this.getResponseProperty('PaymentIntentClientSecret');
|
18786 | this.success = this.getResponseProperty('Success');
|
18787 | }
|
18788 | }
|
18789 |
|
18790 |
|
18791 |
|
18792 | class policyResponse_PolicyResponse extends BaseResponse {
|
18793 | constructor(response) {
|
18794 | super(response);
|
18795 | this.id = this.getResponseProperty('Id');
|
18796 | this.organizationId = this.getResponseProperty('OrganizationId');
|
18797 | this.type = this.getResponseProperty('Type');
|
18798 | this.data = this.getResponseProperty('Data');
|
18799 | this.enabled = this.getResponseProperty('Enabled');
|
18800 | }
|
18801 | }
|
18802 |
|
18803 |
|
18804 |
|
18805 | class preloginResponse_PreloginResponse extends BaseResponse {
|
18806 | constructor(response) {
|
18807 | super(response);
|
18808 | this.kdf = this.getResponseProperty('Kdf');
|
18809 | this.kdfIterations = this.getResponseProperty('KdfIterations');
|
18810 | }
|
18811 | }
|
18812 |
|
18813 |
|
18814 |
|
18815 |
|
18816 |
|
18817 |
|
18818 |
|
18819 |
|
18820 |
|
18821 | class syncResponse_SyncResponse extends BaseResponse {
|
18822 | constructor(response) {
|
18823 | super(response);
|
18824 | this.folders = [];
|
18825 | this.collections = [];
|
18826 | this.ciphers = [];
|
18827 | this.policies = [];
|
18828 | const profile = this.getResponseProperty('Profile');
|
18829 | if (profile != null) {
|
18830 | this.profile = new profileResponse_ProfileResponse(profile);
|
18831 | }
|
18832 | const folders = this.getResponseProperty('Folders');
|
18833 | if (folders != null) {
|
18834 | this.folders = folders.map((f) => new folderResponse_FolderResponse(f));
|
18835 | }
|
18836 | const collections = this.getResponseProperty('Collections');
|
18837 | if (collections != null) {
|
18838 | this.collections = collections.map((c) => new CollectionDetailsResponse(c));
|
18839 | }
|
18840 | const ciphers = this.getResponseProperty('Ciphers');
|
18841 | if (ciphers != null) {
|
18842 | this.ciphers = ciphers.map((c) => new cipherResponse_CipherResponse(c));
|
18843 | }
|
18844 | const domains = this.getResponseProperty('Domains');
|
18845 | if (domains != null) {
|
18846 | this.domains = new domainsResponse_DomainsResponse(domains);
|
18847 | }
|
18848 | const policies = this.getResponseProperty('Policies');
|
18849 | if (policies != null) {
|
18850 | this.policies = policies.map((p) => new policyResponse_PolicyResponse(p));
|
18851 | }
|
18852 | }
|
18853 | }
|
18854 |
|
18855 |
|
18856 |
|
18857 | class twoFactorAuthenticatorResponse_TwoFactorAuthenticatorResponse extends BaseResponse {
|
18858 | constructor(response) {
|
18859 | super(response);
|
18860 | this.enabled = this.getResponseProperty('Enabled');
|
18861 | this.key = this.getResponseProperty('Key');
|
18862 | }
|
18863 | }
|
18864 |
|
18865 |
|
18866 |
|
18867 | class twoFactorDuoResponse_TwoFactorDuoResponse extends BaseResponse {
|
18868 | constructor(response) {
|
18869 | super(response);
|
18870 | this.enabled = this.getResponseProperty('Enabled');
|
18871 | this.host = this.getResponseProperty('Host');
|
18872 | this.secretKey = this.getResponseProperty('SecretKey');
|
18873 | this.integrationKey = this.getResponseProperty('IntegrationKey');
|
18874 | }
|
18875 | }
|
18876 |
|
18877 |
|
18878 |
|
18879 | class twoFactorEmailResponse_TwoFactorEmailResponse extends BaseResponse {
|
18880 | constructor(response) {
|
18881 | super(response);
|
18882 | this.enabled = this.getResponseProperty('Enabled');
|
18883 | this.email = this.getResponseProperty('Email');
|
18884 | }
|
18885 | }
|
18886 |
|
18887 |
|
18888 |
|
18889 | class twoFactorProviderResponse_TwoFactorProviderResponse extends BaseResponse {
|
18890 | constructor(response) {
|
18891 | super(response);
|
18892 | this.enabled = this.getResponseProperty('Enabled');
|
18893 | this.type = this.getResponseProperty('Type');
|
18894 | }
|
18895 | }
|
18896 |
|
18897 |
|
18898 |
|
18899 | class twoFactorRescoverResponse_TwoFactorRecoverResponse extends BaseResponse {
|
18900 | constructor(response) {
|
18901 | super(response);
|
18902 | this.code = this.getResponseProperty('Code');
|
18903 | }
|
18904 | }
|
18905 |
|
18906 |
|
18907 |
|
18908 | class twoFactorU2fResponse_TwoFactorU2fResponse extends BaseResponse {
|
18909 | constructor(response) {
|
18910 | super(response);
|
18911 | this.enabled = this.getResponseProperty('Enabled');
|
18912 | const keys = this.getResponseProperty('Keys');
|
18913 | this.keys = keys == null ? null : keys.map((k) => new twoFactorU2fResponse_KeyResponse(k));
|
18914 | }
|
18915 | }
|
18916 | class twoFactorU2fResponse_KeyResponse extends BaseResponse {
|
18917 | constructor(response) {
|
18918 | super(response);
|
18919 | this.name = this.getResponseProperty('Name');
|
18920 | this.id = this.getResponseProperty('Id');
|
18921 | this.compromised = this.getResponseProperty('Compromised');
|
18922 | }
|
18923 | }
|
18924 | class twoFactorU2fResponse_ChallengeResponse extends BaseResponse {
|
18925 | constructor(response) {
|
18926 | super(response);
|
18927 | this.userId = this.getResponseProperty('UserId');
|
18928 | this.appId = this.getResponseProperty('AppId');
|
18929 | this.challenge = this.getResponseProperty('Challenge');
|
18930 | this.version = this.getResponseProperty('Version');
|
18931 | }
|
18932 | }
|
18933 |
|
18934 |
|
18935 |
|
18936 | class twoFactorYubiKeyResponse_TwoFactorYubiKeyResponse extends BaseResponse {
|
18937 | constructor(response) {
|
18938 | super(response);
|
18939 | this.enabled = this.getResponseProperty('Enabled');
|
18940 | this.key1 = this.getResponseProperty('Key1');
|
18941 | this.key2 = this.getResponseProperty('Key2');
|
18942 | this.key3 = this.getResponseProperty('Key3');
|
18943 | this.key4 = this.getResponseProperty('Key4');
|
18944 | this.key5 = this.getResponseProperty('Key5');
|
18945 | this.nfc = this.getResponseProperty('Nfc');
|
18946 | }
|
18947 | }
|
18948 |
|
18949 |
|
18950 |
|
18951 | class userKeyResponse_UserKeyResponse extends BaseResponse {
|
18952 | constructor(response) {
|
18953 | super(response);
|
18954 | this.userId = this.getResponseProperty('UserId');
|
18955 | this.publicKey = this.getResponseProperty('PublicKey');
|
18956 | }
|
18957 | }
|
18958 |
|
18959 |
|
18960 | var api_service_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
18961 | return new (P || (P = Promise))(function (resolve, reject) {
|
18962 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
18963 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
18964 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
18965 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
18966 | });
|
18967 | };
|
18968 |
|
18969 |
|
18970 |
|
18971 |
|
18972 |
|
18973 |
|
18974 |
|
18975 |
|
18976 |
|
18977 |
|
18978 |
|
18979 |
|
18980 |
|
18981 |
|
18982 |
|
18983 |
|
18984 |
|
18985 |
|
18986 |
|
18987 |
|
18988 |
|
18989 |
|
18990 |
|
18991 |
|
18992 |
|
18993 |
|
18994 |
|
18995 |
|
18996 |
|
18997 |
|
18998 |
|
18999 |
|
19000 | class api_service_ApiService {
|
19001 | constructor(tokenService, platformUtilsService, logoutCallback, customUserAgent = null) {
|
19002 | this.tokenService = tokenService;
|
19003 | this.platformUtilsService = platformUtilsService;
|
19004 | this.logoutCallback = logoutCallback;
|
19005 | this.customUserAgent = customUserAgent;
|
19006 | this.urlsSet = false;
|
19007 | this.isWebClient = false;
|
19008 | this.isDesktopClient = false;
|
19009 | this.usingBaseUrl = false;
|
19010 | this.device = platformUtilsService.getDevice();
|
19011 | this.deviceType = this.device.toString();
|
19012 | this.isWebClient = this.device === DeviceType.IEBrowser || this.device === DeviceType.ChromeBrowser ||
|
19013 | this.device === DeviceType.EdgeBrowser || this.device === DeviceType.FirefoxBrowser ||
|
19014 | this.device === DeviceType.OperaBrowser || this.device === DeviceType.SafariBrowser ||
|
19015 | this.device === DeviceType.UnknownBrowser || this.device === DeviceType.VivaldiBrowser;
|
19016 | this.isDesktopClient = this.device === DeviceType.WindowsDesktop || this.device === DeviceType.MacOsDesktop ||
|
19017 | this.device === DeviceType.LinuxDesktop;
|
19018 | }
|
19019 | setUrls(urls) {
|
19020 | this.urlsSet = true;
|
19021 | if (urls.base != null) {
|
19022 | this.usingBaseUrl = true;
|
19023 | this.apiBaseUrl = urls.base + '/api';
|
19024 | this.identityBaseUrl = urls.base + '/identity';
|
19025 | this.eventsBaseUrl = urls.base + '/events';
|
19026 | return;
|
19027 | }
|
19028 | this.apiBaseUrl = urls.api;
|
19029 | this.identityBaseUrl = urls.identity;
|
19030 | this.eventsBaseUrl = urls.events;
|
19031 |
|
19032 | if (this.apiBaseUrl == null) {
|
19033 | this.apiBaseUrl = 'https://api.bitwarden.com';
|
19034 | }
|
19035 | if (this.identityBaseUrl == null) {
|
19036 | this.identityBaseUrl = 'https://identity.bitwarden.com';
|
19037 | }
|
19038 | if (this.eventsBaseUrl == null) {
|
19039 | this.eventsBaseUrl = 'https://events.bitwarden.com';
|
19040 | }
|
19041 | }
|
19042 |
|
19043 | postIdentityToken(request) {
|
19044 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19045 | const headers = new Headers({
|
19046 | 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8',
|
19047 | 'Accept': 'application/json',
|
19048 | 'Device-Type': this.deviceType,
|
19049 | });
|
19050 | if (this.customUserAgent != null) {
|
19051 | headers.set('User-Agent', this.customUserAgent);
|
19052 | }
|
19053 | const response = yield this.fetch(new Request(this.identityBaseUrl + '/connect/token', {
|
19054 | body: this.qsStringify(request.toIdentityToken(this.platformUtilsService.identityClientId)),
|
19055 | credentials: this.getCredentials(),
|
19056 | cache: 'no-store',
|
19057 | headers: headers,
|
19058 | method: 'POST',
|
19059 | }));
|
19060 | let responseJson = null;
|
19061 | if (this.isJsonResponse(response)) {
|
19062 | responseJson = yield response.json();
|
19063 | }
|
19064 | if (responseJson != null) {
|
19065 | if (response.status === 200) {
|
19066 | return new identityTokenResponse_IdentityTokenResponse(responseJson);
|
19067 | }
|
19068 | else if (response.status === 400 && responseJson.TwoFactorProviders2 &&
|
19069 | Object.keys(responseJson.TwoFactorProviders2).length) {
|
19070 | yield this.tokenService.clearTwoFactorToken(request.email);
|
19071 | return new identityTwoFactorResponse_IdentityTwoFactorResponse(responseJson);
|
19072 | }
|
19073 | }
|
19074 | return Promise.reject(new errorResponse_ErrorResponse(responseJson, response.status, true));
|
19075 | });
|
19076 | }
|
19077 | refreshIdentityToken() {
|
19078 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19079 | try {
|
19080 | yield this.doRefreshToken();
|
19081 | }
|
19082 | catch (e) {
|
19083 | return Promise.reject(null);
|
19084 | }
|
19085 | });
|
19086 | }
|
19087 |
|
19088 | getProfile() {
|
19089 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19090 | const r = yield this.send('GET', '/accounts/profile', null, true, true);
|
19091 | return new profileResponse_ProfileResponse(r);
|
19092 | });
|
19093 | }
|
19094 | getUserBilling() {
|
19095 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19096 | const r = yield this.send('GET', '/accounts/billing', null, true, true);
|
19097 | return new billingResponse_BillingResponse(r);
|
19098 | });
|
19099 | }
|
19100 | getUserSubscription() {
|
19101 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19102 | const r = yield this.send('GET', '/accounts/subscription', null, true, true);
|
19103 | return new subscriptionResponse_SubscriptionResponse(r);
|
19104 | });
|
19105 | }
|
19106 | putProfile(request) {
|
19107 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19108 | const r = yield this.send('PUT', '/accounts/profile', request, true, true);
|
19109 | return new profileResponse_ProfileResponse(r);
|
19110 | });
|
19111 | }
|
19112 | postPrelogin(request) {
|
19113 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19114 | const r = yield this.send('POST', '/accounts/prelogin', request, false, true);
|
19115 | return new preloginResponse_PreloginResponse(r);
|
19116 | });
|
19117 | }
|
19118 | postEmailToken(request) {
|
19119 | return this.send('POST', '/accounts/email-token', request, true, false);
|
19120 | }
|
19121 | postEmail(request) {
|
19122 | return this.send('POST', '/accounts/email', request, true, false);
|
19123 | }
|
19124 | postPassword(request) {
|
19125 | return this.send('POST', '/accounts/password', request, true, false);
|
19126 | }
|
19127 | postSecurityStamp(request) {
|
19128 | return this.send('POST', '/accounts/security-stamp', request, true, false);
|
19129 | }
|
19130 | deleteAccount(request) {
|
19131 | return this.send('DELETE', '/accounts', request, true, false);
|
19132 | }
|
19133 | getAccountRevisionDate() {
|
19134 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19135 | const r = yield this.send('GET', '/accounts/revision-date', null, true, true);
|
19136 | return r;
|
19137 | });
|
19138 | }
|
19139 | postPasswordHint(request) {
|
19140 | return this.send('POST', '/accounts/password-hint', request, false, false);
|
19141 | }
|
19142 | postRegister(request) {
|
19143 | return this.send('POST', '/accounts/register', request, false, false);
|
19144 | }
|
19145 | postPremium(data) {
|
19146 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19147 | const r = yield this.send('POST', '/accounts/premium', data, true, true);
|
19148 | return new paymentResponse_PaymentResponse(r);
|
19149 | });
|
19150 | }
|
19151 | postIapCheck(request) {
|
19152 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19153 | return this.send('POST', '/accounts/iap-check', request, true, false);
|
19154 | });
|
19155 | }
|
19156 | postReinstatePremium() {
|
19157 | return this.send('POST', '/accounts/reinstate-premium', null, true, false);
|
19158 | }
|
19159 | postCancelPremium() {
|
19160 | return this.send('POST', '/accounts/cancel-premium', null, true, false);
|
19161 | }
|
19162 | postAccountStorage(request) {
|
19163 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19164 | const r = yield this.send('POST', '/accounts/storage', request, true, true);
|
19165 | return new paymentResponse_PaymentResponse(r);
|
19166 | });
|
19167 | }
|
19168 | postAccountPayment(request) {
|
19169 | return this.send('POST', '/accounts/payment', request, true, false);
|
19170 | }
|
19171 | postAccountLicense(data) {
|
19172 | return this.send('POST', '/accounts/license', data, true, false);
|
19173 | }
|
19174 | postAccountKeys(request) {
|
19175 | return this.send('POST', '/accounts/keys', request, true, false);
|
19176 | }
|
19177 | postAccountKey(request) {
|
19178 | return this.send('POST', '/accounts/key', request, true, false);
|
19179 | }
|
19180 | postAccountVerifyEmail() {
|
19181 | return this.send('POST', '/accounts/verify-email', null, true, false);
|
19182 | }
|
19183 | postAccountVerifyEmailToken(request) {
|
19184 | return this.send('POST', '/accounts/verify-email-token', request, false, false);
|
19185 | }
|
19186 | postAccountRecoverDelete(request) {
|
19187 | return this.send('POST', '/accounts/delete-recover', request, false, false);
|
19188 | }
|
19189 | postAccountRecoverDeleteToken(request) {
|
19190 | return this.send('POST', '/accounts/delete-recover-token', request, false, false);
|
19191 | }
|
19192 | postAccountKdf(request) {
|
19193 | return this.send('POST', '/accounts/kdf', request, true, false);
|
19194 | }
|
19195 | getEnterprisePortalSignInToken() {
|
19196 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19197 | const r = yield this.send('GET', '/accounts/enterprise-portal-signin-token', null, true, true);
|
19198 | return r;
|
19199 | });
|
19200 | }
|
19201 |
|
19202 | getFolder(id) {
|
19203 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19204 | const r = yield this.send('GET', '/folders/' + id, null, true, true);
|
19205 | return new folderResponse_FolderResponse(r);
|
19206 | });
|
19207 | }
|
19208 | postFolder(request) {
|
19209 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19210 | const r = yield this.send('POST', '/folders', request, true, true);
|
19211 | return new folderResponse_FolderResponse(r);
|
19212 | });
|
19213 | }
|
19214 | putFolder(id, request) {
|
19215 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19216 | const r = yield this.send('PUT', '/folders/' + id, request, true, true);
|
19217 | return new folderResponse_FolderResponse(r);
|
19218 | });
|
19219 | }
|
19220 | deleteFolder(id) {
|
19221 | return this.send('DELETE', '/folders/' + id, null, true, false);
|
19222 | }
|
19223 |
|
19224 | getCipher(id) {
|
19225 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19226 | const r = yield this.send('GET', '/ciphers/' + id, null, true, true);
|
19227 | return new cipherResponse_CipherResponse(r);
|
19228 | });
|
19229 | }
|
19230 | getCipherAdmin(id) {
|
19231 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19232 | const r = yield this.send('GET', '/ciphers/' + id + '/admin', null, true, true);
|
19233 | return new cipherResponse_CipherResponse(r);
|
19234 | });
|
19235 | }
|
19236 | getCiphersOrganization(organizationId) {
|
19237 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19238 | const r = yield this.send('GET', '/ciphers/organization-details?organizationId=' + organizationId, null, true, true);
|
19239 | return new listResponse_ListResponse(r, cipherResponse_CipherResponse);
|
19240 | });
|
19241 | }
|
19242 | postCipher(request) {
|
19243 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19244 | const r = yield this.send('POST', '/ciphers', request, true, true);
|
19245 | return new cipherResponse_CipherResponse(r);
|
19246 | });
|
19247 | }
|
19248 | postCipherCreate(request) {
|
19249 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19250 | const r = yield this.send('POST', '/ciphers/create', request, true, true);
|
19251 | return new cipherResponse_CipherResponse(r);
|
19252 | });
|
19253 | }
|
19254 | postCipherAdmin(request) {
|
19255 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19256 | const r = yield this.send('POST', '/ciphers/admin', request, true, true);
|
19257 | return new cipherResponse_CipherResponse(r);
|
19258 | });
|
19259 | }
|
19260 | putCipher(id, request) {
|
19261 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19262 | const r = yield this.send('PUT', '/ciphers/' + id, request, true, true);
|
19263 | return new cipherResponse_CipherResponse(r);
|
19264 | });
|
19265 | }
|
19266 | putCipherAdmin(id, request) {
|
19267 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19268 | const r = yield this.send('PUT', '/ciphers/' + id + '/admin', request, true, true);
|
19269 | return new cipherResponse_CipherResponse(r);
|
19270 | });
|
19271 | }
|
19272 | deleteCipher(id) {
|
19273 | return this.send('DELETE', '/ciphers/' + id, null, true, false);
|
19274 | }
|
19275 | deleteCipherAdmin(id) {
|
19276 | return this.send('DELETE', '/ciphers/' + id + '/admin', null, true, false);
|
19277 | }
|
19278 | deleteManyCiphers(request) {
|
19279 | return this.send('DELETE', '/ciphers', request, true, false);
|
19280 | }
|
19281 | putMoveCiphers(request) {
|
19282 | return this.send('PUT', '/ciphers/move', request, true, false);
|
19283 | }
|
19284 | putShareCipher(id, request) {
|
19285 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19286 | const r = yield this.send('PUT', '/ciphers/' + id + '/share', request, true, true);
|
19287 | return new cipherResponse_CipherResponse(r);
|
19288 | });
|
19289 | }
|
19290 | putShareCiphers(request) {
|
19291 | return this.send('PUT', '/ciphers/share', request, true, false);
|
19292 | }
|
19293 | putCipherCollections(id, request) {
|
19294 | return this.send('PUT', '/ciphers/' + id + '/collections', request, true, false);
|
19295 | }
|
19296 | putCipherCollectionsAdmin(id, request) {
|
19297 | return this.send('PUT', '/ciphers/' + id + '/collections-admin', request, true, false);
|
19298 | }
|
19299 | postPurgeCiphers(request, organizationId = null) {
|
19300 | let path = '/ciphers/purge';
|
19301 | if (organizationId != null) {
|
19302 | path += '?organizationId=' + organizationId;
|
19303 | }
|
19304 | return this.send('POST', path, request, true, false);
|
19305 | }
|
19306 | postImportCiphers(request) {
|
19307 | return this.send('POST', '/ciphers/import', request, true, false);
|
19308 | }
|
19309 | postImportOrganizationCiphers(organizationId, request) {
|
19310 | return this.send('POST', '/ciphers/import-organization?organizationId=' + organizationId, request, true, false);
|
19311 | }
|
19312 | putDeleteCipher(id) {
|
19313 | return this.send('PUT', '/ciphers/' + id + '/delete', null, true, false);
|
19314 | }
|
19315 | putDeleteCipherAdmin(id) {
|
19316 | return this.send('PUT', '/ciphers/' + id + '/delete-admin', null, true, false);
|
19317 | }
|
19318 | putDeleteManyCiphers(request) {
|
19319 | return this.send('PUT', '/ciphers/delete', request, true, false);
|
19320 | }
|
19321 | putRestoreCipher(id) {
|
19322 | return this.send('PUT', '/ciphers/' + id + '/restore', null, true, false);
|
19323 | }
|
19324 | putRestoreCipherAdmin(id) {
|
19325 | return this.send('PUT', '/ciphers/' + id + '/restore-admin', null, true, false);
|
19326 | }
|
19327 | putRestoreManyCiphers(request) {
|
19328 | return this.send('PUT', '/ciphers/restore', request, true, false);
|
19329 | }
|
19330 |
|
19331 | postCipherAttachment(id, data) {
|
19332 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19333 | const r = yield this.send('POST', '/ciphers/' + id + '/attachment', data, true, true);
|
19334 | return new cipherResponse_CipherResponse(r);
|
19335 | });
|
19336 | }
|
19337 | postCipherAttachmentAdmin(id, data) {
|
19338 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19339 | const r = yield this.send('POST', '/ciphers/' + id + '/attachment-admin', data, true, true);
|
19340 | return new cipherResponse_CipherResponse(r);
|
19341 | });
|
19342 | }
|
19343 | deleteCipherAttachment(id, attachmentId) {
|
19344 | return this.send('DELETE', '/ciphers/' + id + '/attachment/' + attachmentId, null, true, false);
|
19345 | }
|
19346 | deleteCipherAttachmentAdmin(id, attachmentId) {
|
19347 | return this.send('DELETE', '/ciphers/' + id + '/attachment/' + attachmentId + '/admin', null, true, false);
|
19348 | }
|
19349 | postShareCipherAttachment(id, attachmentId, data, organizationId) {
|
19350 | return this.send('POST', '/ciphers/' + id + '/attachment/' +
|
19351 | attachmentId + '/share?organizationId=' + organizationId, data, true, false);
|
19352 | }
|
19353 |
|
19354 | getCollectionDetails(organizationId, id) {
|
19355 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19356 | const r = yield this.send('GET', '/organizations/' + organizationId + '/collections/' + id + '/details', null, true, true);
|
19357 | return new collectionResponse_CollectionGroupDetailsResponse(r);
|
19358 | });
|
19359 | }
|
19360 | getUserCollections() {
|
19361 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19362 | const r = yield this.send('GET', '/collections', null, true, true);
|
19363 | return new listResponse_ListResponse(r, collectionResponse_CollectionResponse);
|
19364 | });
|
19365 | }
|
19366 | getCollections(organizationId) {
|
19367 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19368 | const r = yield this.send('GET', '/organizations/' + organizationId + '/collections', null, true, true);
|
19369 | return new listResponse_ListResponse(r, collectionResponse_CollectionResponse);
|
19370 | });
|
19371 | }
|
19372 | getCollectionUsers(organizationId, id) {
|
19373 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19374 | const r = yield this.send('GET', '/organizations/' + organizationId + '/collections/' + id + '/users', null, true, true);
|
19375 | return r.map((dr) => new selectionReadOnlyResponse_SelectionReadOnlyResponse(dr));
|
19376 | });
|
19377 | }
|
19378 | postCollection(organizationId, request) {
|
19379 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19380 | const r = yield this.send('POST', '/organizations/' + organizationId + '/collections', request, true, true);
|
19381 | return new collectionResponse_CollectionResponse(r);
|
19382 | });
|
19383 | }
|
19384 | putCollection(organizationId, id, request) {
|
19385 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19386 | const r = yield this.send('PUT', '/organizations/' + organizationId + '/collections/' + id, request, true, true);
|
19387 | return new collectionResponse_CollectionResponse(r);
|
19388 | });
|
19389 | }
|
19390 | putCollectionUsers(organizationId, id, request) {
|
19391 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19392 | yield this.send('PUT', '/organizations/' + organizationId + '/collections/' + id + '/users', request, true, false);
|
19393 | });
|
19394 | }
|
19395 | deleteCollection(organizationId, id) {
|
19396 | return this.send('DELETE', '/organizations/' + organizationId + '/collections/' + id, null, true, false);
|
19397 | }
|
19398 | deleteCollectionUser(organizationId, id, organizationUserId) {
|
19399 | return this.send('DELETE', '/organizations/' + organizationId + '/collections/' + id + '/user/' + organizationUserId, null, true, false);
|
19400 | }
|
19401 |
|
19402 | getGroupDetails(organizationId, id) {
|
19403 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19404 | const r = yield this.send('GET', '/organizations/' + organizationId + '/groups/' + id + '/details', null, true, true);
|
19405 | return new groupResponse_GroupDetailsResponse(r);
|
19406 | });
|
19407 | }
|
19408 | getGroups(organizationId) {
|
19409 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19410 | const r = yield this.send('GET', '/organizations/' + organizationId + '/groups', null, true, true);
|
19411 | return new listResponse_ListResponse(r, groupResponse_GroupResponse);
|
19412 | });
|
19413 | }
|
19414 | getGroupUsers(organizationId, id) {
|
19415 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19416 | const r = yield this.send('GET', '/organizations/' + organizationId + '/groups/' + id + '/users', null, true, true);
|
19417 | return r;
|
19418 | });
|
19419 | }
|
19420 | postGroup(organizationId, request) {
|
19421 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19422 | const r = yield this.send('POST', '/organizations/' + organizationId + '/groups', request, true, true);
|
19423 | return new groupResponse_GroupResponse(r);
|
19424 | });
|
19425 | }
|
19426 | putGroup(organizationId, id, request) {
|
19427 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19428 | const r = yield this.send('PUT', '/organizations/' + organizationId + '/groups/' + id, request, true, true);
|
19429 | return new groupResponse_GroupResponse(r);
|
19430 | });
|
19431 | }
|
19432 | putGroupUsers(organizationId, id, request) {
|
19433 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19434 | yield this.send('PUT', '/organizations/' + organizationId + '/groups/' + id + '/users', request, true, false);
|
19435 | });
|
19436 | }
|
19437 | deleteGroup(organizationId, id) {
|
19438 | return this.send('DELETE', '/organizations/' + organizationId + '/groups/' + id, null, true, false);
|
19439 | }
|
19440 | deleteGroupUser(organizationId, id, organizationUserId) {
|
19441 | return this.send('DELETE', '/organizations/' + organizationId + '/groups/' + id + '/user/' + organizationUserId, null, true, false);
|
19442 | }
|
19443 |
|
19444 | getPolicy(organizationId, type) {
|
19445 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19446 | const r = yield this.send('GET', '/organizations/' + organizationId + '/policies/' + type, null, true, true);
|
19447 | return new policyResponse_PolicyResponse(r);
|
19448 | });
|
19449 | }
|
19450 | getPolicies(organizationId) {
|
19451 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19452 | const r = yield this.send('GET', '/organizations/' + organizationId + '/policies', null, true, true);
|
19453 | return new listResponse_ListResponse(r, policyResponse_PolicyResponse);
|
19454 | });
|
19455 | }
|
19456 | getPoliciesByToken(organizationId, token, email, organizationUserId) {
|
19457 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19458 | const r = yield this.send('GET', '/organizations/' + organizationId + '/policies/token?' +
|
19459 | 'token=' + encodeURIComponent(token) + '&email=' + encodeURIComponent(email) +
|
19460 | '&organizationUserId=' + organizationUserId, null, false, true);
|
19461 | return new listResponse_ListResponse(r, policyResponse_PolicyResponse);
|
19462 | });
|
19463 | }
|
19464 | putPolicy(organizationId, type, request) {
|
19465 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19466 | const r = yield this.send('PUT', '/organizations/' + organizationId + '/policies/' + type, request, true, true);
|
19467 | return new policyResponse_PolicyResponse(r);
|
19468 | });
|
19469 | }
|
19470 |
|
19471 | getOrganizationUser(organizationId, id) {
|
19472 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19473 | const r = yield this.send('GET', '/organizations/' + organizationId + '/users/' + id, null, true, true);
|
19474 | return new organizationUserResponse_OrganizationUserDetailsResponse(r);
|
19475 | });
|
19476 | }
|
19477 | getOrganizationUserGroups(organizationId, id) {
|
19478 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19479 | const r = yield this.send('GET', '/organizations/' + organizationId + '/users/' + id + '/groups', null, true, true);
|
19480 | return r;
|
19481 | });
|
19482 | }
|
19483 | getOrganizationUsers(organizationId) {
|
19484 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19485 | const r = yield this.send('GET', '/organizations/' + organizationId + '/users', null, true, true);
|
19486 | return new listResponse_ListResponse(r, OrganizationUserUserDetailsResponse);
|
19487 | });
|
19488 | }
|
19489 | postOrganizationUserInvite(organizationId, request) {
|
19490 | return this.send('POST', '/organizations/' + organizationId + '/users/invite', request, true, false);
|
19491 | }
|
19492 | postOrganizationUserReinvite(organizationId, id) {
|
19493 | return this.send('POST', '/organizations/' + organizationId + '/users/' + id + '/reinvite', null, true, false);
|
19494 | }
|
19495 | postOrganizationUserAccept(organizationId, id, request) {
|
19496 | return this.send('POST', '/organizations/' + organizationId + '/users/' + id + '/accept', request, true, false);
|
19497 | }
|
19498 | postOrganizationUserConfirm(organizationId, id, request) {
|
19499 | return this.send('POST', '/organizations/' + organizationId + '/users/' + id + '/confirm', request, true, false);
|
19500 | }
|
19501 | putOrganizationUser(organizationId, id, request) {
|
19502 | return this.send('PUT', '/organizations/' + organizationId + '/users/' + id, request, true, false);
|
19503 | }
|
19504 | putOrganizationUserGroups(organizationId, id, request) {
|
19505 | return this.send('PUT', '/organizations/' + organizationId + '/users/' + id + '/groups', request, true, false);
|
19506 | }
|
19507 | deleteOrganizationUser(organizationId, id) {
|
19508 | return this.send('DELETE', '/organizations/' + organizationId + '/users/' + id, null, true, false);
|
19509 | }
|
19510 |
|
19511 | getSync() {
|
19512 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19513 | const path = this.isDesktopClient || this.isWebClient ? '/sync?excludeDomains=true' : '/sync';
|
19514 | const r = yield this.send('GET', path, null, true, true);
|
19515 | return new syncResponse_SyncResponse(r);
|
19516 | });
|
19517 | }
|
19518 | postImportDirectory(organizationId, request) {
|
19519 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19520 | return this.send('POST', '/organizations/' + organizationId + '/import', request, true, false);
|
19521 | });
|
19522 | }
|
19523 |
|
19524 | getSettingsDomains() {
|
19525 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19526 | const r = yield this.send('GET', '/settings/domains', null, true, true);
|
19527 | return new domainsResponse_DomainsResponse(r);
|
19528 | });
|
19529 | }
|
19530 | putSettingsDomains(request) {
|
19531 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19532 | const r = yield this.send('PUT', '/settings/domains', request, true, true);
|
19533 | return new domainsResponse_DomainsResponse(r);
|
19534 | });
|
19535 | }
|
19536 |
|
19537 | getTwoFactorProviders() {
|
19538 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19539 | const r = yield this.send('GET', '/two-factor', null, true, true);
|
19540 | return new listResponse_ListResponse(r, twoFactorProviderResponse_TwoFactorProviderResponse);
|
19541 | });
|
19542 | }
|
19543 | getTwoFactorOrganizationProviders(organizationId) {
|
19544 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19545 | const r = yield this.send('GET', '/organizations/' + organizationId + '/two-factor', null, true, true);
|
19546 | return new listResponse_ListResponse(r, twoFactorProviderResponse_TwoFactorProviderResponse);
|
19547 | });
|
19548 | }
|
19549 | getTwoFactorAuthenticator(request) {
|
19550 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19551 | const r = yield this.send('POST', '/two-factor/get-authenticator', request, true, true);
|
19552 | return new twoFactorAuthenticatorResponse_TwoFactorAuthenticatorResponse(r);
|
19553 | });
|
19554 | }
|
19555 | getTwoFactorEmail(request) {
|
19556 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19557 | const r = yield this.send('POST', '/two-factor/get-email', request, true, true);
|
19558 | return new twoFactorEmailResponse_TwoFactorEmailResponse(r);
|
19559 | });
|
19560 | }
|
19561 | getTwoFactorDuo(request) {
|
19562 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19563 | const r = yield this.send('POST', '/two-factor/get-duo', request, true, true);
|
19564 | return new twoFactorDuoResponse_TwoFactorDuoResponse(r);
|
19565 | });
|
19566 | }
|
19567 | getTwoFactorOrganizationDuo(organizationId, request) {
|
19568 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19569 | const r = yield this.send('POST', '/organizations/' + organizationId + '/two-factor/get-duo', request, true, true);
|
19570 | return new twoFactorDuoResponse_TwoFactorDuoResponse(r);
|
19571 | });
|
19572 | }
|
19573 | getTwoFactorYubiKey(request) {
|
19574 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19575 | const r = yield this.send('POST', '/two-factor/get-yubikey', request, true, true);
|
19576 | return new twoFactorYubiKeyResponse_TwoFactorYubiKeyResponse(r);
|
19577 | });
|
19578 | }
|
19579 | getTwoFactorU2f(request) {
|
19580 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19581 | const r = yield this.send('POST', '/two-factor/get-u2f', request, true, true);
|
19582 | return new twoFactorU2fResponse_TwoFactorU2fResponse(r);
|
19583 | });
|
19584 | }
|
19585 | getTwoFactorU2fChallenge(request) {
|
19586 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19587 | const r = yield this.send('POST', '/two-factor/get-u2f-challenge', request, true, true);
|
19588 | return new twoFactorU2fResponse_ChallengeResponse(r);
|
19589 | });
|
19590 | }
|
19591 | getTwoFactorRecover(request) {
|
19592 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19593 | const r = yield this.send('POST', '/two-factor/get-recover', request, true, true);
|
19594 | return new twoFactorRescoverResponse_TwoFactorRecoverResponse(r);
|
19595 | });
|
19596 | }
|
19597 | putTwoFactorAuthenticator(request) {
|
19598 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19599 | const r = yield this.send('PUT', '/two-factor/authenticator', request, true, true);
|
19600 | return new twoFactorAuthenticatorResponse_TwoFactorAuthenticatorResponse(r);
|
19601 | });
|
19602 | }
|
19603 | putTwoFactorEmail(request) {
|
19604 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19605 | const r = yield this.send('PUT', '/two-factor/email', request, true, true);
|
19606 | return new twoFactorEmailResponse_TwoFactorEmailResponse(r);
|
19607 | });
|
19608 | }
|
19609 | putTwoFactorDuo(request) {
|
19610 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19611 | const r = yield this.send('PUT', '/two-factor/duo', request, true, true);
|
19612 | return new twoFactorDuoResponse_TwoFactorDuoResponse(r);
|
19613 | });
|
19614 | }
|
19615 | putTwoFactorOrganizationDuo(organizationId, request) {
|
19616 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19617 | const r = yield this.send('PUT', '/organizations/' + organizationId + '/two-factor/duo', request, true, true);
|
19618 | return new twoFactorDuoResponse_TwoFactorDuoResponse(r);
|
19619 | });
|
19620 | }
|
19621 | putTwoFactorYubiKey(request) {
|
19622 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19623 | const r = yield this.send('PUT', '/two-factor/yubikey', request, true, true);
|
19624 | return new twoFactorYubiKeyResponse_TwoFactorYubiKeyResponse(r);
|
19625 | });
|
19626 | }
|
19627 | putTwoFactorU2f(request) {
|
19628 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19629 | const r = yield this.send('PUT', '/two-factor/u2f', request, true, true);
|
19630 | return new twoFactorU2fResponse_TwoFactorU2fResponse(r);
|
19631 | });
|
19632 | }
|
19633 | deleteTwoFactorU2f(request) {
|
19634 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19635 | const r = yield this.send('DELETE', '/two-factor/u2f', request, true, true);
|
19636 | return new twoFactorU2fResponse_TwoFactorU2fResponse(r);
|
19637 | });
|
19638 | }
|
19639 | putTwoFactorDisable(request) {
|
19640 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19641 | const r = yield this.send('PUT', '/two-factor/disable', request, true, true);
|
19642 | return new twoFactorProviderResponse_TwoFactorProviderResponse(r);
|
19643 | });
|
19644 | }
|
19645 | putTwoFactorOrganizationDisable(organizationId, request) {
|
19646 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19647 | const r = yield this.send('PUT', '/organizations/' + organizationId + '/two-factor/disable', request, true, true);
|
19648 | return new twoFactorProviderResponse_TwoFactorProviderResponse(r);
|
19649 | });
|
19650 | }
|
19651 | postTwoFactorRecover(request) {
|
19652 | return this.send('POST', '/two-factor/recover', request, false, false);
|
19653 | }
|
19654 | postTwoFactorEmailSetup(request) {
|
19655 | return this.send('POST', '/two-factor/send-email', request, true, false);
|
19656 | }
|
19657 | postTwoFactorEmail(request) {
|
19658 | return this.send('POST', '/two-factor/send-email-login', request, false, false);
|
19659 | }
|
19660 |
|
19661 | getOrganization(id) {
|
19662 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19663 | const r = yield this.send('GET', '/organizations/' + id, null, true, true);
|
19664 | return new organizationResponse_OrganizationResponse(r);
|
19665 | });
|
19666 | }
|
19667 | getOrganizationBilling(id) {
|
19668 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19669 | const r = yield this.send('GET', '/organizations/' + id + '/billing', null, true, true);
|
19670 | return new billingResponse_BillingResponse(r);
|
19671 | });
|
19672 | }
|
19673 | getOrganizationSubscription(id) {
|
19674 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19675 | const r = yield this.send('GET', '/organizations/' + id + '/subscription', null, true, true);
|
19676 | return new organizationSubscriptionResponse_OrganizationSubscriptionResponse(r);
|
19677 | });
|
19678 | }
|
19679 | getOrganizationLicense(id, installationId) {
|
19680 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19681 | return this.send('GET', '/organizations/' + id + '/license?installationId=' + installationId, null, true, true);
|
19682 | });
|
19683 | }
|
19684 | postOrganization(request) {
|
19685 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19686 | const r = yield this.send('POST', '/organizations', request, true, true);
|
19687 | return new organizationResponse_OrganizationResponse(r);
|
19688 | });
|
19689 | }
|
19690 | putOrganization(id, request) {
|
19691 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19692 | const r = yield this.send('PUT', '/organizations/' + id, request, true, true);
|
19693 | return new organizationResponse_OrganizationResponse(r);
|
19694 | });
|
19695 | }
|
19696 | postLeaveOrganization(id) {
|
19697 | return this.send('POST', '/organizations/' + id + '/leave', null, true, false);
|
19698 | }
|
19699 | postOrganizationLicense(data) {
|
19700 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19701 | const r = yield this.send('POST', '/organizations/license', data, true, true);
|
19702 | return new organizationResponse_OrganizationResponse(r);
|
19703 | });
|
19704 | }
|
19705 | postOrganizationLicenseUpdate(id, data) {
|
19706 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19707 | return this.send('POST', '/organizations/' + id + '/license', data, true, false);
|
19708 | });
|
19709 | }
|
19710 | postOrganizationApiKey(id, request) {
|
19711 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19712 | const r = yield this.send('POST', '/organizations/' + id + '/api-key', request, true, true);
|
19713 | return new apiKeyResponse_ApiKeyResponse(r);
|
19714 | });
|
19715 | }
|
19716 | postOrganizationRotateApiKey(id, request) {
|
19717 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19718 | const r = yield this.send('POST', '/organizations/' + id + '/rotate-api-key', request, true, true);
|
19719 | return new apiKeyResponse_ApiKeyResponse(r);
|
19720 | });
|
19721 | }
|
19722 | postOrganizationUpgrade(id, request) {
|
19723 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19724 | const r = yield this.send('POST', '/organizations/' + id + '/upgrade', request, true, true);
|
19725 | return new paymentResponse_PaymentResponse(r);
|
19726 | });
|
19727 | }
|
19728 | postOrganizationSeat(id, request) {
|
19729 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19730 | const r = yield this.send('POST', '/organizations/' + id + '/seat', request, true, true);
|
19731 | return new paymentResponse_PaymentResponse(r);
|
19732 | });
|
19733 | }
|
19734 | postOrganizationStorage(id, request) {
|
19735 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19736 | const r = yield this.send('POST', '/organizations/' + id + '/storage', request, true, true);
|
19737 | return new paymentResponse_PaymentResponse(r);
|
19738 | });
|
19739 | }
|
19740 | postOrganizationPayment(id, request) {
|
19741 | return this.send('POST', '/organizations/' + id + '/payment', request, true, false);
|
19742 | }
|
19743 | postOrganizationVerifyBank(id, request) {
|
19744 | return this.send('POST', '/organizations/' + id + '/verify-bank', request, true, false);
|
19745 | }
|
19746 | postOrganizationCancel(id) {
|
19747 | return this.send('POST', '/organizations/' + id + '/cancel', null, true, false);
|
19748 | }
|
19749 | postOrganizationReinstate(id) {
|
19750 | return this.send('POST', '/organizations/' + id + '/reinstate', null, true, false);
|
19751 | }
|
19752 | deleteOrganization(id, request) {
|
19753 | return this.send('DELETE', '/organizations/' + id, request, true, false);
|
19754 | }
|
19755 |
|
19756 | getEvents(start, end, token) {
|
19757 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19758 | const r = yield this.send('GET', this.addEventParameters('/events', start, end, token), null, true, true);
|
19759 | return new listResponse_ListResponse(r, eventResponse_EventResponse);
|
19760 | });
|
19761 | }
|
19762 | getEventsCipher(id, start, end, token) {
|
19763 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19764 | const r = yield this.send('GET', this.addEventParameters('/ciphers/' + id + '/events', start, end, token), null, true, true);
|
19765 | return new listResponse_ListResponse(r, eventResponse_EventResponse);
|
19766 | });
|
19767 | }
|
19768 | getEventsOrganization(id, start, end, token) {
|
19769 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19770 | const r = yield this.send('GET', this.addEventParameters('/organizations/' + id + '/events', start, end, token), null, true, true);
|
19771 | return new listResponse_ListResponse(r, eventResponse_EventResponse);
|
19772 | });
|
19773 | }
|
19774 | getEventsOrganizationUser(organizationId, id, start, end, token) {
|
19775 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19776 | const r = yield this.send('GET', this.addEventParameters('/organizations/' + organizationId + '/users/' + id + '/events', start, end, token), null, true, true);
|
19777 | return new listResponse_ListResponse(r, eventResponse_EventResponse);
|
19778 | });
|
19779 | }
|
19780 | postEventsCollect(request) {
|
19781 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19782 | const authHeader = yield this.getActiveBearerToken();
|
19783 | const headers = new Headers({
|
19784 | 'Device-Type': this.deviceType,
|
19785 | 'Authorization': 'Bearer ' + authHeader,
|
19786 | 'Content-Type': 'application/json; charset=utf-8',
|
19787 | });
|
19788 | if (this.customUserAgent != null) {
|
19789 | headers.set('User-Agent', this.customUserAgent);
|
19790 | }
|
19791 | const response = yield this.fetch(new Request(this.eventsBaseUrl + '/collect', {
|
19792 | cache: 'no-store',
|
19793 | credentials: this.getCredentials(),
|
19794 | method: 'POST',
|
19795 | body: JSON.stringify(request),
|
19796 | headers: headers,
|
19797 | }));
|
19798 | if (response.status !== 200) {
|
19799 | return Promise.reject('Event post failed.');
|
19800 | }
|
19801 | });
|
19802 | }
|
19803 |
|
19804 | getUserPublicKey(id) {
|
19805 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19806 | const r = yield this.send('GET', '/users/' + id + '/public-key', null, true, true);
|
19807 | return new userKeyResponse_UserKeyResponse(r);
|
19808 | });
|
19809 | }
|
19810 |
|
19811 | getHibpBreach(username) {
|
19812 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19813 | const r = yield this.send('GET', '/hibp/breach?username=' + username, null, true, true);
|
19814 | return r.map((a) => new breachAccountResponse_BreachAccountResponse(a));
|
19815 | });
|
19816 | }
|
19817 |
|
19818 | postBitPayInvoice(request) {
|
19819 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19820 | const r = yield this.send('POST', '/bitpay-invoice', request, true, true);
|
19821 | return r;
|
19822 | });
|
19823 | }
|
19824 | postSetupPayment() {
|
19825 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19826 | const r = yield this.send('POST', '/setup-payment', null, true, true);
|
19827 | return r;
|
19828 | });
|
19829 | }
|
19830 |
|
19831 | getActiveBearerToken() {
|
19832 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19833 | let accessToken = yield this.tokenService.getToken();
|
19834 | if (this.tokenService.tokenNeedsRefresh()) {
|
19835 | const tokenResponse = yield this.doRefreshToken();
|
19836 | accessToken = tokenResponse.accessToken;
|
19837 | }
|
19838 | return accessToken;
|
19839 | });
|
19840 | }
|
19841 | fetch(request) {
|
19842 | if (request.method === 'GET') {
|
19843 | request.headers.set('Cache-Control', 'no-store');
|
19844 | request.headers.set('Pragma', 'no-cache');
|
19845 | }
|
19846 | return this.nativeFetch(request);
|
19847 | }
|
19848 | nativeFetch(request) {
|
19849 | return fetch(request);
|
19850 | }
|
19851 | send(method, path, body, authed, hasResponse) {
|
19852 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19853 | const headers = new Headers({
|
19854 | 'Device-Type': this.deviceType,
|
19855 | });
|
19856 | if (this.customUserAgent != null) {
|
19857 | headers.set('User-Agent', this.customUserAgent);
|
19858 | }
|
19859 | const requestInit = {
|
19860 | cache: 'no-store',
|
19861 | credentials: this.getCredentials(),
|
19862 | method: method,
|
19863 | };
|
19864 | if (authed) {
|
19865 | const authHeader = yield this.getActiveBearerToken();
|
19866 | headers.set('Authorization', 'Bearer ' + authHeader);
|
19867 | }
|
19868 | if (body != null) {
|
19869 | if (typeof body === 'string') {
|
19870 | requestInit.body = body;
|
19871 | headers.set('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8');
|
19872 | }
|
19873 | else if (typeof body === 'object') {
|
19874 | if (body instanceof FormData) {
|
19875 | requestInit.body = body;
|
19876 | }
|
19877 | else {
|
19878 | headers.set('Content-Type', 'application/json; charset=utf-8');
|
19879 | requestInit.body = JSON.stringify(body);
|
19880 | }
|
19881 | }
|
19882 | }
|
19883 | if (hasResponse) {
|
19884 | headers.set('Accept', 'application/json');
|
19885 | }
|
19886 | requestInit.headers = headers;
|
19887 | const response = yield this.fetch(new Request(this.apiBaseUrl + path, requestInit));
|
19888 | if (hasResponse && response.status === 200) {
|
19889 | const responseJson = yield response.json();
|
19890 | return responseJson;
|
19891 | }
|
19892 | else if (response.status !== 200) {
|
19893 | const error = yield this.handleError(response, false);
|
19894 | return Promise.reject(error);
|
19895 | }
|
19896 | });
|
19897 | }
|
19898 | handleError(response, tokenError) {
|
19899 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19900 | if ((tokenError && response.status === 400) || response.status === 401 || response.status === 403) {
|
19901 | yield this.logoutCallback(true);
|
19902 | return null;
|
19903 | }
|
19904 | let responseJson = null;
|
19905 | if (this.isJsonResponse(response)) {
|
19906 | responseJson = yield response.json();
|
19907 | }
|
19908 | return new errorResponse_ErrorResponse(responseJson, response.status, tokenError);
|
19909 | });
|
19910 | }
|
19911 | doRefreshToken() {
|
19912 | return api_service_awaiter(this, void 0, void 0, function* () {
|
19913 | const refreshToken = yield this.tokenService.getRefreshToken();
|
19914 | if (refreshToken == null || refreshToken === '') {
|
19915 | throw new Error();
|
19916 | }
|
19917 | const headers = new Headers({
|
19918 | 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8',
|
19919 | 'Accept': 'application/json',
|
19920 | 'Device-Type': this.deviceType,
|
19921 | });
|
19922 | if (this.customUserAgent != null) {
|
19923 | headers.set('User-Agent', this.customUserAgent);
|
19924 | }
|
19925 | const decodedToken = this.tokenService.decodeToken();
|
19926 | const response = yield this.fetch(new Request(this.identityBaseUrl + '/connect/token', {
|
19927 | body: this.qsStringify({
|
19928 | grant_type: 'refresh_token',
|
19929 | client_id: decodedToken.client_id,
|
19930 | refresh_token: refreshToken,
|
19931 | }),
|
19932 | cache: 'no-store',
|
19933 | credentials: this.getCredentials(),
|
19934 | headers: headers,
|
19935 | method: 'POST',
|
19936 | }));
|
19937 | if (response.status === 200) {
|
19938 | const responseJson = yield response.json();
|
19939 | const tokenResponse = new identityTokenResponse_IdentityTokenResponse(responseJson);
|
19940 | yield this.tokenService.setTokens(tokenResponse.accessToken, tokenResponse.refreshToken);
|
19941 | return tokenResponse;
|
19942 | }
|
19943 | else {
|
19944 | const error = yield this.handleError(response, true);
|
19945 | return Promise.reject(error);
|
19946 | }
|
19947 | });
|
19948 | }
|
19949 | qsStringify(params) {
|
19950 | return Object.keys(params).map((key) => {
|
19951 | return encodeURIComponent(key) + '=' + encodeURIComponent(params[key]);
|
19952 | }).join('&');
|
19953 | }
|
19954 | getCredentials() {
|
19955 | if (this.device !== DeviceType.SafariExtension && (!this.isWebClient || this.usingBaseUrl)) {
|
19956 | return 'include';
|
19957 | }
|
19958 | return undefined;
|
19959 | }
|
19960 | addEventParameters(base, start, end, token) {
|
19961 | if (start != null) {
|
19962 | base += ('?start=' + start);
|
19963 | }
|
19964 | if (end != null) {
|
19965 | base += (base.indexOf('?') > -1 ? '&' : '?');
|
19966 | base += ('end=' + end);
|
19967 | }
|
19968 | if (token != null) {
|
19969 | base += (base.indexOf('?') > -1 ? '&' : '?');
|
19970 | base += ('continuationToken=' + token);
|
19971 | }
|
19972 | return base;
|
19973 | }
|
19974 | isJsonResponse(response) {
|
19975 | const typeHeader = response.headers.get('content-type');
|
19976 | return typeHeader != null && typeHeader.indexOf('application/json') > -1;
|
19977 | }
|
19978 | }
|
19979 |
|
19980 |
|
19981 |
|
19982 |
|
19983 |
|
19984 |
|
19985 | global.fetch = external_node_fetch_default.a;
|
19986 | global.Request = external_node_fetch_["Request"];
|
19987 | global.Response = external_node_fetch_["Response"];
|
19988 | global.Headers = external_node_fetch_["Headers"];
|
19989 | global.FormData = external_form_data_;
|
19990 | class nodeApi_service_NodeApiService extends api_service_ApiService {
|
19991 | constructor(tokenService, platformUtilsService, logoutCallback, customUserAgent = null) {
|
19992 | super(tokenService, platformUtilsService, logoutCallback, customUserAgent);
|
19993 | }
|
19994 | nativeFetch(request) {
|
19995 | const proxy = process.env.http_proxy || process.env.https_proxy;
|
19996 | if (proxy) {
|
19997 | request.agent = new external_https_proxy_agent_(proxy);
|
19998 | }
|
19999 | return fetch(request);
|
20000 | }
|
20001 | }
|
20002 |
|
20003 |
|
20004 | var external_crypto_ = __webpack_require__(6);
|
20005 |
|
20006 |
|
20007 | var external_node_forge_ = __webpack_require__(2);
|
20008 |
|
20009 |
|
20010 | class DecryptParameters {
|
20011 | }
|
20012 |
|
20013 |
|
20014 | var nodeCryptoFunction_service_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
20015 | return new (P || (P = Promise))(function (resolve, reject) {
|
20016 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
20017 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
20018 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
20019 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
20020 | });
|
20021 | };
|
20022 |
|
20023 |
|
20024 |
|
20025 |
|
20026 | class nodeCryptoFunction_service_NodeCryptoFunctionService {
|
20027 | pbkdf2(password, salt, algorithm, iterations) {
|
20028 | const len = algorithm === 'sha256' ? 32 : 64;
|
20029 | const nodePassword = this.toNodeValue(password);
|
20030 | const nodeSalt = this.toNodeValue(salt);
|
20031 | return new Promise((resolve, reject) => {
|
20032 | external_crypto_["pbkdf2"](nodePassword, nodeSalt, iterations, len, algorithm, (error, key) => {
|
20033 | if (error != null) {
|
20034 | reject(error);
|
20035 | }
|
20036 | else {
|
20037 | resolve(this.toArrayBuffer(key));
|
20038 | }
|
20039 | });
|
20040 | });
|
20041 | }
|
20042 | hash(value, algorithm) {
|
20043 | const nodeValue = this.toNodeValue(value);
|
20044 | const hash = external_crypto_["createHash"](algorithm);
|
20045 | hash.update(nodeValue);
|
20046 | return Promise.resolve(this.toArrayBuffer(hash.digest()));
|
20047 | }
|
20048 | hmac(value, key, algorithm) {
|
20049 | const nodeValue = this.toNodeBuffer(value);
|
20050 | const nodeKey = this.toNodeBuffer(key);
|
20051 | const hmac = external_crypto_["createHmac"](algorithm, nodeKey);
|
20052 | hmac.update(nodeValue);
|
20053 | return Promise.resolve(this.toArrayBuffer(hmac.digest()));
|
20054 | }
|
20055 | compare(a, b) {
|
20056 | return nodeCryptoFunction_service_awaiter(this, void 0, void 0, function* () {
|
20057 | const key = yield this.randomBytes(32);
|
20058 | const mac1 = yield this.hmac(a, key, 'sha256');
|
20059 | const mac2 = yield this.hmac(b, key, 'sha256');
|
20060 | if (mac1.byteLength !== mac2.byteLength) {
|
20061 | return false;
|
20062 | }
|
20063 | const arr1 = new Uint8Array(mac1);
|
20064 | const arr2 = new Uint8Array(mac2);
|
20065 | for (let i = 0; i < arr2.length; i++) {
|
20066 | if (arr1[i] !== arr2[i]) {
|
20067 | return false;
|
20068 | }
|
20069 | }
|
20070 | return true;
|
20071 | });
|
20072 | }
|
20073 | hmacFast(value, key, algorithm) {
|
20074 | return this.hmac(value, key, algorithm);
|
20075 | }
|
20076 | compareFast(a, b) {
|
20077 | return this.compare(a, b);
|
20078 | }
|
20079 | aesEncrypt(data, iv, key) {
|
20080 | const nodeData = this.toNodeBuffer(data);
|
20081 | const nodeIv = this.toNodeBuffer(iv);
|
20082 | const nodeKey = this.toNodeBuffer(key);
|
20083 | const cipher = external_crypto_["createCipheriv"]('aes-256-cbc', nodeKey, nodeIv);
|
20084 | const encBuf = Buffer.concat([cipher.update(nodeData), cipher.final()]);
|
20085 | return Promise.resolve(this.toArrayBuffer(encBuf));
|
20086 | }
|
20087 | aesDecryptFastParameters(data, iv, mac, key) {
|
20088 | const p = new DecryptParameters();
|
20089 | p.encKey = key.encKey;
|
20090 | p.data = utils_Utils.fromB64ToArray(data).buffer;
|
20091 | p.iv = utils_Utils.fromB64ToArray(iv).buffer;
|
20092 | const macData = new Uint8Array(p.iv.byteLength + p.data.byteLength);
|
20093 | macData.set(new Uint8Array(p.iv), 0);
|
20094 | macData.set(new Uint8Array(p.data), p.iv.byteLength);
|
20095 | p.macData = macData.buffer;
|
20096 | if (key.macKey != null) {
|
20097 | p.macKey = key.macKey;
|
20098 | }
|
20099 | if (mac != null) {
|
20100 | p.mac = utils_Utils.fromB64ToArray(mac).buffer;
|
20101 | }
|
20102 | return p;
|
20103 | }
|
20104 | aesDecryptFast(parameters) {
|
20105 | return nodeCryptoFunction_service_awaiter(this, void 0, void 0, function* () {
|
20106 | const decBuf = yield this.aesDecrypt(parameters.data, parameters.iv, parameters.encKey);
|
20107 | return utils_Utils.fromBufferToUtf8(decBuf);
|
20108 | });
|
20109 | }
|
20110 | aesDecrypt(data, iv, key) {
|
20111 | const nodeData = this.toNodeBuffer(data);
|
20112 | const nodeIv = this.toNodeBuffer(iv);
|
20113 | const nodeKey = this.toNodeBuffer(key);
|
20114 | const decipher = external_crypto_["createDecipheriv"]('aes-256-cbc', nodeKey, nodeIv);
|
20115 | const decBuf = Buffer.concat([decipher.update(nodeData), decipher.final()]);
|
20116 | return Promise.resolve(this.toArrayBuffer(decBuf));
|
20117 | }
|
20118 | rsaEncrypt(data, publicKey, algorithm) {
|
20119 | if (algorithm === 'sha256') {
|
20120 | throw new Error('Node crypto does not support RSA-OAEP SHA-256');
|
20121 | }
|
20122 | const pem = this.toPemPublicKey(publicKey);
|
20123 | const decipher = external_crypto_["publicEncrypt"](pem, this.toNodeBuffer(data));
|
20124 | return Promise.resolve(this.toArrayBuffer(decipher));
|
20125 | }
|
20126 | rsaDecrypt(data, privateKey, algorithm) {
|
20127 | if (algorithm === 'sha256') {
|
20128 | throw new Error('Node crypto does not support RSA-OAEP SHA-256');
|
20129 | }
|
20130 | const pem = this.toPemPrivateKey(privateKey);
|
20131 | const decipher = external_crypto_["privateDecrypt"](pem, this.toNodeBuffer(data));
|
20132 | return Promise.resolve(this.toArrayBuffer(decipher));
|
20133 | }
|
20134 | rsaExtractPublicKey(privateKey) {
|
20135 | const privateKeyByteString = utils_Utils.fromBufferToByteString(privateKey);
|
20136 | const privateKeyAsn1 = external_node_forge_["asn1"].fromDer(privateKeyByteString);
|
20137 | const forgePrivateKey = external_node_forge_["pki"].privateKeyFromAsn1(privateKeyAsn1);
|
20138 | const forgePublicKey = external_node_forge_["pki"].setRsaPublicKey(forgePrivateKey.n, forgePrivateKey.e);
|
20139 | const publicKeyAsn1 = external_node_forge_["pki"].publicKeyToAsn1(forgePublicKey);
|
20140 | const publicKeyByteString = external_node_forge_["asn1"].toDer(publicKeyAsn1).data;
|
20141 | const publicKeyArray = utils_Utils.fromByteStringToArray(publicKeyByteString);
|
20142 | return Promise.resolve(publicKeyArray.buffer);
|
20143 | }
|
20144 | rsaGenerateKeyPair(length) {
|
20145 | return nodeCryptoFunction_service_awaiter(this, void 0, void 0, function* () {
|
20146 | return new Promise((resolve, reject) => {
|
20147 | external_node_forge_["pki"].rsa.generateKeyPair({
|
20148 | bits: length,
|
20149 | workers: -1,
|
20150 | e: 0x10001,
|
20151 | }, (error, keyPair) => {
|
20152 | if (error != null) {
|
20153 | reject(error);
|
20154 | return;
|
20155 | }
|
20156 | const publicKeyAsn1 = external_node_forge_["pki"].publicKeyToAsn1(keyPair.publicKey);
|
20157 | const publicKeyByteString = external_node_forge_["asn1"].toDer(publicKeyAsn1).getBytes();
|
20158 | const publicKey = utils_Utils.fromByteStringToArray(publicKeyByteString);
|
20159 | const privateKeyAsn1 = external_node_forge_["pki"].privateKeyToAsn1(keyPair.privateKey);
|
20160 | const privateKeyPkcs8 = external_node_forge_["pki"].wrapRsaPrivateKey(privateKeyAsn1);
|
20161 | const privateKeyByteString = external_node_forge_["asn1"].toDer(privateKeyPkcs8).getBytes();
|
20162 | const privateKey = utils_Utils.fromByteStringToArray(privateKeyByteString);
|
20163 | resolve([publicKey.buffer, privateKey.buffer]);
|
20164 | });
|
20165 | });
|
20166 | });
|
20167 | }
|
20168 | randomBytes(length) {
|
20169 | return new Promise((resolve, reject) => {
|
20170 | external_crypto_["randomBytes"](length, (error, bytes) => {
|
20171 | if (error != null) {
|
20172 | reject(error);
|
20173 | }
|
20174 | else {
|
20175 | resolve(this.toArrayBuffer(bytes));
|
20176 | }
|
20177 | });
|
20178 | });
|
20179 | }
|
20180 | toNodeValue(value) {
|
20181 | let nodeValue;
|
20182 | if (typeof (value) === 'string') {
|
20183 | nodeValue = value;
|
20184 | }
|
20185 | else {
|
20186 | nodeValue = this.toNodeBuffer(value);
|
20187 | }
|
20188 | return nodeValue;
|
20189 | }
|
20190 | toNodeBuffer(value) {
|
20191 | return Buffer.from(new Uint8Array(value));
|
20192 | }
|
20193 | toArrayBuffer(buf) {
|
20194 | return new Uint8Array(buf).buffer;
|
20195 | }
|
20196 | toPemPrivateKey(key) {
|
20197 | const byteString = utils_Utils.fromBufferToByteString(key);
|
20198 | const asn1 = external_node_forge_["asn1"].fromDer(byteString);
|
20199 | const privateKey = external_node_forge_["pki"].privateKeyFromAsn1(asn1);
|
20200 | const rsaPrivateKey = external_node_forge_["pki"].privateKeyToAsn1(privateKey);
|
20201 | const privateKeyInfo = external_node_forge_["pki"].wrapRsaPrivateKey(rsaPrivateKey);
|
20202 | return external_node_forge_["pki"].privateKeyInfoToPem(privateKeyInfo);
|
20203 | }
|
20204 | toPemPublicKey(key) {
|
20205 | const byteString = utils_Utils.fromBufferToByteString(key);
|
20206 | const asn1 = external_node_forge_["asn1"].fromDer(byteString);
|
20207 | const publicKey = external_node_forge_["pki"].publicKeyFromAsn1(asn1);
|
20208 | return external_node_forge_["pki"].publicKeyToPem(publicKey);
|
20209 | }
|
20210 | }
|
20211 |
|
20212 |
|
20213 | class NoopMessagingService {
|
20214 | send(subscriber, arg = {}) {
|
20215 |
|
20216 | }
|
20217 | }
|
20218 |
|
20219 |
|
20220 | var external_zxcvbn_ = __webpack_require__(18);
|
20221 |
|
20222 |
|
20223 |
|
20224 | class passwordGeneratorPolicyOptions_PasswordGeneratorPolicyOptions extends domainBase_Domain {
|
20225 | constructor() {
|
20226 | super(...arguments);
|
20227 | this.defaultType = '';
|
20228 | this.minLength = 0;
|
20229 | this.useUppercase = false;
|
20230 | this.useLowercase = false;
|
20231 | this.useNumbers = false;
|
20232 | this.numberCount = 0;
|
20233 | this.useSpecial = false;
|
20234 | this.specialCount = 0;
|
20235 | this.minNumberWords = 0;
|
20236 | this.capitalize = false;
|
20237 | this.includeNumber = false;
|
20238 | }
|
20239 | inEffect() {
|
20240 | return this.defaultType !== '' ||
|
20241 | this.minLength > 0 ||
|
20242 | this.numberCount > 0 ||
|
20243 | this.specialCount > 0 ||
|
20244 | this.useUppercase ||
|
20245 | this.useLowercase ||
|
20246 | this.useNumbers ||
|
20247 | this.useSpecial ||
|
20248 | this.minNumberWords > 0 ||
|
20249 | this.capitalize ||
|
20250 | this.includeNumber;
|
20251 | }
|
20252 | }
|
20253 |
|
20254 |
|
20255 | var PolicyType;
|
20256 | (function (PolicyType) {
|
20257 | PolicyType[PolicyType["TwoFactorAuthentication"] = 0] = "TwoFactorAuthentication";
|
20258 | PolicyType[PolicyType["MasterPassword"] = 1] = "MasterPassword";
|
20259 | PolicyType[PolicyType["PasswordGenerator"] = 2] = "PasswordGenerator";
|
20260 | })(PolicyType || (PolicyType = {}));
|
20261 |
|
20262 |
|
20263 | var passwordGeneration_service_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
20264 | return new (P || (P = Promise))(function (resolve, reject) {
|
20265 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
20266 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
20267 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
20268 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
20269 | });
|
20270 | };
|
20271 |
|
20272 |
|
20273 |
|
20274 |
|
20275 |
|
20276 |
|
20277 | const DefaultOptions = {
|
20278 | length: 14,
|
20279 | ambiguous: false,
|
20280 | number: true,
|
20281 | minNumber: 1,
|
20282 | uppercase: true,
|
20283 | minUppercase: 0,
|
20284 | lowercase: true,
|
20285 | minLowercase: 0,
|
20286 | special: false,
|
20287 | minSpecial: 1,
|
20288 | type: 'password',
|
20289 | numWords: 3,
|
20290 | wordSeparator: '-',
|
20291 | capitalize: false,
|
20292 | includeNumber: false,
|
20293 | };
|
20294 | const passwordGeneration_service_Keys = {
|
20295 | options: 'passwordGenerationOptions',
|
20296 | history: 'generatedPasswordHistory',
|
20297 | };
|
20298 | const MaxPasswordsInHistory = 100;
|
20299 | class passwordGeneration_service_PasswordGenerationService {
|
20300 | constructor(cryptoService, storageService, policyService) {
|
20301 | this.cryptoService = cryptoService;
|
20302 | this.storageService = storageService;
|
20303 | this.policyService = policyService;
|
20304 | }
|
20305 | generatePassword(options) {
|
20306 | return passwordGeneration_service_awaiter(this, void 0, void 0, function* () {
|
20307 |
|
20308 | const o = Object.assign({}, DefaultOptions, options);
|
20309 | if (o.type === 'passphrase') {
|
20310 | return this.generatePassphrase(options);
|
20311 | }
|
20312 |
|
20313 | this.sanitizePasswordLength(o, true);
|
20314 | const minLength = o.minUppercase + o.minLowercase + o.minNumber + o.minSpecial;
|
20315 | if (o.length < minLength) {
|
20316 | o.length = minLength;
|
20317 | }
|
20318 | const positions = [];
|
20319 | if (o.lowercase && o.minLowercase > 0) {
|
20320 | for (let i = 0; i < o.minLowercase; i++) {
|
20321 | positions.push('l');
|
20322 | }
|
20323 | }
|
20324 | if (o.uppercase && o.minUppercase > 0) {
|
20325 | for (let i = 0; i < o.minUppercase; i++) {
|
20326 | positions.push('u');
|
20327 | }
|
20328 | }
|
20329 | if (o.number && o.minNumber > 0) {
|
20330 | for (let i = 0; i < o.minNumber; i++) {
|
20331 | positions.push('n');
|
20332 | }
|
20333 | }
|
20334 | if (o.special && o.minSpecial > 0) {
|
20335 | for (let i = 0; i < o.minSpecial; i++) {
|
20336 | positions.push('s');
|
20337 | }
|
20338 | }
|
20339 | while (positions.length < o.length) {
|
20340 | positions.push('a');
|
20341 | }
|
20342 |
|
20343 | yield this.shuffleArray(positions);
|
20344 |
|
20345 | let allCharSet = '';
|
20346 | let lowercaseCharSet = 'abcdefghijkmnopqrstuvwxyz';
|
20347 | if (o.ambiguous) {
|
20348 | lowercaseCharSet += 'l';
|
20349 | }
|
20350 | if (o.lowercase) {
|
20351 | allCharSet += lowercaseCharSet;
|
20352 | }
|
20353 | let uppercaseCharSet = 'ABCDEFGHJKLMNPQRSTUVWXYZ';
|
20354 | if (o.ambiguous) {
|
20355 | uppercaseCharSet += 'IO';
|
20356 | }
|
20357 | if (o.uppercase) {
|
20358 | allCharSet += uppercaseCharSet;
|
20359 | }
|
20360 | let numberCharSet = '23456789';
|
20361 | if (o.ambiguous) {
|
20362 | numberCharSet += '01';
|
20363 | }
|
20364 | if (o.number) {
|
20365 | allCharSet += numberCharSet;
|
20366 | }
|
20367 | const specialCharSet = '!@#$%^&*';
|
20368 | if (o.special) {
|
20369 | allCharSet += specialCharSet;
|
20370 | }
|
20371 | let password = '';
|
20372 | for (let i = 0; i < o.length; i++) {
|
20373 | let positionChars;
|
20374 | switch (positions[i]) {
|
20375 | case 'l':
|
20376 | positionChars = lowercaseCharSet;
|
20377 | break;
|
20378 | case 'u':
|
20379 | positionChars = uppercaseCharSet;
|
20380 | break;
|
20381 | case 'n':
|
20382 | positionChars = numberCharSet;
|
20383 | break;
|
20384 | case 's':
|
20385 | positionChars = specialCharSet;
|
20386 | break;
|
20387 | case 'a':
|
20388 | positionChars = allCharSet;
|
20389 | break;
|
20390 | default:
|
20391 | break;
|
20392 | }
|
20393 | const randomCharIndex = yield this.cryptoService.randomNumber(0, positionChars.length - 1);
|
20394 | password += positionChars.charAt(randomCharIndex);
|
20395 | }
|
20396 | return password;
|
20397 | });
|
20398 | }
|
20399 | generatePassphrase(options) {
|
20400 | return passwordGeneration_service_awaiter(this, void 0, void 0, function* () {
|
20401 | const o = Object.assign({}, DefaultOptions, options);
|
20402 | if (o.numWords == null || o.numWords <= 2) {
|
20403 | o.numWords = DefaultOptions.numWords;
|
20404 | }
|
20405 | if (o.wordSeparator == null || o.wordSeparator.length === 0 || o.wordSeparator.length > 1) {
|
20406 | o.wordSeparator = ' ';
|
20407 | }
|
20408 | if (o.capitalize == null) {
|
20409 | o.capitalize = false;
|
20410 | }
|
20411 | if (o.includeNumber == null) {
|
20412 | o.includeNumber = false;
|
20413 | }
|
20414 | const listLength = EEFLongWordList.length - 1;
|
20415 | const wordList = new Array(o.numWords);
|
20416 | for (let i = 0; i < o.numWords; i++) {
|
20417 | const wordIndex = yield this.cryptoService.randomNumber(0, listLength);
|
20418 | if (o.capitalize) {
|
20419 | wordList[i] = this.capitalize(EEFLongWordList[wordIndex]);
|
20420 | }
|
20421 | else {
|
20422 | wordList[i] = EEFLongWordList[wordIndex];
|
20423 | }
|
20424 | }
|
20425 | if (o.includeNumber) {
|
20426 | yield this.appendRandomNumberToRandomWord(wordList);
|
20427 | }
|
20428 | return wordList.join(o.wordSeparator);
|
20429 | });
|
20430 | }
|
20431 | getOptions() {
|
20432 | return passwordGeneration_service_awaiter(this, void 0, void 0, function* () {
|
20433 | if (this.optionsCache == null) {
|
20434 | const options = yield this.storageService.get(passwordGeneration_service_Keys.options);
|
20435 | if (options == null) {
|
20436 | this.optionsCache = DefaultOptions;
|
20437 | }
|
20438 | else {
|
20439 | this.optionsCache = Object.assign({}, DefaultOptions, options);
|
20440 | }
|
20441 | }
|
20442 | const enforcedOptions = yield this.enforcePasswordGeneratorPoliciesOnOptions(this.optionsCache);
|
20443 | this.optionsCache = enforcedOptions[0];
|
20444 | return [this.optionsCache, enforcedOptions[1]];
|
20445 | });
|
20446 | }
|
20447 | enforcePasswordGeneratorPoliciesOnOptions(options) {
|
20448 | return passwordGeneration_service_awaiter(this, void 0, void 0, function* () {
|
20449 | let enforcedPolicyOptions = yield this.getPasswordGeneratorPolicyOptions();
|
20450 | if (enforcedPolicyOptions != null) {
|
20451 | if (options.length < enforcedPolicyOptions.minLength) {
|
20452 | options.length = enforcedPolicyOptions.minLength;
|
20453 | }
|
20454 | if (enforcedPolicyOptions.useUppercase) {
|
20455 | options.uppercase = true;
|
20456 | }
|
20457 | if (enforcedPolicyOptions.useLowercase) {
|
20458 | options.lowercase = true;
|
20459 | }
|
20460 | if (enforcedPolicyOptions.useNumbers) {
|
20461 | options.number = true;
|
20462 | }
|
20463 | if (options.minNumber < enforcedPolicyOptions.numberCount) {
|
20464 | options.minNumber = enforcedPolicyOptions.numberCount;
|
20465 | }
|
20466 | if (enforcedPolicyOptions.useSpecial) {
|
20467 | options.special = true;
|
20468 | }
|
20469 | if (options.minSpecial < enforcedPolicyOptions.specialCount) {
|
20470 | options.minSpecial = enforcedPolicyOptions.specialCount;
|
20471 | }
|
20472 |
|
20473 | if (options.minSpecial + options.minNumber > options.length) {
|
20474 | options.minSpecial = options.length - options.minNumber;
|
20475 | }
|
20476 | if (options.numWords < enforcedPolicyOptions.minNumberWords) {
|
20477 | options.numWords = enforcedPolicyOptions.minNumberWords;
|
20478 | }
|
20479 | if (enforcedPolicyOptions.capitalize) {
|
20480 | options.capitalize = true;
|
20481 | }
|
20482 | if (enforcedPolicyOptions.includeNumber) {
|
20483 | options.includeNumber = true;
|
20484 | }
|
20485 |
|
20486 | if (enforcedPolicyOptions.defaultType === 'password' ||
|
20487 | enforcedPolicyOptions.defaultType === 'passphrase') {
|
20488 | options.type = enforcedPolicyOptions.defaultType;
|
20489 | }
|
20490 | }
|
20491 | else {
|
20492 | enforcedPolicyOptions = new passwordGeneratorPolicyOptions_PasswordGeneratorPolicyOptions();
|
20493 | }
|
20494 | return [options, enforcedPolicyOptions];
|
20495 | });
|
20496 | }
|
20497 | getPasswordGeneratorPolicyOptions() {
|
20498 | return passwordGeneration_service_awaiter(this, void 0, void 0, function* () {
|
20499 | const policies = yield this.policyService.getAll(PolicyType.PasswordGenerator);
|
20500 | let enforcedOptions = null;
|
20501 | if (policies == null || policies.length === 0) {
|
20502 | return enforcedOptions;
|
20503 | }
|
20504 | policies.forEach((currentPolicy) => {
|
20505 | if (!currentPolicy.enabled || currentPolicy.data == null) {
|
20506 | return;
|
20507 | }
|
20508 | if (enforcedOptions == null) {
|
20509 | enforcedOptions = new passwordGeneratorPolicyOptions_PasswordGeneratorPolicyOptions();
|
20510 | }
|
20511 |
|
20512 | if (currentPolicy.data.defaultType != null && enforcedOptions.defaultType !== 'password') {
|
20513 | enforcedOptions.defaultType = currentPolicy.data.defaultType;
|
20514 | }
|
20515 | if (currentPolicy.data.minLength != null
|
20516 | && currentPolicy.data.minLength > enforcedOptions.minLength) {
|
20517 | enforcedOptions.minLength = currentPolicy.data.minLength;
|
20518 | }
|
20519 | if (currentPolicy.data.useUpper) {
|
20520 | enforcedOptions.useUppercase = true;
|
20521 | }
|
20522 | if (currentPolicy.data.useLower) {
|
20523 | enforcedOptions.useLowercase = true;
|
20524 | }
|
20525 | if (currentPolicy.data.useNumbers) {
|
20526 | enforcedOptions.useNumbers = true;
|
20527 | }
|
20528 | if (currentPolicy.data.minNumbers != null
|
20529 | && currentPolicy.data.minNumbers > enforcedOptions.numberCount) {
|
20530 | enforcedOptions.numberCount = currentPolicy.data.minNumbers;
|
20531 | }
|
20532 | if (currentPolicy.data.useSpecial) {
|
20533 | enforcedOptions.useSpecial = true;
|
20534 | }
|
20535 | if (currentPolicy.data.minSpecial != null
|
20536 | && currentPolicy.data.minSpecial > enforcedOptions.specialCount) {
|
20537 | enforcedOptions.specialCount = currentPolicy.data.minSpecial;
|
20538 | }
|
20539 | if (currentPolicy.data.minNumberWords != null
|
20540 | && currentPolicy.data.minNumberWords > enforcedOptions.minNumberWords) {
|
20541 | enforcedOptions.minNumberWords = currentPolicy.data.minNumberWords;
|
20542 | }
|
20543 | if (currentPolicy.data.capitalize) {
|
20544 | enforcedOptions.capitalize = true;
|
20545 | }
|
20546 | if (currentPolicy.data.includeNumber) {
|
20547 | enforcedOptions.includeNumber = true;
|
20548 | }
|
20549 | });
|
20550 | return enforcedOptions;
|
20551 | });
|
20552 | }
|
20553 | saveOptions(options) {
|
20554 | return passwordGeneration_service_awaiter(this, void 0, void 0, function* () {
|
20555 | yield this.storageService.save(passwordGeneration_service_Keys.options, options);
|
20556 | this.optionsCache = options;
|
20557 | });
|
20558 | }
|
20559 | getHistory() {
|
20560 | return passwordGeneration_service_awaiter(this, void 0, void 0, function* () {
|
20561 | const hasKey = yield this.cryptoService.hasKey();
|
20562 | if (!hasKey) {
|
20563 | return new Array();
|
20564 | }
|
20565 | if (!this.history) {
|
20566 | const encrypted = yield this.storageService.get(passwordGeneration_service_Keys.history);
|
20567 | this.history = yield this.decryptHistory(encrypted);
|
20568 | }
|
20569 | return this.history || new Array();
|
20570 | });
|
20571 | }
|
20572 | addHistory(password) {
|
20573 | return passwordGeneration_service_awaiter(this, void 0, void 0, function* () {
|
20574 |
|
20575 | const hasKey = yield this.cryptoService.hasKey();
|
20576 | if (!hasKey) {
|
20577 | return;
|
20578 | }
|
20579 | const currentHistory = yield this.getHistory();
|
20580 |
|
20581 | if (this.matchesPrevious(password, currentHistory)) {
|
20582 | return;
|
20583 | }
|
20584 | currentHistory.unshift(new GeneratedPasswordHistory(password, Date.now()));
|
20585 |
|
20586 | if (currentHistory.length > MaxPasswordsInHistory) {
|
20587 | currentHistory.pop();
|
20588 | }
|
20589 | const newHistory = yield this.encryptHistory(currentHistory);
|
20590 | return yield this.storageService.save(passwordGeneration_service_Keys.history, newHistory);
|
20591 | });
|
20592 | }
|
20593 | clear() {
|
20594 | return passwordGeneration_service_awaiter(this, void 0, void 0, function* () {
|
20595 | this.history = [];
|
20596 | return yield this.storageService.remove(passwordGeneration_service_Keys.history);
|
20597 | });
|
20598 | }
|
20599 | passwordStrength(password, userInputs = null) {
|
20600 | if (password == null || password.length === 0) {
|
20601 | return null;
|
20602 | }
|
20603 | let globalUserInputs = ['bitwarden', 'bit', 'warden'];
|
20604 | if (userInputs != null && userInputs.length > 0) {
|
20605 | globalUserInputs = globalUserInputs.concat(userInputs);
|
20606 | }
|
20607 |
|
20608 | const finalUserInputs = Array.from(new Set(globalUserInputs));
|
20609 | const result = external_zxcvbn_(password, finalUserInputs);
|
20610 | return result;
|
20611 | }
|
20612 | normalizeOptions(options, enforcedPolicyOptions) {
|
20613 | options.minLowercase = 0;
|
20614 | options.minUppercase = 0;
|
20615 | if (!options.length || options.length < 5) {
|
20616 | options.length = 5;
|
20617 | }
|
20618 | else if (options.length > 128) {
|
20619 | options.length = 128;
|
20620 | }
|
20621 | if (options.length < enforcedPolicyOptions.minLength) {
|
20622 | options.length = enforcedPolicyOptions.minLength;
|
20623 | }
|
20624 | if (!options.minNumber) {
|
20625 | options.minNumber = 0;
|
20626 | }
|
20627 | else if (options.minNumber > options.length) {
|
20628 | options.minNumber = options.length;
|
20629 | }
|
20630 | else if (options.minNumber > 9) {
|
20631 | options.minNumber = 9;
|
20632 | }
|
20633 | if (options.minNumber < enforcedPolicyOptions.numberCount) {
|
20634 | options.minNumber = enforcedPolicyOptions.numberCount;
|
20635 | }
|
20636 | if (!options.minSpecial) {
|
20637 | options.minSpecial = 0;
|
20638 | }
|
20639 | else if (options.minSpecial > options.length) {
|
20640 | options.minSpecial = options.length;
|
20641 | }
|
20642 | else if (options.minSpecial > 9) {
|
20643 | options.minSpecial = 9;
|
20644 | }
|
20645 | if (options.minSpecial < enforcedPolicyOptions.specialCount) {
|
20646 | options.minSpecial = enforcedPolicyOptions.specialCount;
|
20647 | }
|
20648 | if (options.minSpecial + options.minNumber > options.length) {
|
20649 | options.minSpecial = options.length - options.minNumber;
|
20650 | }
|
20651 | if (options.numWords == null || options.length < 3) {
|
20652 | options.numWords = 3;
|
20653 | }
|
20654 | else if (options.numWords > 20) {
|
20655 | options.numWords = 20;
|
20656 | }
|
20657 | if (options.numWords < enforcedPolicyOptions.minNumberWords) {
|
20658 | options.numWords = enforcedPolicyOptions.minNumberWords;
|
20659 | }
|
20660 | if (options.wordSeparator != null && options.wordSeparator.length > 1) {
|
20661 | options.wordSeparator = options.wordSeparator[0];
|
20662 | }
|
20663 | this.sanitizePasswordLength(options, false);
|
20664 | }
|
20665 | capitalize(str) {
|
20666 | return str.charAt(0).toUpperCase() + str.slice(1);
|
20667 | }
|
20668 | appendRandomNumberToRandomWord(wordList) {
|
20669 | return passwordGeneration_service_awaiter(this, void 0, void 0, function* () {
|
20670 | if (wordList == null || wordList.length <= 0) {
|
20671 | return;
|
20672 | }
|
20673 | const index = yield this.cryptoService.randomNumber(0, wordList.length - 1);
|
20674 | const num = yield this.cryptoService.randomNumber(0, 9);
|
20675 | wordList[index] = wordList[index] + num;
|
20676 | });
|
20677 | }
|
20678 | encryptHistory(history) {
|
20679 | return passwordGeneration_service_awaiter(this, void 0, void 0, function* () {
|
20680 | if (history == null || history.length === 0) {
|
20681 | return Promise.resolve([]);
|
20682 | }
|
20683 | const promises = history.map((item) => passwordGeneration_service_awaiter(this, void 0, void 0, function* () {
|
20684 | const encrypted = yield this.cryptoService.encrypt(item.password);
|
20685 | return new GeneratedPasswordHistory(encrypted.encryptedString, item.date);
|
20686 | }));
|
20687 | return yield Promise.all(promises);
|
20688 | });
|
20689 | }
|
20690 | decryptHistory(history) {
|
20691 | return passwordGeneration_service_awaiter(this, void 0, void 0, function* () {
|
20692 | if (history == null || history.length === 0) {
|
20693 | return Promise.resolve([]);
|
20694 | }
|
20695 | const promises = history.map((item) => passwordGeneration_service_awaiter(this, void 0, void 0, function* () {
|
20696 | const decrypted = yield this.cryptoService.decryptToUtf8(new cipherString_CipherString(item.password));
|
20697 | return new GeneratedPasswordHistory(decrypted, item.date);
|
20698 | }));
|
20699 | return yield Promise.all(promises);
|
20700 | });
|
20701 | }
|
20702 | matchesPrevious(password, history) {
|
20703 | if (history == null || history.length === 0) {
|
20704 | return false;
|
20705 | }
|
20706 | return history[history.length - 1].password === password;
|
20707 | }
|
20708 |
|
20709 | shuffleArray(array) {
|
20710 | return passwordGeneration_service_awaiter(this, void 0, void 0, function* () {
|
20711 | for (let i = array.length - 1; i > 0; i--) {
|
20712 | const j = yield this.cryptoService.randomNumber(0, i);
|
20713 | [array[i], array[j]] = [array[j], array[i]];
|
20714 | }
|
20715 | });
|
20716 | }
|
20717 | sanitizePasswordLength(options, forGeneration) {
|
20718 | let minUppercaseCalc = 0;
|
20719 | let minLowercaseCalc = 0;
|
20720 | let minNumberCalc = options.minNumber;
|
20721 | let minSpecialCalc = options.minSpecial;
|
20722 | if (options.uppercase && options.minUppercase <= 0) {
|
20723 | minUppercaseCalc = 1;
|
20724 | }
|
20725 | else if (!options.uppercase) {
|
20726 | minUppercaseCalc = 0;
|
20727 | }
|
20728 | if (options.lowercase && options.minLowercase <= 0) {
|
20729 | minLowercaseCalc = 1;
|
20730 | }
|
20731 | else if (!options.lowercase) {
|
20732 | minLowercaseCalc = 0;
|
20733 | }
|
20734 | if (options.number && options.minNumber <= 0) {
|
20735 | minNumberCalc = 1;
|
20736 | }
|
20737 | else if (!options.number) {
|
20738 | minNumberCalc = 0;
|
20739 | }
|
20740 | if (options.special && options.minSpecial <= 0) {
|
20741 | minSpecialCalc = 1;
|
20742 | }
|
20743 | else if (!options.special) {
|
20744 | minSpecialCalc = 0;
|
20745 | }
|
20746 |
|
20747 | if (!options.length || options.length < 1) {
|
20748 | options.length = 10;
|
20749 | }
|
20750 | const minLength = minUppercaseCalc + minLowercaseCalc + minNumberCalc + minSpecialCalc;
|
20751 |
|
20752 | if (options.length < minLength) {
|
20753 | options.length = minLength;
|
20754 | }
|
20755 |
|
20756 | if (forGeneration) {
|
20757 | options.minUppercase = minUppercaseCalc;
|
20758 | options.minLowercase = minLowercaseCalc;
|
20759 | options.minNumber = minNumberCalc;
|
20760 | options.minSpecial = minSpecialCalc;
|
20761 | }
|
20762 | }
|
20763 | }
|
20764 |
|
20765 |
|
20766 |
|
20767 | class masterPasswordPolicyOptions_MasterPasswordPolicyOptions extends domainBase_Domain {
|
20768 | constructor() {
|
20769 | super(...arguments);
|
20770 | this.minComplexity = 0;
|
20771 | this.minLength = 0;
|
20772 | this.requireUpper = false;
|
20773 | this.requireLower = false;
|
20774 | this.requireNumbers = false;
|
20775 | this.requireSpecial = false;
|
20776 | }
|
20777 | }
|
20778 |
|
20779 |
|
20780 |
|
20781 | class policy_Policy extends domainBase_Domain {
|
20782 | constructor(obj) {
|
20783 | super();
|
20784 | if (obj == null) {
|
20785 | return;
|
20786 | }
|
20787 | this.id = obj.id;
|
20788 | this.organizationId = obj.organizationId;
|
20789 | this.type = obj.type;
|
20790 | this.data = obj.data;
|
20791 | this.enabled = obj.enabled;
|
20792 | }
|
20793 | }
|
20794 |
|
20795 |
|
20796 | var policy_service_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
20797 | return new (P || (P = Promise))(function (resolve, reject) {
|
20798 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
20799 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
20800 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
20801 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
20802 | });
|
20803 | };
|
20804 |
|
20805 |
|
20806 |
|
20807 | const policy_service_Keys = {
|
20808 | policiesPrefix: 'policies_',
|
20809 | };
|
20810 | class policy_service_PolicyService {
|
20811 | constructor(userService, storageService) {
|
20812 | this.userService = userService;
|
20813 | this.storageService = storageService;
|
20814 | }
|
20815 | clearCache() {
|
20816 | this.policyCache = null;
|
20817 | }
|
20818 | getAll(type) {
|
20819 | return policy_service_awaiter(this, void 0, void 0, function* () {
|
20820 | if (this.policyCache == null) {
|
20821 | const userId = yield this.userService.getUserId();
|
20822 | const policies = yield this.storageService.get(policy_service_Keys.policiesPrefix + userId);
|
20823 | const response = [];
|
20824 | for (const id in policies) {
|
20825 | if (policies.hasOwnProperty(id)) {
|
20826 | response.push(new policy_Policy(policies[id]));
|
20827 | }
|
20828 | }
|
20829 | this.policyCache = response;
|
20830 | }
|
20831 | if (type != null) {
|
20832 | return this.policyCache.filter((p) => p.type === type);
|
20833 | }
|
20834 | else {
|
20835 | return this.policyCache;
|
20836 | }
|
20837 | });
|
20838 | }
|
20839 | replace(policies) {
|
20840 | return policy_service_awaiter(this, void 0, void 0, function* () {
|
20841 | const userId = yield this.userService.getUserId();
|
20842 | yield this.storageService.save(policy_service_Keys.policiesPrefix + userId, policies);
|
20843 | this.policyCache = null;
|
20844 | });
|
20845 | }
|
20846 | clear(userId) {
|
20847 | return policy_service_awaiter(this, void 0, void 0, function* () {
|
20848 | yield this.storageService.remove(policy_service_Keys.policiesPrefix + userId);
|
20849 | this.policyCache = null;
|
20850 | });
|
20851 | }
|
20852 | getMasterPasswordPolicyOptions(policies) {
|
20853 | return policy_service_awaiter(this, void 0, void 0, function* () {
|
20854 | let enforcedOptions = null;
|
20855 | if (policies == null) {
|
20856 | policies = yield this.getAll(PolicyType.MasterPassword);
|
20857 | }
|
20858 | else {
|
20859 | policies = policies.filter((p) => p.type === PolicyType.MasterPassword);
|
20860 | }
|
20861 | if (policies == null || policies.length === 0) {
|
20862 | return enforcedOptions;
|
20863 | }
|
20864 | policies.forEach((currentPolicy) => {
|
20865 | if (!currentPolicy.enabled || currentPolicy.data == null) {
|
20866 | return;
|
20867 | }
|
20868 | if (enforcedOptions == null) {
|
20869 | enforcedOptions = new masterPasswordPolicyOptions_MasterPasswordPolicyOptions();
|
20870 | }
|
20871 | if (currentPolicy.data.minComplexity != null
|
20872 | && currentPolicy.data.minComplexity > enforcedOptions.minComplexity) {
|
20873 | enforcedOptions.minComplexity = currentPolicy.data.minComplexity;
|
20874 | }
|
20875 | if (currentPolicy.data.minLength != null
|
20876 | && currentPolicy.data.minLength > enforcedOptions.minLength) {
|
20877 | enforcedOptions.minLength = currentPolicy.data.minLength;
|
20878 | }
|
20879 | if (currentPolicy.data.requireUpper) {
|
20880 | enforcedOptions.requireUpper = true;
|
20881 | }
|
20882 | if (currentPolicy.data.requireLower) {
|
20883 | enforcedOptions.requireLower = true;
|
20884 | }
|
20885 | if (currentPolicy.data.requireNumbers) {
|
20886 | enforcedOptions.requireNumbers = true;
|
20887 | }
|
20888 | if (currentPolicy.data.requireSpecial) {
|
20889 | enforcedOptions.requireSpecial = true;
|
20890 | }
|
20891 | });
|
20892 | return enforcedOptions;
|
20893 | });
|
20894 | }
|
20895 | evaluateMasterPassword(passwordStrength, newPassword, enforcedPolicyOptions) {
|
20896 | if (enforcedPolicyOptions == null) {
|
20897 | return true;
|
20898 | }
|
20899 | if (enforcedPolicyOptions.minComplexity > 0 && enforcedPolicyOptions.minComplexity > passwordStrength) {
|
20900 | return false;
|
20901 | }
|
20902 | if (enforcedPolicyOptions.minLength > 0 && enforcedPolicyOptions.minLength > newPassword.length) {
|
20903 | return false;
|
20904 | }
|
20905 | if (enforcedPolicyOptions.requireUpper && newPassword.toLocaleLowerCase() === newPassword) {
|
20906 | return false;
|
20907 | }
|
20908 | if (enforcedPolicyOptions.requireLower && newPassword.toLocaleUpperCase() === newPassword) {
|
20909 | return false;
|
20910 | }
|
20911 | if (enforcedPolicyOptions.requireNumbers && !(/[0-9]/.test(newPassword))) {
|
20912 | return false;
|
20913 | }
|
20914 | if (enforcedPolicyOptions.requireSpecial && !(/[!@#$%\^&*]/g.test(newPassword))) {
|
20915 | return false;
|
20916 | }
|
20917 | return true;
|
20918 | }
|
20919 | }
|
20920 |
|
20921 |
|
20922 | var external_lunr_ = __webpack_require__(9);
|
20923 |
|
20924 |
|
20925 | var search_service_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
20926 | return new (P || (P = Promise))(function (resolve, reject) {
|
20927 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
20928 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
20929 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
20930 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
20931 | });
|
20932 | };
|
20933 |
|
20934 |
|
20935 |
|
20936 |
|
20937 |
|
20938 | class search_service_SearchService {
|
20939 | constructor(cipherService, platformUtilsService) {
|
20940 | this.cipherService = cipherService;
|
20941 | this.indexing = false;
|
20942 | this.index = null;
|
20943 | this.onlySearchName = false;
|
20944 | this.onlySearchName = platformUtilsService == null ||
|
20945 | platformUtilsService.getDevice() === DeviceType.EdgeExtension;
|
20946 | }
|
20947 | clearIndex() {
|
20948 | this.index = null;
|
20949 | }
|
20950 | isSearchable(query) {
|
20951 | const notSearchable = query == null || (this.index == null && query.length < 2) ||
|
20952 | (this.index != null && query.length < 2 && query.indexOf('>') !== 0);
|
20953 | return !notSearchable;
|
20954 | }
|
20955 | indexCiphers() {
|
20956 | return search_service_awaiter(this, void 0, void 0, function* () {
|
20957 | if (this.indexing) {
|
20958 | return;
|
20959 | }
|
20960 |
|
20961 | console.time('search indexing');
|
20962 | this.indexing = true;
|
20963 | this.index = null;
|
20964 | const builder = new external_lunr_["Builder"]();
|
20965 | builder.ref('id');
|
20966 | builder.field('shortid', { boost: 100, extractor: (c) => c.id.substr(0, 8) });
|
20967 | builder.field('name', { boost: 10 });
|
20968 | builder.field('subtitle', {
|
20969 | boost: 5,
|
20970 | extractor: (c) => {
|
20971 | if (c.subTitle != null && c.type === CipherType.Card) {
|
20972 | return c.subTitle.replace(/\*/g, '');
|
20973 | }
|
20974 | return c.subTitle;
|
20975 | },
|
20976 | });
|
20977 | builder.field('notes');
|
20978 | builder.field('login.username', {
|
20979 | extractor: (c) => c.type === CipherType.Login && c.login != null ? c.login.username : null,
|
20980 | });
|
20981 | builder.field('login.uris', { boost: 2, extractor: (c) => this.uriExtractor(c) });
|
20982 | builder.field('fields', { extractor: (c) => this.fieldExtractor(c, false) });
|
20983 | builder.field('fields_joined', { extractor: (c) => this.fieldExtractor(c, true) });
|
20984 | builder.field('attachments', { extractor: (c) => this.attachmentExtractor(c, false) });
|
20985 | builder.field('attachments_joined', { extractor: (c) => this.attachmentExtractor(c, true) });
|
20986 | builder.field('organizationid', { extractor: (c) => c.organizationId });
|
20987 | const ciphers = yield this.cipherService.getAllDecrypted();
|
20988 | ciphers.forEach((c) => builder.add(c));
|
20989 | this.index = builder.build();
|
20990 | this.indexing = false;
|
20991 |
|
20992 | console.timeEnd('search indexing');
|
20993 | });
|
20994 | }
|
20995 | searchCiphers(query, filter = null, ciphers = null) {
|
20996 | return search_service_awaiter(this, void 0, void 0, function* () {
|
20997 | const results = [];
|
20998 | if (query != null) {
|
20999 | query = query.trim().toLowerCase();
|
21000 | }
|
21001 | if (query === '') {
|
21002 | query = null;
|
21003 | }
|
21004 | if (ciphers == null) {
|
21005 | ciphers = yield this.cipherService.getAllDecrypted();
|
21006 | }
|
21007 | if (filter != null && Array.isArray(filter) && filter.length > 0) {
|
21008 | ciphers = ciphers.filter((c) => filter.every((f) => f == null || f(c)));
|
21009 | }
|
21010 | else if (filter != null) {
|
21011 | ciphers = ciphers.filter(filter);
|
21012 | }
|
21013 | if (!this.isSearchable(query)) {
|
21014 | return ciphers;
|
21015 | }
|
21016 | if (this.indexing) {
|
21017 | yield new Promise((r) => setTimeout(r, 250));
|
21018 | if (this.indexing) {
|
21019 | yield new Promise((r) => setTimeout(r, 500));
|
21020 | }
|
21021 | }
|
21022 | const index = this.getIndexForSearch();
|
21023 | if (index == null) {
|
21024 |
|
21025 | return this.searchCiphersBasic(ciphers, query);
|
21026 | }
|
21027 | const ciphersMap = new Map();
|
21028 | ciphers.forEach((c) => ciphersMap.set(c.id, c));
|
21029 | let searchResults = null;
|
21030 | const isQueryString = query != null && query.length > 1 && query.indexOf('>') === 0;
|
21031 | if (isQueryString) {
|
21032 | try {
|
21033 | searchResults = index.search(query.substr(1).trim());
|
21034 | }
|
21035 | catch (_a) { }
|
21036 | }
|
21037 | else {
|
21038 |
|
21039 | const soWild = external_lunr_["Query"].wildcard.LEADING | external_lunr_["Query"].wildcard.TRAILING;
|
21040 | searchResults = index.query((q) => {
|
21041 | external_lunr_["tokenizer"](query).forEach((token) => {
|
21042 | const t = token.toString();
|
21043 | q.term(t, { fields: ['name'], wildcard: soWild });
|
21044 | q.term(t, { fields: ['subtitle'], wildcard: soWild });
|
21045 | q.term(t, { fields: ['login.uris'], wildcard: soWild });
|
21046 | q.term(t, {});
|
21047 | });
|
21048 | });
|
21049 | }
|
21050 | if (searchResults != null) {
|
21051 | searchResults.forEach((r) => {
|
21052 | if (ciphersMap.has(r.ref)) {
|
21053 | results.push(ciphersMap.get(r.ref));
|
21054 | }
|
21055 | });
|
21056 | }
|
21057 | return results;
|
21058 | });
|
21059 | }
|
21060 | searchCiphersBasic(ciphers, query, deleted = false) {
|
21061 | query = query.trim().toLowerCase();
|
21062 | return ciphers.filter((c) => {
|
21063 | if (deleted !== c.isDeleted) {
|
21064 | return false;
|
21065 | }
|
21066 | if (c.name != null && c.name.toLowerCase().indexOf(query) > -1) {
|
21067 | return true;
|
21068 | }
|
21069 | if (this.onlySearchName) {
|
21070 | return false;
|
21071 | }
|
21072 | if (query.length >= 8 && c.id.startsWith(query)) {
|
21073 | return true;
|
21074 | }
|
21075 | if (c.subTitle != null && c.subTitle.toLowerCase().indexOf(query) > -1) {
|
21076 | return true;
|
21077 | }
|
21078 | if (c.login && c.login.uri != null && c.login.uri.toLowerCase().indexOf(query) > -1) {
|
21079 | return true;
|
21080 | }
|
21081 | return false;
|
21082 | });
|
21083 | }
|
21084 | getIndexForSearch() {
|
21085 | return this.index;
|
21086 | }
|
21087 | fieldExtractor(c, joined) {
|
21088 | if (!c.hasFields) {
|
21089 | return null;
|
21090 | }
|
21091 | let fields = [];
|
21092 | c.fields.forEach((f) => {
|
21093 | if (f.name != null) {
|
21094 | fields.push(f.name);
|
21095 | }
|
21096 | if (f.type === FieldType.Text && f.value != null) {
|
21097 | fields.push(f.value);
|
21098 | }
|
21099 | });
|
21100 | fields = fields.filter((f) => f.trim() !== '');
|
21101 | if (fields.length === 0) {
|
21102 | return null;
|
21103 | }
|
21104 | return joined ? fields.join(' ') : fields;
|
21105 | }
|
21106 | attachmentExtractor(c, joined) {
|
21107 | if (!c.hasAttachments) {
|
21108 | return null;
|
21109 | }
|
21110 | let attachments = [];
|
21111 | c.attachments.forEach((a) => {
|
21112 | if (a != null && a.fileName != null) {
|
21113 | if (joined && a.fileName.indexOf('.') > -1) {
|
21114 | attachments.push(a.fileName.substr(0, a.fileName.lastIndexOf('.')));
|
21115 | }
|
21116 | else {
|
21117 | attachments.push(a.fileName);
|
21118 | }
|
21119 | }
|
21120 | });
|
21121 | attachments = attachments.filter((f) => f.trim() !== '');
|
21122 | if (attachments.length === 0) {
|
21123 | return null;
|
21124 | }
|
21125 | return joined ? attachments.join(' ') : attachments;
|
21126 | }
|
21127 | uriExtractor(c) {
|
21128 | if (c.type !== CipherType.Login || c.login == null || !c.login.hasUris) {
|
21129 | return null;
|
21130 | }
|
21131 | const uris = [];
|
21132 | c.login.uris.forEach((u) => {
|
21133 | if (u.uri == null || u.uri === '') {
|
21134 | return;
|
21135 | }
|
21136 | if (u.hostname != null) {
|
21137 | uris.push(u.hostname);
|
21138 | return;
|
21139 | }
|
21140 | let uri = u.uri;
|
21141 | if (u.match !== UriMatchType.RegularExpression) {
|
21142 | const protocolIndex = uri.indexOf('://');
|
21143 | if (protocolIndex > -1) {
|
21144 | uri = uri.substr(protocolIndex + 3);
|
21145 | }
|
21146 | const queryIndex = uri.search(/\?|&|#/);
|
21147 | if (queryIndex > -1) {
|
21148 | uri = uri.substring(0, queryIndex);
|
21149 | }
|
21150 | }
|
21151 | uris.push(uri);
|
21152 | });
|
21153 | return uris.length > 0 ? uris : null;
|
21154 | }
|
21155 | }
|
21156 |
|
21157 |
|
21158 | var settings_service_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
21159 | return new (P || (P = Promise))(function (resolve, reject) {
|
21160 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
21161 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
21162 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
21163 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
21164 | });
|
21165 | };
|
21166 | const settings_service_Keys = {
|
21167 | settingsPrefix: 'settings_',
|
21168 | equivalentDomains: 'equivalentDomains',
|
21169 | };
|
21170 | class SettingsService {
|
21171 | constructor(userService, storageService) {
|
21172 | this.userService = userService;
|
21173 | this.storageService = storageService;
|
21174 | }
|
21175 | clearCache() {
|
21176 | this.settingsCache = null;
|
21177 | }
|
21178 | getEquivalentDomains() {
|
21179 | return this.getSettingsKey(settings_service_Keys.equivalentDomains);
|
21180 | }
|
21181 | setEquivalentDomains(equivalentDomains) {
|
21182 | return settings_service_awaiter(this, void 0, void 0, function* () {
|
21183 | yield this.setSettingsKey(settings_service_Keys.equivalentDomains, equivalentDomains);
|
21184 | });
|
21185 | }
|
21186 | clear(userId) {
|
21187 | return settings_service_awaiter(this, void 0, void 0, function* () {
|
21188 | yield this.storageService.remove(settings_service_Keys.settingsPrefix + userId);
|
21189 | this.clearCache();
|
21190 | });
|
21191 | }
|
21192 |
|
21193 | getSettings() {
|
21194 | return settings_service_awaiter(this, void 0, void 0, function* () {
|
21195 | if (this.settingsCache == null) {
|
21196 | const userId = yield this.userService.getUserId();
|
21197 | this.settingsCache = this.storageService.get(settings_service_Keys.settingsPrefix + userId);
|
21198 | }
|
21199 | return this.settingsCache;
|
21200 | });
|
21201 | }
|
21202 | getSettingsKey(key) {
|
21203 | return settings_service_awaiter(this, void 0, void 0, function* () {
|
21204 | const settings = yield this.getSettings();
|
21205 | if (settings != null && settings[key]) {
|
21206 | return settings[key];
|
21207 | }
|
21208 | return null;
|
21209 | });
|
21210 | }
|
21211 | setSettingsKey(key, value) {
|
21212 | return settings_service_awaiter(this, void 0, void 0, function* () {
|
21213 | const userId = yield this.userService.getUserId();
|
21214 | let settings = yield this.getSettings();
|
21215 | if (!settings) {
|
21216 | settings = {};
|
21217 | }
|
21218 | settings[key] = value;
|
21219 | yield this.storageService.save(settings_service_Keys.settingsPrefix + userId, settings);
|
21220 | this.settingsCache = settings;
|
21221 | });
|
21222 | }
|
21223 | }
|
21224 |
|
21225 |
|
21226 | class OrganizationData {
|
21227 | constructor(response) {
|
21228 | this.id = response.id;
|
21229 | this.name = response.name;
|
21230 | this.status = response.status;
|
21231 | this.type = response.type;
|
21232 | this.enabled = response.enabled;
|
21233 | this.usePolicies = response.usePolicies;
|
21234 | this.useGroups = response.useGroups;
|
21235 | this.useDirectory = response.useDirectory;
|
21236 | this.useEvents = response.useEvents;
|
21237 | this.useTotp = response.useTotp;
|
21238 | this.use2fa = response.use2fa;
|
21239 | this.useApi = response.useApi;
|
21240 | this.selfHost = response.selfHost;
|
21241 | this.usersGetPremium = response.usersGetPremium;
|
21242 | this.seats = response.seats;
|
21243 | this.maxCollections = response.maxCollections;
|
21244 | this.maxStorageGb = response.maxStorageGb;
|
21245 | }
|
21246 | }
|
21247 |
|
21248 |
|
21249 | class PolicyData {
|
21250 | constructor(response) {
|
21251 | this.id = response.id;
|
21252 | this.organizationId = response.organizationId;
|
21253 | this.type = response.type;
|
21254 | this.data = response.data;
|
21255 | this.enabled = response.enabled;
|
21256 | }
|
21257 | }
|
21258 |
|
21259 |
|
21260 | var sync_service_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
21261 | return new (P || (P = Promise))(function (resolve, reject) {
|
21262 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
21263 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
21264 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
21265 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
21266 | });
|
21267 | };
|
21268 |
|
21269 |
|
21270 |
|
21271 |
|
21272 |
|
21273 | const sync_service_Keys = {
|
21274 | lastSyncPrefix: 'lastSync_',
|
21275 | };
|
21276 | class sync_service_SyncService {
|
21277 | constructor(userService, apiService, settingsService, folderService, cipherService, cryptoService, collectionService, storageService, messagingService, policyService, logoutCallback) {
|
21278 | this.userService = userService;
|
21279 | this.apiService = apiService;
|
21280 | this.settingsService = settingsService;
|
21281 | this.folderService = folderService;
|
21282 | this.cipherService = cipherService;
|
21283 | this.cryptoService = cryptoService;
|
21284 | this.collectionService = collectionService;
|
21285 | this.storageService = storageService;
|
21286 | this.messagingService = messagingService;
|
21287 | this.policyService = policyService;
|
21288 | this.logoutCallback = logoutCallback;
|
21289 | this.syncInProgress = false;
|
21290 | }
|
21291 | getLastSync() {
|
21292 | return sync_service_awaiter(this, void 0, void 0, function* () {
|
21293 | const userId = yield this.userService.getUserId();
|
21294 | if (userId == null) {
|
21295 | return null;
|
21296 | }
|
21297 | const lastSync = yield this.storageService.get(sync_service_Keys.lastSyncPrefix + userId);
|
21298 | if (lastSync) {
|
21299 | return new Date(lastSync);
|
21300 | }
|
21301 | return null;
|
21302 | });
|
21303 | }
|
21304 | setLastSync(date) {
|
21305 | return sync_service_awaiter(this, void 0, void 0, function* () {
|
21306 | const userId = yield this.userService.getUserId();
|
21307 | if (userId == null) {
|
21308 | return;
|
21309 | }
|
21310 | yield this.storageService.save(sync_service_Keys.lastSyncPrefix + userId, date.toJSON());
|
21311 | });
|
21312 | }
|
21313 | fullSync(forceSync, allowThrowOnError = false) {
|
21314 | return sync_service_awaiter(this, void 0, void 0, function* () {
|
21315 | this.syncStarted();
|
21316 | const isAuthenticated = yield this.userService.isAuthenticated();
|
21317 | if (!isAuthenticated) {
|
21318 | return this.syncCompleted(false);
|
21319 | }
|
21320 | const now = new Date();
|
21321 | const needsSyncResult = yield this.needsSyncing(forceSync);
|
21322 | const needsSync = needsSyncResult[0];
|
21323 | const skipped = needsSyncResult[1];
|
21324 | if (skipped) {
|
21325 | return this.syncCompleted(false);
|
21326 | }
|
21327 | if (!needsSync) {
|
21328 | yield this.setLastSync(now);
|
21329 | return this.syncCompleted(false);
|
21330 | }
|
21331 | const userId = yield this.userService.getUserId();
|
21332 | try {
|
21333 | const response = yield this.apiService.getSync();
|
21334 | yield this.syncProfile(response.profile);
|
21335 | yield this.syncFolders(userId, response.folders);
|
21336 | yield this.syncCollections(response.collections);
|
21337 | yield this.syncCiphers(userId, response.ciphers);
|
21338 | yield this.syncSettings(userId, response.domains);
|
21339 | yield this.syncPolicies(response.policies);
|
21340 | yield this.setLastSync(now);
|
21341 | return this.syncCompleted(true);
|
21342 | }
|
21343 | catch (e) {
|
21344 | if (allowThrowOnError) {
|
21345 | throw e;
|
21346 | }
|
21347 | else {
|
21348 | return this.syncCompleted(false);
|
21349 | }
|
21350 | }
|
21351 | });
|
21352 | }
|
21353 | syncUpsertFolder(notification, isEdit) {
|
21354 | return sync_service_awaiter(this, void 0, void 0, function* () {
|
21355 | this.syncStarted();
|
21356 | if (yield this.userService.isAuthenticated()) {
|
21357 | try {
|
21358 | const localFolder = yield this.folderService.get(notification.id);
|
21359 | if ((!isEdit && localFolder == null) ||
|
21360 | (isEdit && localFolder != null && localFolder.revisionDate < notification.revisionDate)) {
|
21361 | const remoteFolder = yield this.apiService.getFolder(notification.id);
|
21362 | if (remoteFolder != null) {
|
21363 | const userId = yield this.userService.getUserId();
|
21364 | yield this.folderService.upsert(new FolderData(remoteFolder, userId));
|
21365 | this.messagingService.send('syncedUpsertedFolder', { folderId: notification.id });
|
21366 | return this.syncCompleted(true);
|
21367 | }
|
21368 | }
|
21369 | }
|
21370 | catch (_a) { }
|
21371 | }
|
21372 | return this.syncCompleted(false);
|
21373 | });
|
21374 | }
|
21375 | syncDeleteFolder(notification) {
|
21376 | return sync_service_awaiter(this, void 0, void 0, function* () {
|
21377 | this.syncStarted();
|
21378 | if (yield this.userService.isAuthenticated()) {
|
21379 | yield this.folderService.delete(notification.id);
|
21380 | this.messagingService.send('syncedDeletedFolder', { folderId: notification.id });
|
21381 | this.syncCompleted(true);
|
21382 | return true;
|
21383 | }
|
21384 | return this.syncCompleted(false);
|
21385 | });
|
21386 | }
|
21387 | syncUpsertCipher(notification, isEdit) {
|
21388 | return sync_service_awaiter(this, void 0, void 0, function* () {
|
21389 | this.syncStarted();
|
21390 | if (yield this.userService.isAuthenticated()) {
|
21391 | try {
|
21392 | let shouldUpdate = true;
|
21393 | const localCipher = yield this.cipherService.get(notification.id);
|
21394 | if (localCipher != null && localCipher.revisionDate >= notification.revisionDate) {
|
21395 | shouldUpdate = false;
|
21396 | }
|
21397 | let checkCollections = false;
|
21398 | if (shouldUpdate) {
|
21399 | if (isEdit) {
|
21400 | shouldUpdate = localCipher != null;
|
21401 | checkCollections = true;
|
21402 | }
|
21403 | else {
|
21404 | if (notification.collectionIds == null || notification.organizationId == null) {
|
21405 | shouldUpdate = localCipher == null;
|
21406 | }
|
21407 | else {
|
21408 | shouldUpdate = false;
|
21409 | checkCollections = true;
|
21410 | }
|
21411 | }
|
21412 | }
|
21413 | if (!shouldUpdate && checkCollections && notification.organizationId != null &&
|
21414 | notification.collectionIds != null && notification.collectionIds.length > 0) {
|
21415 | const collections = yield this.collectionService.getAll();
|
21416 | if (collections != null) {
|
21417 | for (let i = 0; i < collections.length; i++) {
|
21418 | if (notification.collectionIds.indexOf(collections[i].id) > -1) {
|
21419 | shouldUpdate = true;
|
21420 | break;
|
21421 | }
|
21422 | }
|
21423 | }
|
21424 | }
|
21425 | if (shouldUpdate) {
|
21426 | const remoteCipher = yield this.apiService.getCipher(notification.id);
|
21427 | if (remoteCipher != null) {
|
21428 | const userId = yield this.userService.getUserId();
|
21429 | yield this.cipherService.upsert(new cipherData_CipherData(remoteCipher, userId));
|
21430 | this.messagingService.send('syncedUpsertedCipher', { cipherId: notification.id });
|
21431 | return this.syncCompleted(true);
|
21432 | }
|
21433 | }
|
21434 | }
|
21435 | catch (e) {
|
21436 | if (e != null && e.statusCode === 404 && isEdit) {
|
21437 | yield this.cipherService.delete(notification.id);
|
21438 | this.messagingService.send('syncedDeletedCipher', { cipherId: notification.id });
|
21439 | return this.syncCompleted(true);
|
21440 | }
|
21441 | }
|
21442 | }
|
21443 | return this.syncCompleted(false);
|
21444 | });
|
21445 | }
|
21446 | syncDeleteCipher(notification) {
|
21447 | return sync_service_awaiter(this, void 0, void 0, function* () {
|
21448 | this.syncStarted();
|
21449 | if (yield this.userService.isAuthenticated()) {
|
21450 | yield this.cipherService.delete(notification.id);
|
21451 | this.messagingService.send('syncedDeletedCipher', { cipherId: notification.id });
|
21452 | return this.syncCompleted(true);
|
21453 | }
|
21454 | return this.syncCompleted(false);
|
21455 | });
|
21456 | }
|
21457 |
|
21458 | syncStarted() {
|
21459 | this.syncInProgress = true;
|
21460 | this.messagingService.send('syncStarted');
|
21461 | }
|
21462 | syncCompleted(successfully) {
|
21463 | this.syncInProgress = false;
|
21464 | this.messagingService.send('syncCompleted', { successfully: successfully });
|
21465 | return successfully;
|
21466 | }
|
21467 | needsSyncing(forceSync) {
|
21468 | return sync_service_awaiter(this, void 0, void 0, function* () {
|
21469 | if (forceSync) {
|
21470 | return [true, false];
|
21471 | }
|
21472 | const lastSync = yield this.getLastSync();
|
21473 | if (lastSync == null || lastSync.getTime() === 0) {
|
21474 | return [true, false];
|
21475 | }
|
21476 | try {
|
21477 | const response = yield this.apiService.getAccountRevisionDate();
|
21478 | if (new Date(response) <= lastSync) {
|
21479 | return [false, false];
|
21480 | }
|
21481 | return [true, false];
|
21482 | }
|
21483 | catch (e) {
|
21484 | return [false, true];
|
21485 | }
|
21486 | });
|
21487 | }
|
21488 | syncProfile(response) {
|
21489 | return sync_service_awaiter(this, void 0, void 0, function* () {
|
21490 | const stamp = yield this.userService.getSecurityStamp();
|
21491 | if (stamp != null && stamp !== response.securityStamp) {
|
21492 | if (this.logoutCallback != null) {
|
21493 | yield this.logoutCallback(true);
|
21494 | }
|
21495 | throw new Error('Stamp has changed');
|
21496 | }
|
21497 | yield this.cryptoService.setEncKey(response.key);
|
21498 | yield this.cryptoService.setEncPrivateKey(response.privateKey);
|
21499 | yield this.cryptoService.setOrgKeys(response.organizations);
|
21500 | yield this.userService.setSecurityStamp(response.securityStamp);
|
21501 | const organizations = {};
|
21502 | response.organizations.forEach((o) => {
|
21503 | organizations[o.id] = new OrganizationData(o);
|
21504 | });
|
21505 | return yield this.userService.replaceOrganizations(organizations);
|
21506 | });
|
21507 | }
|
21508 | syncFolders(userId, response) {
|
21509 | return sync_service_awaiter(this, void 0, void 0, function* () {
|
21510 | const folders = {};
|
21511 | response.forEach((f) => {
|
21512 | folders[f.id] = new FolderData(f, userId);
|
21513 | });
|
21514 | return yield this.folderService.replace(folders);
|
21515 | });
|
21516 | }
|
21517 | syncCollections(response) {
|
21518 | return sync_service_awaiter(this, void 0, void 0, function* () {
|
21519 | const collections = {};
|
21520 | response.forEach((c) => {
|
21521 | collections[c.id] = new CollectionData(c);
|
21522 | });
|
21523 | return yield this.collectionService.replace(collections);
|
21524 | });
|
21525 | }
|
21526 | syncCiphers(userId, response) {
|
21527 | return sync_service_awaiter(this, void 0, void 0, function* () {
|
21528 | const ciphers = {};
|
21529 | response.forEach((c) => {
|
21530 | ciphers[c.id] = new cipherData_CipherData(c, userId);
|
21531 | });
|
21532 | return yield this.cipherService.replace(ciphers);
|
21533 | });
|
21534 | }
|
21535 | syncSettings(userId, response) {
|
21536 | return sync_service_awaiter(this, void 0, void 0, function* () {
|
21537 | let eqDomains = [];
|
21538 | if (response != null && response.equivalentDomains != null) {
|
21539 | eqDomains = eqDomains.concat(response.equivalentDomains);
|
21540 | }
|
21541 | if (response != null && response.globalEquivalentDomains != null) {
|
21542 | response.globalEquivalentDomains.forEach((global) => {
|
21543 | if (global.domains.length > 0) {
|
21544 | eqDomains.push(global.domains);
|
21545 | }
|
21546 | });
|
21547 | }
|
21548 | return this.settingsService.setEquivalentDomains(eqDomains);
|
21549 | });
|
21550 | }
|
21551 | syncPolicies(response) {
|
21552 | return sync_service_awaiter(this, void 0, void 0, function* () {
|
21553 | const policies = {};
|
21554 | if (response != null) {
|
21555 | response.forEach((p) => {
|
21556 | policies[p.id] = new PolicyData(p);
|
21557 | });
|
21558 | }
|
21559 | return yield this.policyService.replace(policies);
|
21560 | });
|
21561 | }
|
21562 | }
|
21563 |
|
21564 |
|
21565 | var token_service_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
21566 | return new (P || (P = Promise))(function (resolve, reject) {
|
21567 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
21568 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
21569 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
21570 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
21571 | });
|
21572 | };
|
21573 |
|
21574 |
|
21575 | const token_service_Keys = {
|
21576 | accessToken: 'accessToken',
|
21577 | refreshToken: 'refreshToken',
|
21578 | twoFactorTokenPrefix: 'twoFactorToken_',
|
21579 | };
|
21580 | class token_service_TokenService {
|
21581 | constructor(storageService) {
|
21582 | this.storageService = storageService;
|
21583 | }
|
21584 | setTokens(accessToken, refreshToken) {
|
21585 | return Promise.all([
|
21586 | this.setToken(accessToken),
|
21587 | this.setRefreshToken(refreshToken),
|
21588 | ]);
|
21589 | }
|
21590 | setToken(token) {
|
21591 | return token_service_awaiter(this, void 0, void 0, function* () {
|
21592 | this.token = token;
|
21593 | this.decodedToken = null;
|
21594 | if (yield this.skipTokenStorage()) {
|
21595 |
|
21596 | return;
|
21597 | }
|
21598 | return this.storageService.save(token_service_Keys.accessToken, token);
|
21599 | });
|
21600 | }
|
21601 | getToken() {
|
21602 | return token_service_awaiter(this, void 0, void 0, function* () {
|
21603 | if (this.token != null) {
|
21604 | return this.token;
|
21605 | }
|
21606 | this.token = yield this.storageService.get(token_service_Keys.accessToken);
|
21607 | return this.token;
|
21608 | });
|
21609 | }
|
21610 | setRefreshToken(refreshToken) {
|
21611 | return token_service_awaiter(this, void 0, void 0, function* () {
|
21612 | this.refreshToken = refreshToken;
|
21613 | if (yield this.skipTokenStorage()) {
|
21614 |
|
21615 | return;
|
21616 | }
|
21617 | return this.storageService.save(token_service_Keys.refreshToken, refreshToken);
|
21618 | });
|
21619 | }
|
21620 | getRefreshToken() {
|
21621 | return token_service_awaiter(this, void 0, void 0, function* () {
|
21622 | if (this.refreshToken != null) {
|
21623 | return this.refreshToken;
|
21624 | }
|
21625 | this.refreshToken = yield this.storageService.get(token_service_Keys.refreshToken);
|
21626 | return this.refreshToken;
|
21627 | });
|
21628 | }
|
21629 | toggleTokens() {
|
21630 | return token_service_awaiter(this, void 0, void 0, function* () {
|
21631 | const token = yield this.getToken();
|
21632 | const refreshToken = yield this.getRefreshToken();
|
21633 | const timeout = yield this.storageService.get(ConstantsService.vaultTimeoutKey);
|
21634 | const action = yield this.storageService.get(ConstantsService.vaultTimeoutActionKey);
|
21635 | if ((timeout != null || timeout === 0) && action === 'logOut') {
|
21636 |
|
21637 | yield this.clearToken();
|
21638 | this.token = token;
|
21639 | this.refreshToken = refreshToken;
|
21640 | return;
|
21641 | }
|
21642 | yield this.setToken(token);
|
21643 | yield this.setRefreshToken(refreshToken);
|
21644 | });
|
21645 | }
|
21646 | setTwoFactorToken(token, email) {
|
21647 | return this.storageService.save(token_service_Keys.twoFactorTokenPrefix + email, token);
|
21648 | }
|
21649 | getTwoFactorToken(email) {
|
21650 | return this.storageService.get(token_service_Keys.twoFactorTokenPrefix + email);
|
21651 | }
|
21652 | clearTwoFactorToken(email) {
|
21653 | return this.storageService.remove(token_service_Keys.twoFactorTokenPrefix + email);
|
21654 | }
|
21655 | clearToken() {
|
21656 | this.token = null;
|
21657 | this.decodedToken = null;
|
21658 | this.refreshToken = null;
|
21659 | return Promise.all([
|
21660 | this.storageService.remove(token_service_Keys.accessToken),
|
21661 | this.storageService.remove(token_service_Keys.refreshToken),
|
21662 | ]);
|
21663 | }
|
21664 |
|
21665 |
|
21666 | decodeToken() {
|
21667 | if (this.decodedToken) {
|
21668 | return this.decodedToken;
|
21669 | }
|
21670 | if (this.token == null) {
|
21671 | throw new Error('Token not found.');
|
21672 | }
|
21673 | const parts = this.token.split('.');
|
21674 | if (parts.length !== 3) {
|
21675 | throw new Error('JWT must have 3 parts');
|
21676 | }
|
21677 | const decoded = utils_Utils.fromUrlB64ToUtf8(parts[1]);
|
21678 | if (decoded == null) {
|
21679 | throw new Error('Cannot decode the token');
|
21680 | }
|
21681 | this.decodedToken = JSON.parse(decoded);
|
21682 | return this.decodedToken;
|
21683 | }
|
21684 | getTokenExpirationDate() {
|
21685 | const decoded = this.decodeToken();
|
21686 | if (typeof decoded.exp === 'undefined') {
|
21687 | return null;
|
21688 | }
|
21689 | const d = new Date(0);
|
21690 | d.setUTCSeconds(decoded.exp);
|
21691 | return d;
|
21692 | }
|
21693 | tokenSecondsRemaining(offsetSeconds = 0) {
|
21694 | const d = this.getTokenExpirationDate();
|
21695 | if (d == null) {
|
21696 | return 0;
|
21697 | }
|
21698 | const msRemaining = d.valueOf() - (new Date().valueOf() + (offsetSeconds * 1000));
|
21699 | return Math.round(msRemaining / 1000);
|
21700 | }
|
21701 | tokenNeedsRefresh(minutes = 5) {
|
21702 | const sRemaining = this.tokenSecondsRemaining();
|
21703 | return sRemaining < (60 * minutes);
|
21704 | }
|
21705 | getUserId() {
|
21706 | const decoded = this.decodeToken();
|
21707 | if (typeof decoded.sub === 'undefined') {
|
21708 | throw new Error('No user id found');
|
21709 | }
|
21710 | return decoded.sub;
|
21711 | }
|
21712 | getEmail() {
|
21713 | const decoded = this.decodeToken();
|
21714 | if (typeof decoded.email === 'undefined') {
|
21715 | throw new Error('No email found');
|
21716 | }
|
21717 | return decoded.email;
|
21718 | }
|
21719 | getEmailVerified() {
|
21720 | const decoded = this.decodeToken();
|
21721 | if (typeof decoded.email_verified === 'undefined') {
|
21722 | throw new Error('No email verification found');
|
21723 | }
|
21724 | return decoded.email_verified;
|
21725 | }
|
21726 | getName() {
|
21727 | const decoded = this.decodeToken();
|
21728 | if (typeof decoded.name === 'undefined') {
|
21729 | return null;
|
21730 | }
|
21731 | return decoded.name;
|
21732 | }
|
21733 | getPremium() {
|
21734 | const decoded = this.decodeToken();
|
21735 | if (typeof decoded.premium === 'undefined') {
|
21736 | return false;
|
21737 | }
|
21738 | return decoded.premium;
|
21739 | }
|
21740 | getIssuer() {
|
21741 | const decoded = this.decodeToken();
|
21742 | if (typeof decoded.iss === 'undefined') {
|
21743 | throw new Error('No issuer found');
|
21744 | }
|
21745 | return decoded.iss;
|
21746 | }
|
21747 | skipTokenStorage() {
|
21748 | return token_service_awaiter(this, void 0, void 0, function* () {
|
21749 | const timeout = yield this.storageService.get(ConstantsService.vaultTimeoutKey);
|
21750 | const action = yield this.storageService.get(ConstantsService.vaultTimeoutActionKey);
|
21751 | return timeout != null && action === 'logOut';
|
21752 | });
|
21753 | }
|
21754 | }
|
21755 |
|
21756 |
|
21757 | var totp_service_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
21758 | return new (P || (P = Promise))(function (resolve, reject) {
|
21759 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
21760 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
21761 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
21762 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
21763 | });
|
21764 | };
|
21765 |
|
21766 |
|
21767 | const B32Chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';
|
21768 | const SteamChars = '23456789BCDFGHJKMNPQRTVWXY';
|
21769 | class totp_service_TotpService {
|
21770 | constructor(storageService, cryptoFunctionService) {
|
21771 | this.storageService = storageService;
|
21772 | this.cryptoFunctionService = cryptoFunctionService;
|
21773 | }
|
21774 | getCode(key) {
|
21775 | return totp_service_awaiter(this, void 0, void 0, function* () {
|
21776 | if (key == null) {
|
21777 | return null;
|
21778 | }
|
21779 | let period = 30;
|
21780 | let alg = 'sha1';
|
21781 | let digits = 6;
|
21782 | let keyB32 = key;
|
21783 | const isOtpAuth = key.toLowerCase().indexOf('otpauth://') === 0;
|
21784 | const isSteamAuth = !isOtpAuth && key.toLowerCase().indexOf('steam://') === 0;
|
21785 | if (isOtpAuth) {
|
21786 | const params = utils_Utils.getQueryParams(key);
|
21787 | if (params.has('digits') && params.get('digits') != null) {
|
21788 | try {
|
21789 | const digitParams = parseInt(params.get('digits').trim(), null);
|
21790 | if (digitParams > 10) {
|
21791 | digits = 10;
|
21792 | }
|
21793 | else if (digitParams > 0) {
|
21794 | digits = digitParams;
|
21795 | }
|
21796 | }
|
21797 | catch (_a) { }
|
21798 | }
|
21799 | if (params.has('period') && params.get('period') != null) {
|
21800 | try {
|
21801 | const periodParam = parseInt(params.get('period').trim(), null);
|
21802 | if (periodParam > 0) {
|
21803 | period = periodParam;
|
21804 | }
|
21805 | }
|
21806 | catch (_b) { }
|
21807 | }
|
21808 | if (params.has('secret') && params.get('secret') != null) {
|
21809 | keyB32 = params.get('secret');
|
21810 | }
|
21811 | if (params.has('algorithm') && params.get('algorithm') != null) {
|
21812 | const algParam = params.get('algorithm').toLowerCase();
|
21813 | if (algParam === 'sha1' || algParam === 'sha256' || algParam === 'sha512') {
|
21814 | alg = algParam;
|
21815 | }
|
21816 | }
|
21817 | }
|
21818 | else if (isSteamAuth) {
|
21819 | keyB32 = key.substr('steam://'.length);
|
21820 | digits = 5;
|
21821 | }
|
21822 | const epoch = Math.round(new Date().getTime() / 1000.0);
|
21823 | const timeHex = this.leftPad(this.decToHex(Math.floor(epoch / period)), 16, '0');
|
21824 | const timeBytes = utils_Utils.fromHexToArray(timeHex);
|
21825 | const keyBytes = this.b32ToBytes(keyB32);
|
21826 | if (!keyBytes.length || !timeBytes.length) {
|
21827 | return null;
|
21828 | }
|
21829 | const hash = yield this.sign(keyBytes, timeBytes, alg);
|
21830 | if (hash.length === 0) {
|
21831 | return null;
|
21832 | }
|
21833 |
|
21834 | const offset = (hash[hash.length - 1] & 0xf);
|
21835 | const binary = ((hash[offset] & 0x7f) << 24) | ((hash[offset + 1] & 0xff) << 16) |
|
21836 | ((hash[offset + 2] & 0xff) << 8) | (hash[offset + 3] & 0xff);
|
21837 |
|
21838 | let otp = '';
|
21839 | if (isSteamAuth) {
|
21840 |
|
21841 | let fullCode = binary & 0x7fffffff;
|
21842 | for (let i = 0; i < digits; i++) {
|
21843 | otp += SteamChars[fullCode % SteamChars.length];
|
21844 | fullCode = Math.trunc(fullCode / SteamChars.length);
|
21845 | }
|
21846 | }
|
21847 | else {
|
21848 | otp = (binary % Math.pow(10, digits)).toString();
|
21849 | otp = this.leftPad(otp, digits, '0');
|
21850 | }
|
21851 | return otp;
|
21852 | });
|
21853 | }
|
21854 | getTimeInterval(key) {
|
21855 | let period = 30;
|
21856 | if (key != null && key.toLowerCase().indexOf('otpauth://') === 0) {
|
21857 | const params = utils_Utils.getQueryParams(key);
|
21858 | if (params.has('period') && params.get('period') != null) {
|
21859 | try {
|
21860 | period = parseInt(params.get('period').trim(), null);
|
21861 | }
|
21862 | catch (_a) { }
|
21863 | }
|
21864 | }
|
21865 | return period;
|
21866 | }
|
21867 | isAutoCopyEnabled() {
|
21868 | return totp_service_awaiter(this, void 0, void 0, function* () {
|
21869 | return !(yield this.storageService.get(ConstantsService.disableAutoTotpCopyKey));
|
21870 | });
|
21871 | }
|
21872 |
|
21873 | leftPad(s, l, p) {
|
21874 | if (l + 1 >= s.length) {
|
21875 | s = Array(l + 1 - s.length).join(p) + s;
|
21876 | }
|
21877 | return s;
|
21878 | }
|
21879 | decToHex(d) {
|
21880 | return (d < 15.5 ? '0' : '') + Math.round(d).toString(16);
|
21881 | }
|
21882 | b32ToHex(s) {
|
21883 | s = s.toUpperCase();
|
21884 | let cleanedInput = '';
|
21885 | for (let i = 0; i < s.length; i++) {
|
21886 | if (B32Chars.indexOf(s[i]) < 0) {
|
21887 | continue;
|
21888 | }
|
21889 | cleanedInput += s[i];
|
21890 | }
|
21891 | s = cleanedInput;
|
21892 | let bits = '';
|
21893 | let hex = '';
|
21894 | for (let i = 0; i < s.length; i++) {
|
21895 | const byteIndex = B32Chars.indexOf(s.charAt(i));
|
21896 | if (byteIndex < 0) {
|
21897 | continue;
|
21898 | }
|
21899 | bits += this.leftPad(byteIndex.toString(2), 5, '0');
|
21900 | }
|
21901 | for (let i = 0; i + 4 <= bits.length; i += 4) {
|
21902 | const chunk = bits.substr(i, 4);
|
21903 | hex = hex + parseInt(chunk, 2).toString(16);
|
21904 | }
|
21905 | return hex;
|
21906 | }
|
21907 | b32ToBytes(s) {
|
21908 | return utils_Utils.fromHexToArray(this.b32ToHex(s));
|
21909 | }
|
21910 | sign(keyBytes, timeBytes, alg) {
|
21911 | return totp_service_awaiter(this, void 0, void 0, function* () {
|
21912 | const signature = yield this.cryptoFunctionService.hmac(timeBytes.buffer, keyBytes.buffer, alg);
|
21913 | return new Uint8Array(signature);
|
21914 | });
|
21915 | }
|
21916 | }
|
21917 |
|
21918 |
|
21919 | var OrganizationUserStatusType;
|
21920 | (function (OrganizationUserStatusType) {
|
21921 | OrganizationUserStatusType[OrganizationUserStatusType["Invited"] = 0] = "Invited";
|
21922 | OrganizationUserStatusType[OrganizationUserStatusType["Accepted"] = 1] = "Accepted";
|
21923 | OrganizationUserStatusType[OrganizationUserStatusType["Confirmed"] = 2] = "Confirmed";
|
21924 | })(OrganizationUserStatusType || (OrganizationUserStatusType = {}));
|
21925 |
|
21926 |
|
21927 | var OrganizationUserType;
|
21928 | (function (OrganizationUserType) {
|
21929 | OrganizationUserType[OrganizationUserType["Owner"] = 0] = "Owner";
|
21930 | OrganizationUserType[OrganizationUserType["Admin"] = 1] = "Admin";
|
21931 | OrganizationUserType[OrganizationUserType["User"] = 2] = "User";
|
21932 | OrganizationUserType[OrganizationUserType["Manager"] = 3] = "Manager";
|
21933 | })(OrganizationUserType || (OrganizationUserType = {}));
|
21934 |
|
21935 |
|
21936 |
|
21937 |
|
21938 | class organization_Organization {
|
21939 | constructor(obj) {
|
21940 | if (obj == null) {
|
21941 | return;
|
21942 | }
|
21943 | this.id = obj.id;
|
21944 | this.name = obj.name;
|
21945 | this.status = obj.status;
|
21946 | this.type = obj.type;
|
21947 | this.enabled = obj.enabled;
|
21948 | this.usePolicies = obj.usePolicies;
|
21949 | this.useGroups = obj.useGroups;
|
21950 | this.useDirectory = obj.useDirectory;
|
21951 | this.useEvents = obj.useEvents;
|
21952 | this.useTotp = obj.useTotp;
|
21953 | this.use2fa = obj.use2fa;
|
21954 | this.useApi = obj.useApi;
|
21955 | this.selfHost = obj.selfHost;
|
21956 | this.usersGetPremium = obj.usersGetPremium;
|
21957 | this.seats = obj.seats;
|
21958 | this.maxCollections = obj.maxCollections;
|
21959 | this.maxStorageGb = obj.maxStorageGb;
|
21960 | }
|
21961 | get canAccess() {
|
21962 | if (this.type === OrganizationUserType.Owner) {
|
21963 | return true;
|
21964 | }
|
21965 | return this.enabled && this.status === OrganizationUserStatusType.Confirmed;
|
21966 | }
|
21967 | get isManager() {
|
21968 | return this.type === OrganizationUserType.Manager || this.type === OrganizationUserType.Owner ||
|
21969 | this.type === OrganizationUserType.Admin;
|
21970 | }
|
21971 | get isAdmin() {
|
21972 | return this.type === OrganizationUserType.Owner || this.type === OrganizationUserType.Admin;
|
21973 | }
|
21974 | get isOwner() {
|
21975 | return this.type === OrganizationUserType.Owner;
|
21976 | }
|
21977 | }
|
21978 |
|
21979 |
|
21980 | var user_service_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
21981 | return new (P || (P = Promise))(function (resolve, reject) {
|
21982 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
21983 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
21984 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
21985 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
21986 | });
|
21987 | };
|
21988 |
|
21989 | const user_service_Keys = {
|
21990 | userId: 'userId',
|
21991 | userEmail: 'userEmail',
|
21992 | stamp: 'securityStamp',
|
21993 | kdf: 'kdf',
|
21994 | kdfIterations: 'kdfIterations',
|
21995 | organizationsPrefix: 'organizations_',
|
21996 | };
|
21997 | class user_service_UserService {
|
21998 | constructor(tokenService, storageService) {
|
21999 | this.tokenService = tokenService;
|
22000 | this.storageService = storageService;
|
22001 | }
|
22002 | setInformation(userId, email, kdf, kdfIterations) {
|
22003 | this.email = email;
|
22004 | this.userId = userId;
|
22005 | this.kdf = kdf;
|
22006 | this.kdfIterations = kdfIterations;
|
22007 | return Promise.all([
|
22008 | this.storageService.save(user_service_Keys.userEmail, email),
|
22009 | this.storageService.save(user_service_Keys.userId, userId),
|
22010 | this.storageService.save(user_service_Keys.kdf, kdf),
|
22011 | this.storageService.save(user_service_Keys.kdfIterations, kdfIterations),
|
22012 | ]);
|
22013 | }
|
22014 | setSecurityStamp(stamp) {
|
22015 | this.stamp = stamp;
|
22016 | return this.storageService.save(user_service_Keys.stamp, stamp);
|
22017 | }
|
22018 | getUserId() {
|
22019 | return user_service_awaiter(this, void 0, void 0, function* () {
|
22020 | if (this.userId == null) {
|
22021 | this.userId = yield this.storageService.get(user_service_Keys.userId);
|
22022 | }
|
22023 | return this.userId;
|
22024 | });
|
22025 | }
|
22026 | getEmail() {
|
22027 | return user_service_awaiter(this, void 0, void 0, function* () {
|
22028 | if (this.email == null) {
|
22029 | this.email = yield this.storageService.get(user_service_Keys.userEmail);
|
22030 | }
|
22031 | return this.email;
|
22032 | });
|
22033 | }
|
22034 | getSecurityStamp() {
|
22035 | return user_service_awaiter(this, void 0, void 0, function* () {
|
22036 | if (this.stamp == null) {
|
22037 | this.stamp = yield this.storageService.get(user_service_Keys.stamp);
|
22038 | }
|
22039 | return this.stamp;
|
22040 | });
|
22041 | }
|
22042 | getKdf() {
|
22043 | return user_service_awaiter(this, void 0, void 0, function* () {
|
22044 | if (this.kdf == null) {
|
22045 | this.kdf = yield this.storageService.get(user_service_Keys.kdf);
|
22046 | }
|
22047 | return this.kdf;
|
22048 | });
|
22049 | }
|
22050 | getKdfIterations() {
|
22051 | return user_service_awaiter(this, void 0, void 0, function* () {
|
22052 | if (this.kdfIterations == null) {
|
22053 | this.kdfIterations = yield this.storageService.get(user_service_Keys.kdfIterations);
|
22054 | }
|
22055 | return this.kdfIterations;
|
22056 | });
|
22057 | }
|
22058 | clear() {
|
22059 | return user_service_awaiter(this, void 0, void 0, function* () {
|
22060 | const userId = yield this.getUserId();
|
22061 | yield Promise.all([
|
22062 | this.storageService.remove(user_service_Keys.userId),
|
22063 | this.storageService.remove(user_service_Keys.userEmail),
|
22064 | this.storageService.remove(user_service_Keys.stamp),
|
22065 | this.storageService.remove(user_service_Keys.kdf),
|
22066 | this.storageService.remove(user_service_Keys.kdfIterations),
|
22067 | this.clearOrganizations(userId),
|
22068 | ]);
|
22069 | this.userId = this.email = this.stamp = null;
|
22070 | this.kdf = null;
|
22071 | this.kdfIterations = null;
|
22072 | });
|
22073 | }
|
22074 | isAuthenticated() {
|
22075 | return user_service_awaiter(this, void 0, void 0, function* () {
|
22076 | const token = yield this.tokenService.getToken();
|
22077 | if (token == null) {
|
22078 | return false;
|
22079 | }
|
22080 | const userId = yield this.getUserId();
|
22081 | return userId != null;
|
22082 | });
|
22083 | }
|
22084 | canAccessPremium() {
|
22085 | return user_service_awaiter(this, void 0, void 0, function* () {
|
22086 | const tokenPremium = this.tokenService.getPremium();
|
22087 | if (tokenPremium) {
|
22088 | return true;
|
22089 | }
|
22090 | const orgs = yield this.getAllOrganizations();
|
22091 | for (let i = 0; i < orgs.length; i++) {
|
22092 | if (orgs[i].usersGetPremium && orgs[i].enabled) {
|
22093 | return true;
|
22094 | }
|
22095 | }
|
22096 | return false;
|
22097 | });
|
22098 | }
|
22099 | getOrganization(id) {
|
22100 | return user_service_awaiter(this, void 0, void 0, function* () {
|
22101 | const userId = yield this.getUserId();
|
22102 | const organizations = yield this.storageService.get(user_service_Keys.organizationsPrefix + userId);
|
22103 | if (organizations == null || !organizations.hasOwnProperty(id)) {
|
22104 | return null;
|
22105 | }
|
22106 | return new organization_Organization(organizations[id]);
|
22107 | });
|
22108 | }
|
22109 | getAllOrganizations() {
|
22110 | return user_service_awaiter(this, void 0, void 0, function* () {
|
22111 | const userId = yield this.getUserId();
|
22112 | const organizations = yield this.storageService.get(user_service_Keys.organizationsPrefix + userId);
|
22113 | const response = [];
|
22114 | for (const id in organizations) {
|
22115 | if (organizations.hasOwnProperty(id)) {
|
22116 | response.push(new organization_Organization(organizations[id]));
|
22117 | }
|
22118 | }
|
22119 | return response;
|
22120 | });
|
22121 | }
|
22122 | replaceOrganizations(organizations) {
|
22123 | return user_service_awaiter(this, void 0, void 0, function* () {
|
22124 | const userId = yield this.getUserId();
|
22125 | yield this.storageService.save(user_service_Keys.organizationsPrefix + userId, organizations);
|
22126 | });
|
22127 | }
|
22128 | clearOrganizations(userId) {
|
22129 | return user_service_awaiter(this, void 0, void 0, function* () {
|
22130 | yield this.storageService.remove(user_service_Keys.organizationsPrefix + userId);
|
22131 | });
|
22132 | }
|
22133 | }
|
22134 |
|
22135 |
|
22136 | var vaultTimeout_service_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
22137 | return new (P || (P = Promise))(function (resolve, reject) {
|
22138 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
22139 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
22140 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
22141 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
22142 | });
|
22143 | };
|
22144 |
|
22145 | class vaultTimeout_service_VaultTimeoutService {
|
22146 | constructor(cipherService, folderService, collectionService, cryptoService, platformUtilsService, storageService, messagingService, searchService, userService, tokenService, lockedCallback = null, loggedOutCallback = null) {
|
22147 | this.cipherService = cipherService;
|
22148 | this.folderService = folderService;
|
22149 | this.collectionService = collectionService;
|
22150 | this.cryptoService = cryptoService;
|
22151 | this.platformUtilsService = platformUtilsService;
|
22152 | this.storageService = storageService;
|
22153 | this.messagingService = messagingService;
|
22154 | this.searchService = searchService;
|
22155 | this.userService = userService;
|
22156 | this.tokenService = tokenService;
|
22157 | this.lockedCallback = lockedCallback;
|
22158 | this.loggedOutCallback = loggedOutCallback;
|
22159 | this.pinProtectedKey = null;
|
22160 | this.inited = false;
|
22161 | }
|
22162 | init(checkOnInterval) {
|
22163 | if (this.inited) {
|
22164 | return;
|
22165 | }
|
22166 | this.inited = true;
|
22167 | if (checkOnInterval) {
|
22168 | this.checkVaultTimeout();
|
22169 | setInterval(() => this.checkVaultTimeout(), 10 * 1000);
|
22170 | }
|
22171 | }
|
22172 |
|
22173 | isLocked() {
|
22174 | return vaultTimeout_service_awaiter(this, void 0, void 0, function* () {
|
22175 | const hasKey = yield this.cryptoService.hasKey();
|
22176 | return !hasKey;
|
22177 | });
|
22178 | }
|
22179 | checkVaultTimeout() {
|
22180 | return vaultTimeout_service_awaiter(this, void 0, void 0, function* () {
|
22181 | if (yield this.platformUtilsService.isViewOpen()) {
|
22182 |
|
22183 | return;
|
22184 | }
|
22185 |
|
22186 | const authed = yield this.userService.isAuthenticated();
|
22187 | if (!authed) {
|
22188 | return;
|
22189 | }
|
22190 | if (yield this.isLocked()) {
|
22191 | return;
|
22192 | }
|
22193 |
|
22194 | let vaultTimeout = this.platformUtilsService.lockTimeout();
|
22195 | if (vaultTimeout == null) {
|
22196 | vaultTimeout = yield this.storageService.get(ConstantsService.vaultTimeoutKey);
|
22197 | }
|
22198 | if (vaultTimeout == null || vaultTimeout < 0) {
|
22199 | return;
|
22200 | }
|
22201 | const lastActive = yield this.storageService.get(ConstantsService.lastActiveKey);
|
22202 | if (lastActive == null) {
|
22203 | return;
|
22204 | }
|
22205 | const vaultTimeoutSeconds = vaultTimeout * 60;
|
22206 | const diffSeconds = ((new Date()).getTime() - lastActive) / 1000;
|
22207 | if (diffSeconds >= vaultTimeoutSeconds) {
|
22208 |
|
22209 | const timeoutAction = yield this.storageService.get(ConstantsService.vaultTimeoutActionKey);
|
22210 | timeoutAction === 'logOut' ? yield this.logOut() : yield this.lock(true);
|
22211 | }
|
22212 | });
|
22213 | }
|
22214 | lock(allowSoftLock = false) {
|
22215 | return vaultTimeout_service_awaiter(this, void 0, void 0, function* () {
|
22216 | const authed = yield this.userService.isAuthenticated();
|
22217 | if (!authed) {
|
22218 | return;
|
22219 | }
|
22220 | yield Promise.all([
|
22221 | this.cryptoService.clearKey(),
|
22222 | this.cryptoService.clearOrgKeys(true),
|
22223 | this.cryptoService.clearKeyPair(true),
|
22224 | this.cryptoService.clearEncKey(true),
|
22225 | ]);
|
22226 | this.folderService.clearCache();
|
22227 | this.cipherService.clearCache();
|
22228 | this.collectionService.clearCache();
|
22229 | this.searchService.clearIndex();
|
22230 | this.messagingService.send('locked');
|
22231 | if (this.lockedCallback != null) {
|
22232 | yield this.lockedCallback();
|
22233 | }
|
22234 | });
|
22235 | }
|
22236 | logOut() {
|
22237 | return vaultTimeout_service_awaiter(this, void 0, void 0, function* () {
|
22238 | if (this.loggedOutCallback != null) {
|
22239 | yield this.loggedOutCallback();
|
22240 | }
|
22241 | });
|
22242 | }
|
22243 | setVaultTimeoutOptions(timeout, action) {
|
22244 | return vaultTimeout_service_awaiter(this, void 0, void 0, function* () {
|
22245 | yield this.storageService.save(ConstantsService.vaultTimeoutKey, timeout);
|
22246 | yield this.storageService.save(ConstantsService.vaultTimeoutActionKey, action);
|
22247 | yield this.cryptoService.toggleKey();
|
22248 | yield this.tokenService.toggleTokens();
|
22249 | });
|
22250 | }
|
22251 | isPinLockSet() {
|
22252 | return vaultTimeout_service_awaiter(this, void 0, void 0, function* () {
|
22253 | const protectedPin = yield this.storageService.get(ConstantsService.protectedPin);
|
22254 | const pinProtectedKey = yield this.storageService.get(ConstantsService.pinProtectedKey);
|
22255 | return [protectedPin != null, pinProtectedKey != null];
|
22256 | });
|
22257 | }
|
22258 | clear() {
|
22259 | this.pinProtectedKey = null;
|
22260 | return this.storageService.remove(ConstantsService.protectedPin);
|
22261 | }
|
22262 | }
|
22263 |
|
22264 |
|
22265 | var external_chalk_ = __webpack_require__(10);
|
22266 | var external_chalk_default = __webpack_require__.n(external_chalk_);
|
22267 |
|
22268 |
|
22269 | var external_commander_ = __webpack_require__(0);
|
22270 |
|
22271 |
|
22272 | class Response {
|
22273 | static error(error, data) {
|
22274 | const res = new Response();
|
22275 | res.success = false;
|
22276 | if (typeof (error) === 'string') {
|
22277 | res.message = error;
|
22278 | }
|
22279 | else {
|
22280 | res.message = error.message != null ? error.message : error.toString();
|
22281 | }
|
22282 | res.data = data;
|
22283 | return res;
|
22284 | }
|
22285 | static notFound() {
|
22286 | return Response.error('Not found.');
|
22287 | }
|
22288 | static badRequest(message) {
|
22289 | return Response.error(message);
|
22290 | }
|
22291 | static multipleResults(ids) {
|
22292 | let msg = 'More than one result was found. Try getting a specific object by `id` instead. ' +
|
22293 | 'The following objects were found:';
|
22294 | ids.forEach((id) => {
|
22295 | msg += '\n' + id;
|
22296 | });
|
22297 | return Response.error(msg, ids);
|
22298 | }
|
22299 | static success(data) {
|
22300 | const res = new Response();
|
22301 | res.success = true;
|
22302 | res.data = data;
|
22303 | return res;
|
22304 | }
|
22305 | }
|
22306 |
|
22307 |
|
22308 | class MessageResponse {
|
22309 | constructor(title, message) {
|
22310 | this.noColor = false;
|
22311 | this.object = 'message';
|
22312 | this.title = title;
|
22313 | this.message = message;
|
22314 | }
|
22315 | }
|
22316 |
|
22317 |
|
22318 | class StringResponse {
|
22319 | constructor(data) {
|
22320 | this.object = 'string';
|
22321 | this.data = data;
|
22322 | }
|
22323 | }
|
22324 |
|
22325 |
|
22326 | var config_command_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
22327 | return new (P || (P = Promise))(function (resolve, reject) {
|
22328 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
22329 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
22330 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
22331 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
22332 | });
|
22333 | };
|
22334 |
|
22335 |
|
22336 |
|
22337 | class config_command_ConfigCommand {
|
22338 | constructor(environmentService) {
|
22339 | this.environmentService = environmentService;
|
22340 | }
|
22341 | run(setting, value, cmd) {
|
22342 | return config_command_awaiter(this, void 0, void 0, function* () {
|
22343 | setting = setting.toLowerCase();
|
22344 | switch (setting) {
|
22345 | case 'server':
|
22346 | return yield this.getOrSetServer(value, cmd);
|
22347 | default:
|
22348 | return Response.badRequest('Unknown setting.');
|
22349 | }
|
22350 | });
|
22351 | }
|
22352 | getOrSetServer(url, cmd) {
|
22353 | return config_command_awaiter(this, void 0, void 0, function* () {
|
22354 | if ((url == null || url.trim() === '') &&
|
22355 | !cmd.webVault && !cmd.api && !cmd.identity && !cmd.icons && !cmd.notifications && !cmd.events) {
|
22356 | const baseUrl = this.environmentService.baseUrl;
|
22357 | const stringRes = new StringResponse(baseUrl == null ? 'https://bitwarden.com' : baseUrl);
|
22358 | return Response.success(stringRes);
|
22359 | }
|
22360 | url = (url === 'null' || url === 'bitwarden.com' || url === 'https://bitwarden.com' ? null : url);
|
22361 | yield this.environmentService.setUrls({
|
22362 | base: url,
|
22363 | webVault: cmd.webVault || null,
|
22364 | api: cmd.api || null,
|
22365 | identity: cmd.identity || null,
|
22366 | icons: cmd.icons || null,
|
22367 | notifications: cmd.notifications || null,
|
22368 | events: cmd.events || null,
|
22369 | });
|
22370 | const res = new MessageResponse('Saved setting `config`.', null);
|
22371 | return Response.success(res);
|
22372 | });
|
22373 | }
|
22374 | }
|
22375 |
|
22376 |
|
22377 | class OrganizationUserConfirmRequest {
|
22378 | }
|
22379 |
|
22380 |
|
22381 | var confirm_command_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
22382 | return new (P || (P = Promise))(function (resolve, reject) {
|
22383 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
22384 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
22385 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
22386 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
22387 | });
|
22388 | };
|
22389 |
|
22390 |
|
22391 |
|
22392 | class confirm_command_ConfirmCommand {
|
22393 | constructor(apiService, cryptoService) {
|
22394 | this.apiService = apiService;
|
22395 | this.cryptoService = cryptoService;
|
22396 | }
|
22397 | run(object, id, cmd) {
|
22398 | return confirm_command_awaiter(this, void 0, void 0, function* () {
|
22399 | if (id != null) {
|
22400 | id = id.toLowerCase();
|
22401 | }
|
22402 | switch (object.toLowerCase()) {
|
22403 | case 'org-member':
|
22404 | return yield this.confirmOrganizationMember(id, cmd);
|
22405 | default:
|
22406 | return Response.badRequest('Unknown object.');
|
22407 | }
|
22408 | });
|
22409 | }
|
22410 | confirmOrganizationMember(id, cmd) {
|
22411 | return confirm_command_awaiter(this, void 0, void 0, function* () {
|
22412 | if (cmd.organizationid == null || cmd.organizationid === '') {
|
22413 | return Response.badRequest('--organizationid <organizationid> required.');
|
22414 | }
|
22415 | if (!utils_Utils.isGuid(id)) {
|
22416 | return Response.error('`' + id + '` is not a GUID.');
|
22417 | }
|
22418 | if (!utils_Utils.isGuid(cmd.organizationid)) {
|
22419 | return Response.error('`' + cmd.organizationid + '` is not a GUID.');
|
22420 | }
|
22421 | try {
|
22422 | const orgKey = yield this.cryptoService.getOrgKey(cmd.organizationid);
|
22423 | if (orgKey == null) {
|
22424 | throw new Error('No encryption key for this organization.');
|
22425 | }
|
22426 | const orgUser = yield this.apiService.getOrganizationUser(cmd.organizationid, id);
|
22427 | if (orgUser == null) {
|
22428 | throw new Error('Member id does not exist for this organization.');
|
22429 | }
|
22430 | const publicKeyResponse = yield this.apiService.getUserPublicKey(orgUser.userId);
|
22431 | const publicKey = utils_Utils.fromB64ToArray(publicKeyResponse.publicKey);
|
22432 | const key = yield this.cryptoService.rsaEncrypt(orgKey.key, publicKey.buffer);
|
22433 | const req = new OrganizationUserConfirmRequest();
|
22434 | req.key = key.encryptedString;
|
22435 | yield this.apiService.postOrganizationUserConfirm(cmd.organizationid, id, req);
|
22436 | return Response.success();
|
22437 | }
|
22438 | catch (e) {
|
22439 | return Response.error(e);
|
22440 | }
|
22441 | });
|
22442 | }
|
22443 | }
|
22444 |
|
22445 |
|
22446 | class SelectionReadOnlyRequest {
|
22447 | constructor(id, readOnly) {
|
22448 | this.id = id;
|
22449 | this.readOnly = readOnly;
|
22450 | }
|
22451 | }
|
22452 |
|
22453 |
|
22454 | class response_attachmentResponse_AttachmentResponse {
|
22455 | constructor(o) {
|
22456 | this.id = o.id;
|
22457 | this.fileName = o.fileName;
|
22458 | this.size = o.size;
|
22459 | this.sizeName = o.sizeName;
|
22460 | this.url = o.url;
|
22461 | }
|
22462 | }
|
22463 |
|
22464 |
|
22465 |
|
22466 | class loginResponse_LoginResponse extends export_login_Login {
|
22467 | constructor(o) {
|
22468 | super(o);
|
22469 | this.passwordRevisionDate = o.passwordRevisionDate != null ? o.passwordRevisionDate : null;
|
22470 | }
|
22471 | }
|
22472 |
|
22473 |
|
22474 | class response_passwordHistoryResponse_PasswordHistoryResponse {
|
22475 | constructor(o) {
|
22476 | this.lastUsedDate = o.lastUsedDate;
|
22477 | this.password = o.password;
|
22478 | }
|
22479 | }
|
22480 |
|
22481 |
|
22482 | var LogLevelType;
|
22483 | (function (LogLevelType) {
|
22484 | LogLevelType[LogLevelType["Debug"] = 0] = "Debug";
|
22485 | LogLevelType[LogLevelType["Info"] = 1] = "Info";
|
22486 | LogLevelType[LogLevelType["Warning"] = 2] = "Warning";
|
22487 | LogLevelType[LogLevelType["Error"] = 3] = "Error";
|
22488 | })(LogLevelType || (LogLevelType = {}));
|
22489 |
|
22490 |
|
22491 |
|
22492 |
|
22493 |
|
22494 |
|
22495 |
|
22496 |
|
22497 |
|
22498 |
|
22499 |
|
22500 |
|
22501 |
|
22502 |
|
22503 |
|
22504 |
|
22505 |
|
22506 | class response_cipherResponse_CipherResponse extends cipherWithIds_CipherWithIds {
|
22507 | constructor(o) {
|
22508 | super();
|
22509 | this.object = 'item';
|
22510 | this.build(o);
|
22511 | if (o.attachments != null) {
|
22512 | this.attachments = o.attachments.map((a) => new response_attachmentResponse_AttachmentResponse(a));
|
22513 | }
|
22514 | this.revisionDate = o.revisionDate;
|
22515 | if (o.passwordHistory != null) {
|
22516 | this.passwordHistory = o.passwordHistory.map((h) => new response_passwordHistoryResponse_PasswordHistoryResponse(h));
|
22517 | }
|
22518 | if (o.type === CipherType.Login && o.login != null) {
|
22519 | this.login = new loginResponse_LoginResponse(o.login);
|
22520 | }
|
22521 | }
|
22522 | }
|
22523 |
|
22524 |
|
22525 |
|
22526 | class response_folderResponse_FolderResponse extends folderWithId_FolderWithId {
|
22527 | constructor(o) {
|
22528 | super();
|
22529 | this.object = 'folder';
|
22530 | this.build(o);
|
22531 | }
|
22532 | }
|
22533 |
|
22534 |
|
22535 |
|
22536 | class response_collectionResponse_CollectionResponse extends collectionWithId_CollectionWithId {
|
22537 | constructor(o) {
|
22538 | super();
|
22539 | this.object = 'collection';
|
22540 | this.build(o);
|
22541 | }
|
22542 | }
|
22543 |
|
22544 |
|
22545 |
|
22546 | class organizationCollectionResponse_OrganizationCollectionResponse extends response_collectionResponse_CollectionResponse {
|
22547 | constructor(o, groups) {
|
22548 | super(o);
|
22549 | this.object = 'org-collection';
|
22550 | this.groups = groups;
|
22551 | }
|
22552 | }
|
22553 |
|
22554 |
|
22555 |
|
22556 |
|
22557 |
|
22558 | class utils_CliUtils {
|
22559 | static writeLn(s, finalLine = false, error = false) {
|
22560 | const stream = error ? process.stderr : process.stdout;
|
22561 | if (finalLine && (process.platform === 'win32' || !stream.isTTY)) {
|
22562 | stream.write(s);
|
22563 | }
|
22564 | else {
|
22565 | stream.write(s + '\n');
|
22566 | }
|
22567 | }
|
22568 | static readFile(input) {
|
22569 | return new Promise((resolve, reject) => {
|
22570 | let p = null;
|
22571 | if (input != null && input !== '') {
|
22572 | const osInput = external_path_["join"](input);
|
22573 | if (osInput.indexOf(external_path_["sep"]) === -1) {
|
22574 | p = external_path_["join"](process.cwd(), osInput);
|
22575 | }
|
22576 | else {
|
22577 | p = osInput;
|
22578 | }
|
22579 | }
|
22580 | else {
|
22581 | reject('You must specify a file path.');
|
22582 | }
|
22583 | external_fs_["readFile"](p, 'utf8', (err, data) => {
|
22584 | if (err != null) {
|
22585 | reject(err.message);
|
22586 | }
|
22587 | resolve(data);
|
22588 | });
|
22589 | });
|
22590 | }
|
22591 | static saveFile(data, output, defaultFileName) {
|
22592 | let p = null;
|
22593 | let mkdir = false;
|
22594 | if (output != null && output !== '') {
|
22595 | const osOutput = external_path_["join"](output);
|
22596 | if (osOutput.indexOf(external_path_["sep"]) === -1) {
|
22597 | p = external_path_["join"](process.cwd(), osOutput);
|
22598 | }
|
22599 | else {
|
22600 | mkdir = true;
|
22601 | if (osOutput.endsWith(external_path_["sep"])) {
|
22602 | p = external_path_["join"](osOutput, defaultFileName);
|
22603 | }
|
22604 | else {
|
22605 | p = osOutput;
|
22606 | }
|
22607 | }
|
22608 | }
|
22609 | else {
|
22610 | p = external_path_["join"](process.cwd(), defaultFileName);
|
22611 | }
|
22612 | p = external_path_["resolve"](p);
|
22613 | if (mkdir) {
|
22614 | const dir = p.substring(0, p.lastIndexOf(external_path_["sep"]));
|
22615 | if (!external_fs_["existsSync"](dir)) {
|
22616 | nodeUtils_NodeUtils.mkdirpSync(dir, '700');
|
22617 | }
|
22618 | }
|
22619 | return new Promise((resolve, reject) => {
|
22620 | external_fs_["writeFile"](p, data, 'utf8', (err) => {
|
22621 | if (err != null) {
|
22622 | reject('Cannot save file to ' + p);
|
22623 | }
|
22624 | resolve(p);
|
22625 | });
|
22626 | });
|
22627 | }
|
22628 | static readStdin() {
|
22629 | return new Promise((resolve, reject) => {
|
22630 | let input = '';
|
22631 | if (process.stdin.isTTY) {
|
22632 | resolve(input);
|
22633 | return;
|
22634 | }
|
22635 | process.stdin.setEncoding('utf8');
|
22636 | process.stdin.on('readable', () => {
|
22637 | while (true) {
|
22638 | const chunk = process.stdin.read();
|
22639 | if (chunk == null) {
|
22640 | break;
|
22641 | }
|
22642 | input += chunk;
|
22643 | }
|
22644 | });
|
22645 | process.stdin.on('end', () => {
|
22646 | resolve(input);
|
22647 | });
|
22648 | });
|
22649 | }
|
22650 | static searchFolders(folders, search) {
|
22651 | search = search.toLowerCase();
|
22652 | return folders.filter((f) => {
|
22653 | if (f.name != null && f.name.toLowerCase().indexOf(search) > -1) {
|
22654 | return true;
|
22655 | }
|
22656 | return false;
|
22657 | });
|
22658 | }
|
22659 | static searchCollections(collections, search) {
|
22660 | search = search.toLowerCase();
|
22661 | return collections.filter((c) => {
|
22662 | if (c.name != null && c.name.toLowerCase().indexOf(search) > -1) {
|
22663 | return true;
|
22664 | }
|
22665 | return false;
|
22666 | });
|
22667 | }
|
22668 | static searchOrganizations(organizations, search) {
|
22669 | search = search.toLowerCase();
|
22670 | return organizations.filter((o) => {
|
22671 | if (o.name != null && o.name.toLowerCase().indexOf(search) > -1) {
|
22672 | return true;
|
22673 | }
|
22674 | return false;
|
22675 | });
|
22676 | }
|
22677 | }
|
22678 |
|
22679 |
|
22680 | var create_command_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
22681 | return new (P || (P = Promise))(function (resolve, reject) {
|
22682 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
22683 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
22684 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
22685 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
22686 | });
|
22687 | };
|
22688 |
|
22689 |
|
22690 |
|
22691 |
|
22692 |
|
22693 |
|
22694 |
|
22695 |
|
22696 |
|
22697 |
|
22698 |
|
22699 |
|
22700 |
|
22701 | class create_command_CreateCommand {
|
22702 | constructor(cipherService, folderService, userService, cryptoService, apiService) {
|
22703 | this.cipherService = cipherService;
|
22704 | this.folderService = folderService;
|
22705 | this.userService = userService;
|
22706 | this.cryptoService = cryptoService;
|
22707 | this.apiService = apiService;
|
22708 | }
|
22709 | run(object, requestJson, cmd) {
|
22710 | return create_command_awaiter(this, void 0, void 0, function* () {
|
22711 | let req = null;
|
22712 | if (object !== 'attachment') {
|
22713 | if (requestJson == null || requestJson === '') {
|
22714 | requestJson = yield utils_CliUtils.readStdin();
|
22715 | }
|
22716 | if (requestJson == null || requestJson === '') {
|
22717 | return Response.badRequest('`requestJson` was not provided.');
|
22718 | }
|
22719 | try {
|
22720 | const reqJson = Buffer.from(requestJson, 'base64').toString();
|
22721 | req = JSON.parse(reqJson);
|
22722 | }
|
22723 | catch (e) {
|
22724 | return Response.badRequest('Error parsing the encoded request data.');
|
22725 | }
|
22726 | }
|
22727 | switch (object.toLowerCase()) {
|
22728 | case 'item':
|
22729 | return yield this.createCipher(req);
|
22730 | case 'attachment':
|
22731 | return yield this.createAttachment(cmd);
|
22732 | case 'folder':
|
22733 | return yield this.createFolder(req);
|
22734 | case 'org-collection':
|
22735 | return yield this.createOrganizationCollection(req, cmd);
|
22736 | default:
|
22737 | return Response.badRequest('Unknown object.');
|
22738 | }
|
22739 | });
|
22740 | }
|
22741 | createCipher(req) {
|
22742 | return create_command_awaiter(this, void 0, void 0, function* () {
|
22743 | const cipher = yield this.cipherService.encrypt(export_cipher_Cipher.toView(req));
|
22744 | try {
|
22745 | yield this.cipherService.saveWithServer(cipher);
|
22746 | const newCipher = yield this.cipherService.get(cipher.id);
|
22747 | const decCipher = yield newCipher.decrypt();
|
22748 | const res = new response_cipherResponse_CipherResponse(decCipher);
|
22749 | return Response.success(res);
|
22750 | }
|
22751 | catch (e) {
|
22752 | return Response.error(e);
|
22753 | }
|
22754 | });
|
22755 | }
|
22756 | createAttachment(cmd) {
|
22757 | return create_command_awaiter(this, void 0, void 0, function* () {
|
22758 | if (cmd.itemid == null || cmd.itemid === '') {
|
22759 | return Response.badRequest('--itemid <itemid> required.');
|
22760 | }
|
22761 | if (cmd.file == null || cmd.file === '') {
|
22762 | return Response.badRequest('--file <file> required.');
|
22763 | }
|
22764 | const filePath = external_path_["resolve"](cmd.file);
|
22765 | if (!external_fs_["existsSync"](cmd.file)) {
|
22766 | return Response.badRequest('Cannot find file at ' + filePath);
|
22767 | }
|
22768 | const itemId = cmd.itemid.toLowerCase();
|
22769 | const cipher = yield this.cipherService.get(itemId);
|
22770 | if (cipher == null) {
|
22771 | return Response.notFound();
|
22772 | }
|
22773 | if (cipher.organizationId == null && !(yield this.userService.canAccessPremium())) {
|
22774 | return Response.error('Premium status is required to use this feature.');
|
22775 | }
|
22776 | const encKey = yield this.cryptoService.getEncKey();
|
22777 | if (encKey == null) {
|
22778 | return Response.error('You must update your encryption key before you can use this feature. ' +
|
22779 | 'See https://help.bitwarden.com/article/update-encryption-key/');
|
22780 | }
|
22781 | try {
|
22782 | const fileBuf = external_fs_["readFileSync"](filePath);
|
22783 | yield this.cipherService.saveAttachmentRawWithServer(cipher, external_path_["basename"](filePath), new Uint8Array(fileBuf).buffer);
|
22784 | const updatedCipher = yield this.cipherService.get(cipher.id);
|
22785 | const decCipher = yield updatedCipher.decrypt();
|
22786 | const res = new response_cipherResponse_CipherResponse(decCipher);
|
22787 | return Response.success(res);
|
22788 | }
|
22789 | catch (e) {
|
22790 | return Response.error(e);
|
22791 | }
|
22792 | });
|
22793 | }
|
22794 | createFolder(req) {
|
22795 | return create_command_awaiter(this, void 0, void 0, function* () {
|
22796 | const folder = yield this.folderService.encrypt(export_folder_Folder.toView(req));
|
22797 | try {
|
22798 | yield this.folderService.saveWithServer(folder);
|
22799 | const newFolder = yield this.folderService.get(folder.id);
|
22800 | const decFolder = yield newFolder.decrypt();
|
22801 | const res = new response_folderResponse_FolderResponse(decFolder);
|
22802 | return Response.success(res);
|
22803 | }
|
22804 | catch (e) {
|
22805 | return Response.error(e);
|
22806 | }
|
22807 | });
|
22808 | }
|
22809 | createOrganizationCollection(req, cmd) {
|
22810 | return create_command_awaiter(this, void 0, void 0, function* () {
|
22811 | if (cmd.organizationid == null || cmd.organizationid === '') {
|
22812 | return Response.badRequest('--organizationid <organizationid> required.');
|
22813 | }
|
22814 | if (!utils_Utils.isGuid(cmd.organizationid)) {
|
22815 | return Response.error('`' + cmd.organizationid + '` is not a GUID.');
|
22816 | }
|
22817 | if (cmd.organizationid !== req.organizationId) {
|
22818 | return Response.error('--organizationid <organizationid> does not match request object.');
|
22819 | }
|
22820 | try {
|
22821 | const orgKey = yield this.cryptoService.getOrgKey(req.organizationId);
|
22822 | if (orgKey == null) {
|
22823 | throw new Error('No encryption key for this organization.');
|
22824 | }
|
22825 | const groups = req.groups == null ? null :
|
22826 | req.groups.map((g) => new SelectionReadOnlyRequest(g.id, g.readOnly));
|
22827 | const request = new CollectionRequest();
|
22828 | request.name = (yield this.cryptoService.encrypt(req.name, orgKey)).encryptedString;
|
22829 | request.externalId = req.externalId;
|
22830 | request.groups = groups;
|
22831 | yield this.apiService.postCollection(req.organizationId, request);
|
22832 | const res = new organizationCollectionResponse_OrganizationCollectionResponse(export_collection_Collection.toView(req), groups);
|
22833 | return Response.success(res);
|
22834 | }
|
22835 | catch (e) {
|
22836 | return Response.error(e);
|
22837 | }
|
22838 | });
|
22839 | }
|
22840 | }
|
22841 |
|
22842 |
|
22843 | var delete_command_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
22844 | return new (P || (P = Promise))(function (resolve, reject) {
|
22845 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
22846 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
22847 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
22848 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
22849 | });
|
22850 | };
|
22851 |
|
22852 |
|
22853 | class delete_command_DeleteCommand {
|
22854 | constructor(cipherService, folderService, userService, apiService) {
|
22855 | this.cipherService = cipherService;
|
22856 | this.folderService = folderService;
|
22857 | this.userService = userService;
|
22858 | this.apiService = apiService;
|
22859 | }
|
22860 | run(object, id, cmd) {
|
22861 | return delete_command_awaiter(this, void 0, void 0, function* () {
|
22862 | if (id != null) {
|
22863 | id = id.toLowerCase();
|
22864 | }
|
22865 | switch (object.toLowerCase()) {
|
22866 | case 'item':
|
22867 | return yield this.deleteCipher(id, cmd);
|
22868 | case 'attachment':
|
22869 | return yield this.deleteAttachment(id, cmd);
|
22870 | case 'folder':
|
22871 | return yield this.deleteFolder(id);
|
22872 | case 'org-collection':
|
22873 | return yield this.deleteOrganizationCollection(id, cmd);
|
22874 | default:
|
22875 | return Response.badRequest('Unknown object.');
|
22876 | }
|
22877 | });
|
22878 | }
|
22879 | deleteCipher(id, cmd) {
|
22880 | return delete_command_awaiter(this, void 0, void 0, function* () {
|
22881 | const cipher = yield this.cipherService.get(id);
|
22882 | if (cipher == null) {
|
22883 | return Response.notFound();
|
22884 | }
|
22885 | try {
|
22886 | if (cmd.permanent) {
|
22887 | yield this.cipherService.deleteWithServer(id);
|
22888 | }
|
22889 | else {
|
22890 | yield this.cipherService.softDeleteWithServer(id);
|
22891 | }
|
22892 | return Response.success();
|
22893 | }
|
22894 | catch (e) {
|
22895 | return Response.error(e);
|
22896 | }
|
22897 | });
|
22898 | }
|
22899 | deleteAttachment(id, cmd) {
|
22900 | return delete_command_awaiter(this, void 0, void 0, function* () {
|
22901 | if (cmd.itemid == null || cmd.itemid === '') {
|
22902 | return Response.badRequest('--itemid <itemid> required.');
|
22903 | }
|
22904 | const itemId = cmd.itemid.toLowerCase();
|
22905 | const cipher = yield this.cipherService.get(itemId);
|
22906 | if (cipher == null) {
|
22907 | return Response.notFound();
|
22908 | }
|
22909 | if (cipher.attachments == null || cipher.attachments.length === 0) {
|
22910 | return Response.error('No attachments available for this item.');
|
22911 | }
|
22912 | const attachments = cipher.attachments.filter((a) => a.id.toLowerCase() === id);
|
22913 | if (attachments.length === 0) {
|
22914 | return Response.error('Attachment `' + id + '` was not found.');
|
22915 | }
|
22916 | if (cipher.organizationId == null && !(yield this.userService.canAccessPremium())) {
|
22917 | return Response.error('Premium status is required to use this feature.');
|
22918 | }
|
22919 | try {
|
22920 | yield this.cipherService.deleteAttachmentWithServer(cipher.id, attachments[0].id);
|
22921 | return Response.success();
|
22922 | }
|
22923 | catch (e) {
|
22924 | return Response.error(e);
|
22925 | }
|
22926 | });
|
22927 | }
|
22928 | deleteFolder(id) {
|
22929 | return delete_command_awaiter(this, void 0, void 0, function* () {
|
22930 | const folder = yield this.folderService.get(id);
|
22931 | if (folder == null) {
|
22932 | return Response.notFound();
|
22933 | }
|
22934 | try {
|
22935 | yield this.folderService.deleteWithServer(id);
|
22936 | return Response.success();
|
22937 | }
|
22938 | catch (e) {
|
22939 | return Response.error(e);
|
22940 | }
|
22941 | });
|
22942 | }
|
22943 | deleteOrganizationCollection(id, cmd) {
|
22944 | return delete_command_awaiter(this, void 0, void 0, function* () {
|
22945 | if (cmd.organizationid == null || cmd.organizationid === '') {
|
22946 | return Response.badRequest('--organizationid <organizationid> required.');
|
22947 | }
|
22948 | if (!utils_Utils.isGuid(id)) {
|
22949 | return Response.error('`' + id + '` is not a GUID.');
|
22950 | }
|
22951 | if (!utils_Utils.isGuid(cmd.organizationid)) {
|
22952 | return Response.error('`' + cmd.organizationid + '` is not a GUID.');
|
22953 | }
|
22954 | try {
|
22955 | yield this.apiService.deleteCollection(cmd.organizationid, id);
|
22956 | return Response.success();
|
22957 | }
|
22958 | catch (e) {
|
22959 | return Response.error(e);
|
22960 | }
|
22961 | });
|
22962 | }
|
22963 | }
|
22964 |
|
22965 |
|
22966 | var edit_command_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
22967 | return new (P || (P = Promise))(function (resolve, reject) {
|
22968 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
22969 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
22970 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
22971 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
22972 | });
|
22973 | };
|
22974 |
|
22975 |
|
22976 |
|
22977 |
|
22978 |
|
22979 |
|
22980 |
|
22981 |
|
22982 |
|
22983 |
|
22984 |
|
22985 | class edit_command_EditCommand {
|
22986 | constructor(cipherService, folderService, cryptoService, apiService) {
|
22987 | this.cipherService = cipherService;
|
22988 | this.folderService = folderService;
|
22989 | this.cryptoService = cryptoService;
|
22990 | this.apiService = apiService;
|
22991 | }
|
22992 | run(object, id, requestJson, cmd) {
|
22993 | return edit_command_awaiter(this, void 0, void 0, function* () {
|
22994 | if (requestJson == null || requestJson === '') {
|
22995 | requestJson = yield utils_CliUtils.readStdin();
|
22996 | }
|
22997 | if (requestJson == null || requestJson === '') {
|
22998 | return Response.badRequest('`requestJson` was not provided.');
|
22999 | }
|
23000 | let req = null;
|
23001 | try {
|
23002 | const reqJson = Buffer.from(requestJson, 'base64').toString();
|
23003 | req = JSON.parse(reqJson);
|
23004 | }
|
23005 | catch (e) {
|
23006 | return Response.badRequest('Error parsing the encoded request data.');
|
23007 | }
|
23008 | if (id != null) {
|
23009 | id = id.toLowerCase();
|
23010 | }
|
23011 | switch (object.toLowerCase()) {
|
23012 | case 'item':
|
23013 | return yield this.editCipher(id, req);
|
23014 | case 'item-collections':
|
23015 | return yield this.editCipherCollections(id, req);
|
23016 | case 'folder':
|
23017 | return yield this.editFolder(id, req);
|
23018 | case 'org-collection':
|
23019 | return yield this.editOrganizationCollection(id, req, cmd);
|
23020 | default:
|
23021 | return Response.badRequest('Unknown object.');
|
23022 | }
|
23023 | });
|
23024 | }
|
23025 | editCipher(id, req) {
|
23026 | return edit_command_awaiter(this, void 0, void 0, function* () {
|
23027 | const cipher = yield this.cipherService.get(id);
|
23028 | if (cipher == null) {
|
23029 | return Response.notFound();
|
23030 | }
|
23031 | let cipherView = yield cipher.decrypt();
|
23032 | if (cipherView.isDeleted) {
|
23033 | return Response.badRequest('You may not edit a deleted cipher. Use restore item <id> command first.');
|
23034 | }
|
23035 | cipherView = export_cipher_Cipher.toView(req, cipherView);
|
23036 | const encCipher = yield this.cipherService.encrypt(cipherView);
|
23037 | try {
|
23038 | yield this.cipherService.saveWithServer(encCipher);
|
23039 | const updatedCipher = yield this.cipherService.get(cipher.id);
|
23040 | const decCipher = yield updatedCipher.decrypt();
|
23041 | const res = new response_cipherResponse_CipherResponse(decCipher);
|
23042 | return Response.success(res);
|
23043 | }
|
23044 | catch (e) {
|
23045 | return Response.error(e);
|
23046 | }
|
23047 | });
|
23048 | }
|
23049 | editCipherCollections(id, req) {
|
23050 | return edit_command_awaiter(this, void 0, void 0, function* () {
|
23051 | const cipher = yield this.cipherService.get(id);
|
23052 | if (cipher == null) {
|
23053 | return Response.notFound();
|
23054 | }
|
23055 | if (cipher.organizationId == null) {
|
23056 | return Response.badRequest('Item does not belong to an organization. Consider sharing it first.');
|
23057 | }
|
23058 | cipher.collectionIds = req;
|
23059 | try {
|
23060 | yield this.cipherService.saveCollectionsWithServer(cipher);
|
23061 | const updatedCipher = yield this.cipherService.get(cipher.id);
|
23062 | const decCipher = yield updatedCipher.decrypt();
|
23063 | const res = new response_cipherResponse_CipherResponse(decCipher);
|
23064 | return Response.success(res);
|
23065 | }
|
23066 | catch (e) {
|
23067 | return Response.error(e);
|
23068 | }
|
23069 | });
|
23070 | }
|
23071 | editFolder(id, req) {
|
23072 | return edit_command_awaiter(this, void 0, void 0, function* () {
|
23073 | const folder = yield this.folderService.get(id);
|
23074 | if (folder == null) {
|
23075 | return Response.notFound();
|
23076 | }
|
23077 | let folderView = yield folder.decrypt();
|
23078 | folderView = export_folder_Folder.toView(req, folderView);
|
23079 | const encFolder = yield this.folderService.encrypt(folderView);
|
23080 | try {
|
23081 | yield this.folderService.saveWithServer(encFolder);
|
23082 | const updatedFolder = yield this.folderService.get(folder.id);
|
23083 | const decFolder = yield updatedFolder.decrypt();
|
23084 | const res = new response_folderResponse_FolderResponse(decFolder);
|
23085 | return Response.success(res);
|
23086 | }
|
23087 | catch (e) {
|
23088 | return Response.error(e);
|
23089 | }
|
23090 | });
|
23091 | }
|
23092 | editOrganizationCollection(id, req, cmd) {
|
23093 | return edit_command_awaiter(this, void 0, void 0, function* () {
|
23094 | if (cmd.organizationid == null || cmd.organizationid === '') {
|
23095 | return Response.badRequest('--organizationid <organizationid> required.');
|
23096 | }
|
23097 | if (!utils_Utils.isGuid(id)) {
|
23098 | return Response.error('`' + id + '` is not a GUID.');
|
23099 | }
|
23100 | if (!utils_Utils.isGuid(cmd.organizationid)) {
|
23101 | return Response.error('`' + cmd.organizationid + '` is not a GUID.');
|
23102 | }
|
23103 | if (cmd.organizationid !== req.organizationId) {
|
23104 | return Response.error('--organizationid <organizationid> does not match request object.');
|
23105 | }
|
23106 | try {
|
23107 | const orgKey = yield this.cryptoService.getOrgKey(req.organizationId);
|
23108 | if (orgKey == null) {
|
23109 | throw new Error('No encryption key for this organization.');
|
23110 | }
|
23111 | const groups = req.groups == null ? null :
|
23112 | req.groups.map((g) => new SelectionReadOnlyRequest(g.id, g.readOnly));
|
23113 | const request = new CollectionRequest();
|
23114 | request.name = (yield this.cryptoService.encrypt(req.name, orgKey)).encryptedString;
|
23115 | request.externalId = req.externalId;
|
23116 | request.groups = groups;
|
23117 | yield this.apiService.putCollection(req.organizationId, id, request);
|
23118 | const res = new organizationCollectionResponse_OrganizationCollectionResponse(export_collection_Collection.toView(req), groups);
|
23119 | return Response.success(res);
|
23120 | }
|
23121 | catch (e) {
|
23122 | return Response.error(e);
|
23123 | }
|
23124 | });
|
23125 | }
|
23126 | }
|
23127 |
|
23128 |
|
23129 | var encode_command_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
23130 | return new (P || (P = Promise))(function (resolve, reject) {
|
23131 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
23132 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
23133 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
23134 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
23135 | });
|
23136 | };
|
23137 |
|
23138 |
|
23139 |
|
23140 | class encode_command_EncodeCommand {
|
23141 | run(cmd) {
|
23142 | return encode_command_awaiter(this, void 0, void 0, function* () {
|
23143 | if (process.stdin.isTTY) {
|
23144 | return Response.badRequest('No stdin was piped in.');
|
23145 | }
|
23146 | const input = yield utils_CliUtils.readStdin();
|
23147 | const b64 = Buffer.from(input, 'utf8').toString('base64');
|
23148 | const res = new StringResponse(b64);
|
23149 | return Response.success(res);
|
23150 | });
|
23151 | }
|
23152 | }
|
23153 |
|
23154 |
|
23155 | var external_inquirer_ = __webpack_require__(5);
|
23156 |
|
23157 |
|
23158 | var export_command_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
23159 | return new (P || (P = Promise))(function (resolve, reject) {
|
23160 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
23161 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
23162 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
23163 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
23164 | });
|
23165 | };
|
23166 |
|
23167 |
|
23168 |
|
23169 |
|
23170 |
|
23171 | class export_command_ExportCommand {
|
23172 | constructor(cryptoService, exportService) {
|
23173 | this.cryptoService = cryptoService;
|
23174 | this.exportService = exportService;
|
23175 | }
|
23176 | run(password, cmd) {
|
23177 | return export_command_awaiter(this, void 0, void 0, function* () {
|
23178 | const canInteract = process.env.BW_NOINTERACTION !== 'true';
|
23179 | if ((password == null || password === '') && canInteract) {
|
23180 | const answer = yield external_inquirer_["createPromptModule"]({ output: process.stderr })({
|
23181 | type: 'password',
|
23182 | name: 'password',
|
23183 | message: 'Master password:',
|
23184 | });
|
23185 | password = answer.password;
|
23186 | }
|
23187 | if (password == null || password === '') {
|
23188 | return Response.badRequest('Master password is required.');
|
23189 | }
|
23190 | const keyHash = yield this.cryptoService.hashPassword(password, null);
|
23191 | const storedKeyHash = yield this.cryptoService.getKeyHash();
|
23192 | if (storedKeyHash != null && keyHash != null && storedKeyHash === keyHash) {
|
23193 | const format = cmd.format !== 'json' ? 'csv' : 'json';
|
23194 | if (cmd.organizationid != null && !utils_Utils.isGuid(cmd.organizationid)) {
|
23195 | return Response.error('`' + cmd.organizationid + '` is not a GUID.');
|
23196 | }
|
23197 | let csv = null;
|
23198 | try {
|
23199 | csv = cmd.organizationid != null ?
|
23200 | yield this.exportService.getOrganizationExport(cmd.organizationid, format) :
|
23201 | yield this.exportService.getExport(format);
|
23202 | }
|
23203 | catch (e) {
|
23204 | return Response.error(e);
|
23205 | }
|
23206 | return yield this.saveFile(csv, cmd, format);
|
23207 | }
|
23208 | else {
|
23209 | return Response.error('Invalid master password.');
|
23210 | }
|
23211 | });
|
23212 | }
|
23213 | saveFile(csv, cmd, format) {
|
23214 | return export_command_awaiter(this, void 0, void 0, function* () {
|
23215 | try {
|
23216 | const filePath = yield utils_CliUtils.saveFile(csv, cmd.output, this.exportService.getFileName(cmd.organizationid != null ? 'org' : null, format));
|
23217 | const res = new MessageResponse('Saved ' + filePath, null);
|
23218 | res.raw = filePath;
|
23219 | return Response.success(res);
|
23220 | }
|
23221 | catch (e) {
|
23222 | return Response.error(e.toString());
|
23223 | }
|
23224 | });
|
23225 | }
|
23226 | }
|
23227 |
|
23228 |
|
23229 | var generate_command_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
23230 | return new (P || (P = Promise))(function (resolve, reject) {
|
23231 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
23232 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
23233 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
23234 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
23235 | });
|
23236 | };
|
23237 |
|
23238 |
|
23239 | class generate_command_GenerateCommand {
|
23240 | constructor(passwordGenerationService) {
|
23241 | this.passwordGenerationService = passwordGenerationService;
|
23242 | }
|
23243 | run(cmd) {
|
23244 | return generate_command_awaiter(this, void 0, void 0, function* () {
|
23245 | const options = {
|
23246 | uppercase: cmd.uppercase || false,
|
23247 | lowercase: cmd.lowercase || false,
|
23248 | number: cmd.number || false,
|
23249 | special: cmd.special || false,
|
23250 | length: cmd.length || 14,
|
23251 | type: cmd.passphrase ? 'passphrase' : 'password',
|
23252 | wordSeparator: cmd.separator == null ? '-' : cmd.separator,
|
23253 | numWords: cmd.words || 3,
|
23254 | };
|
23255 | if (!options.uppercase && !options.lowercase && !options.special && !options.number) {
|
23256 | options.lowercase = true;
|
23257 | options.uppercase = true;
|
23258 | options.number = true;
|
23259 | }
|
23260 | if (options.length < 5) {
|
23261 | options.length = 5;
|
23262 | }
|
23263 | if (options.numWords < 3) {
|
23264 | options.numWords = 3;
|
23265 | }
|
23266 | if (options.wordSeparator === 'space') {
|
23267 | options.wordSeparator = ' ';
|
23268 | }
|
23269 | else if (options.wordSeparator != null && options.wordSeparator.length > 1) {
|
23270 | options.wordSeparator = options.wordSeparator[0];
|
23271 | }
|
23272 | const enforcedOptions = yield this.passwordGenerationService.enforcePasswordGeneratorPoliciesOnOptions(options);
|
23273 | const password = yield this.passwordGenerationService.generatePassword(enforcedOptions[0]);
|
23274 | const res = new StringResponse(password);
|
23275 | return Response.success(res);
|
23276 | });
|
23277 | }
|
23278 | }
|
23279 |
|
23280 |
|
23281 | class response_organizationResponse_OrganizationResponse {
|
23282 | constructor(o) {
|
23283 | this.object = 'organization';
|
23284 | this.id = o.id;
|
23285 | this.name = o.name;
|
23286 | this.status = o.status;
|
23287 | this.type = o.type;
|
23288 | this.enabled = o.enabled;
|
23289 | }
|
23290 | }
|
23291 |
|
23292 |
|
23293 | class TemplateResponse {
|
23294 | constructor(template) {
|
23295 | this.object = 'template';
|
23296 | this.template = template;
|
23297 | }
|
23298 | }
|
23299 |
|
23300 |
|
23301 | class SelectionReadOnly {
|
23302 | static template() {
|
23303 | return new SelectionReadOnly('00000000-0000-0000-0000-000000000000', false);
|
23304 | }
|
23305 | constructor(id, readOnly) {
|
23306 | this.id = id;
|
23307 | this.readOnly = readOnly;
|
23308 | }
|
23309 | }
|
23310 |
|
23311 |
|
23312 |
|
23313 |
|
23314 | class organizationCollectionRequest_OrganizationCollectionRequest extends export_collection_Collection {
|
23315 | static template() {
|
23316 | const req = new organizationCollectionRequest_OrganizationCollectionRequest();
|
23317 | req.organizationId = '00000000-0000-0000-0000-000000000000';
|
23318 | req.name = 'Collection name';
|
23319 | req.externalId = null;
|
23320 | req.groups = [SelectionReadOnly.template(), SelectionReadOnly.template()];
|
23321 | return req;
|
23322 | }
|
23323 | }
|
23324 |
|
23325 |
|
23326 | var get_command_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
23327 | return new (P || (P = Promise))(function (resolve, reject) {
|
23328 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
23329 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
23330 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
23331 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
23332 | });
|
23333 | };
|
23334 |
|
23335 |
|
23336 |
|
23337 |
|
23338 |
|
23339 |
|
23340 |
|
23341 |
|
23342 |
|
23343 |
|
23344 |
|
23345 |
|
23346 |
|
23347 |
|
23348 |
|
23349 |
|
23350 |
|
23351 |
|
23352 |
|
23353 |
|
23354 |
|
23355 |
|
23356 |
|
23357 |
|
23358 |
|
23359 |
|
23360 | class get_command_GetCommand {
|
23361 | constructor(cipherService, folderService, collectionService, totpService, auditService, cryptoService, userService, searchService, apiService) {
|
23362 | this.cipherService = cipherService;
|
23363 | this.folderService = folderService;
|
23364 | this.collectionService = collectionService;
|
23365 | this.totpService = totpService;
|
23366 | this.auditService = auditService;
|
23367 | this.cryptoService = cryptoService;
|
23368 | this.userService = userService;
|
23369 | this.searchService = searchService;
|
23370 | this.apiService = apiService;
|
23371 | }
|
23372 | run(object, id, cmd) {
|
23373 | return get_command_awaiter(this, void 0, void 0, function* () {
|
23374 | if (id != null) {
|
23375 | id = id.toLowerCase();
|
23376 | }
|
23377 | switch (object.toLowerCase()) {
|
23378 | case 'item':
|
23379 | return yield this.getCipher(id);
|
23380 | case 'username':
|
23381 | return yield this.getUsername(id);
|
23382 | case 'password':
|
23383 | return yield this.getPassword(id);
|
23384 | case 'uri':
|
23385 | return yield this.getUri(id);
|
23386 | case 'totp':
|
23387 | return yield this.getTotp(id);
|
23388 | case 'exposed':
|
23389 | return yield this.getExposed(id);
|
23390 | case 'attachment':
|
23391 | return yield this.getAttachment(id, cmd);
|
23392 | case 'folder':
|
23393 | return yield this.getFolder(id);
|
23394 | case 'collection':
|
23395 | return yield this.getCollection(id);
|
23396 | case 'org-collection':
|
23397 | return yield this.getOrganizationCollection(id, cmd);
|
23398 | case 'organization':
|
23399 | return yield this.getOrganization(id);
|
23400 | case 'template':
|
23401 | return yield this.getTemplate(id);
|
23402 | case 'fingerprint':
|
23403 | return yield this.getFingerprint(id);
|
23404 | default:
|
23405 | return Response.badRequest('Unknown object.');
|
23406 | }
|
23407 | });
|
23408 | }
|
23409 | getCipherView(id) {
|
23410 | return get_command_awaiter(this, void 0, void 0, function* () {
|
23411 | let decCipher = null;
|
23412 | if (utils_Utils.isGuid(id)) {
|
23413 | const cipher = yield this.cipherService.get(id);
|
23414 | if (cipher != null) {
|
23415 | decCipher = yield cipher.decrypt();
|
23416 | }
|
23417 | }
|
23418 | else if (id.trim() !== '') {
|
23419 | let ciphers = yield this.cipherService.getAllDecrypted();
|
23420 | ciphers = this.searchService.searchCiphersBasic(ciphers, id);
|
23421 | if (ciphers.length > 1) {
|
23422 | return ciphers;
|
23423 | }
|
23424 | if (ciphers.length > 0) {
|
23425 | decCipher = ciphers[0];
|
23426 | }
|
23427 | }
|
23428 | return decCipher;
|
23429 | });
|
23430 | }
|
23431 | getCipher(id, filter) {
|
23432 | return get_command_awaiter(this, void 0, void 0, function* () {
|
23433 | let decCipher = yield this.getCipherView(id);
|
23434 | if (decCipher == null) {
|
23435 | return Response.notFound();
|
23436 | }
|
23437 | if (Array.isArray(decCipher)) {
|
23438 | if (filter != null) {
|
23439 | const filteredCiphers = decCipher.filter(filter);
|
23440 | if (filteredCiphers.length === 1) {
|
23441 | decCipher = filteredCiphers[0];
|
23442 | }
|
23443 | }
|
23444 | if (Array.isArray(decCipher)) {
|
23445 | return Response.multipleResults(decCipher.map((c) => c.id));
|
23446 | }
|
23447 | }
|
23448 | const res = new response_cipherResponse_CipherResponse(decCipher);
|
23449 | return Response.success(res);
|
23450 | });
|
23451 | }
|
23452 | getUsername(id) {
|
23453 | return get_command_awaiter(this, void 0, void 0, function* () {
|
23454 | const cipherResponse = yield this.getCipher(id, (c) => c.type === CipherType.Login && !utils_Utils.isNullOrWhitespace(c.login.username));
|
23455 | if (!cipherResponse.success) {
|
23456 | return cipherResponse;
|
23457 | }
|
23458 | const cipher = cipherResponse.data;
|
23459 | if (cipher.type !== CipherType.Login) {
|
23460 | return Response.badRequest('Not a login.');
|
23461 | }
|
23462 | if (utils_Utils.isNullOrWhitespace(cipher.login.username)) {
|
23463 | return Response.error('No username available for this login.');
|
23464 | }
|
23465 | const res = new StringResponse(cipher.login.username);
|
23466 | return Response.success(res);
|
23467 | });
|
23468 | }
|
23469 | getPassword(id) {
|
23470 | return get_command_awaiter(this, void 0, void 0, function* () {
|
23471 | const cipherResponse = yield this.getCipher(id, (c) => c.type === CipherType.Login && !utils_Utils.isNullOrWhitespace(c.login.password));
|
23472 | if (!cipherResponse.success) {
|
23473 | return cipherResponse;
|
23474 | }
|
23475 | const cipher = cipherResponse.data;
|
23476 | if (cipher.type !== CipherType.Login) {
|
23477 | return Response.badRequest('Not a login.');
|
23478 | }
|
23479 | if (utils_Utils.isNullOrWhitespace(cipher.login.password)) {
|
23480 | return Response.error('No password available for this login.');
|
23481 | }
|
23482 | const res = new StringResponse(cipher.login.password);
|
23483 | return Response.success(res);
|
23484 | });
|
23485 | }
|
23486 | getUri(id) {
|
23487 | return get_command_awaiter(this, void 0, void 0, function* () {
|
23488 | const cipherResponse = yield this.getCipher(id, (c) => c.type === CipherType.Login && c.login.uris != null && c.login.uris.length > 0 &&
|
23489 | c.login.uris[0].uri !== '');
|
23490 | if (!cipherResponse.success) {
|
23491 | return cipherResponse;
|
23492 | }
|
23493 | const cipher = cipherResponse.data;
|
23494 | if (cipher.type !== CipherType.Login) {
|
23495 | return Response.badRequest('Not a login.');
|
23496 | }
|
23497 | if (cipher.login.uris == null || cipher.login.uris.length === 0 || cipher.login.uris[0].uri === '') {
|
23498 | return Response.error('No uri available for this login.');
|
23499 | }
|
23500 | const res = new StringResponse(cipher.login.uris[0].uri);
|
23501 | return Response.success(res);
|
23502 | });
|
23503 | }
|
23504 | getTotp(id) {
|
23505 | return get_command_awaiter(this, void 0, void 0, function* () {
|
23506 | const cipherResponse = yield this.getCipher(id, (c) => c.type === CipherType.Login && !utils_Utils.isNullOrWhitespace(c.login.totp));
|
23507 | if (!cipherResponse.success) {
|
23508 | return cipherResponse;
|
23509 | }
|
23510 | const cipher = cipherResponse.data;
|
23511 | if (cipher.type !== CipherType.Login) {
|
23512 | return Response.badRequest('Not a login.');
|
23513 | }
|
23514 | if (utils_Utils.isNullOrWhitespace(cipher.login.totp)) {
|
23515 | return Response.error('No TOTP available for this login.');
|
23516 | }
|
23517 | const totp = yield this.totpService.getCode(cipher.login.totp);
|
23518 | if (totp == null) {
|
23519 | return Response.error('Couldn\'t generate TOTP code.');
|
23520 | }
|
23521 | const canAccessPremium = yield this.userService.canAccessPremium();
|
23522 | if (!canAccessPremium) {
|
23523 | const originalCipher = yield this.cipherService.get(cipher.id);
|
23524 | if (originalCipher == null || originalCipher.organizationId == null ||
|
23525 | !originalCipher.organizationUseTotp) {
|
23526 | return Response.error('Premium status is required to use this feature.');
|
23527 | }
|
23528 | }
|
23529 | const res = new StringResponse(totp);
|
23530 | return Response.success(res);
|
23531 | });
|
23532 | }
|
23533 | getExposed(id) {
|
23534 | return get_command_awaiter(this, void 0, void 0, function* () {
|
23535 | const passwordResponse = yield this.getPassword(id);
|
23536 | if (!passwordResponse.success) {
|
23537 | return passwordResponse;
|
23538 | }
|
23539 | const exposedNumber = yield this.auditService.passwordLeaked(passwordResponse.data.data);
|
23540 | const res = new StringResponse(exposedNumber.toString());
|
23541 | return Response.success(res);
|
23542 | });
|
23543 | }
|
23544 | getAttachment(id, cmd) {
|
23545 | return get_command_awaiter(this, void 0, void 0, function* () {
|
23546 | if (cmd.itemid == null || cmd.itemid === '') {
|
23547 | return Response.badRequest('--itemid <itemid> required.');
|
23548 | }
|
23549 | const itemId = cmd.itemid.toLowerCase();
|
23550 | const cipherResponse = yield this.getCipher(itemId);
|
23551 | if (!cipherResponse.success) {
|
23552 | return cipherResponse;
|
23553 | }
|
23554 | const cipher = yield this.getCipherView(itemId);
|
23555 | if (cipher == null || Array.isArray(cipher) || cipher.attachments.length === 0) {
|
23556 | return Response.error('No attachments available for this item.');
|
23557 | }
|
23558 | const attachments = cipher.attachments.filter((a) => a.id.toLowerCase() === id ||
|
23559 | (a.fileName != null && a.fileName.toLowerCase().indexOf(id) > -1));
|
23560 | if (attachments.length === 0) {
|
23561 | return Response.error('Attachment `' + id + '` was not found.');
|
23562 | }
|
23563 | if (attachments.length > 1) {
|
23564 | return Response.multipleResults(attachments.map((a) => a.id));
|
23565 | }
|
23566 | if (!(yield this.userService.canAccessPremium())) {
|
23567 | const originalCipher = yield this.cipherService.get(cipher.id);
|
23568 | if (originalCipher == null || originalCipher.organizationId == null) {
|
23569 | return Response.error('Premium status is required to use this feature.');
|
23570 | }
|
23571 | }
|
23572 | const response = yield external_node_fetch_default.a(new external_node_fetch_["Request"](attachments[0].url, { headers: { cache: 'no-cache' } }));
|
23573 | if (response.status !== 200) {
|
23574 | return Response.error('A ' + response.status + ' error occurred while downloading the attachment.');
|
23575 | }
|
23576 | try {
|
23577 | const buf = yield response.arrayBuffer();
|
23578 | const key = attachments[0].key != null ? attachments[0].key :
|
23579 | yield this.cryptoService.getOrgKey(cipher.organizationId);
|
23580 | const decBuf = yield this.cryptoService.decryptFromBytes(buf, key);
|
23581 | const filePath = yield utils_CliUtils.saveFile(Buffer.from(decBuf), cmd.output, attachments[0].fileName);
|
23582 | const res = new MessageResponse('Saved ' + filePath, null);
|
23583 | res.raw = filePath;
|
23584 | return Response.success(res);
|
23585 | }
|
23586 | catch (e) {
|
23587 | if (typeof (e) === 'string') {
|
23588 | return Response.error(e);
|
23589 | }
|
23590 | else {
|
23591 | return Response.error('An error occurred while saving the attachment.');
|
23592 | }
|
23593 | }
|
23594 | });
|
23595 | }
|
23596 | getFolder(id) {
|
23597 | return get_command_awaiter(this, void 0, void 0, function* () {
|
23598 | let decFolder = null;
|
23599 | if (utils_Utils.isGuid(id)) {
|
23600 | const folder = yield this.folderService.get(id);
|
23601 | if (folder != null) {
|
23602 | decFolder = yield folder.decrypt();
|
23603 | }
|
23604 | }
|
23605 | else if (id.trim() !== '') {
|
23606 | let folders = yield this.folderService.getAllDecrypted();
|
23607 | folders = utils_CliUtils.searchFolders(folders, id);
|
23608 | if (folders.length > 1) {
|
23609 | return Response.multipleResults(folders.map((f) => f.id));
|
23610 | }
|
23611 | if (folders.length > 0) {
|
23612 | decFolder = folders[0];
|
23613 | }
|
23614 | }
|
23615 | if (decFolder == null) {
|
23616 | return Response.notFound();
|
23617 | }
|
23618 | const res = new response_folderResponse_FolderResponse(decFolder);
|
23619 | return Response.success(res);
|
23620 | });
|
23621 | }
|
23622 | getCollection(id) {
|
23623 | return get_command_awaiter(this, void 0, void 0, function* () {
|
23624 | let decCollection = null;
|
23625 | if (utils_Utils.isGuid(id)) {
|
23626 | const collection = yield this.collectionService.get(id);
|
23627 | if (collection != null) {
|
23628 | decCollection = yield collection.decrypt();
|
23629 | }
|
23630 | }
|
23631 | else if (id.trim() !== '') {
|
23632 | let collections = yield this.collectionService.getAllDecrypted();
|
23633 | collections = utils_CliUtils.searchCollections(collections, id);
|
23634 | if (collections.length > 1) {
|
23635 | return Response.multipleResults(collections.map((c) => c.id));
|
23636 | }
|
23637 | if (collections.length > 0) {
|
23638 | decCollection = collections[0];
|
23639 | }
|
23640 | }
|
23641 | if (decCollection == null) {
|
23642 | return Response.notFound();
|
23643 | }
|
23644 | const res = new response_collectionResponse_CollectionResponse(decCollection);
|
23645 | return Response.success(res);
|
23646 | });
|
23647 | }
|
23648 | getOrganizationCollection(id, cmd) {
|
23649 | return get_command_awaiter(this, void 0, void 0, function* () {
|
23650 | if (cmd.organizationid == null || cmd.organizationid === '') {
|
23651 | return Response.badRequest('--organizationid <organizationid> required.');
|
23652 | }
|
23653 | if (!utils_Utils.isGuid(id)) {
|
23654 | return Response.error('`' + id + '` is not a GUID.');
|
23655 | }
|
23656 | if (!utils_Utils.isGuid(cmd.organizationid)) {
|
23657 | return Response.error('`' + cmd.organizationid + '` is not a GUID.');
|
23658 | }
|
23659 | try {
|
23660 | const orgKey = yield this.cryptoService.getOrgKey(cmd.organizationid);
|
23661 | if (orgKey == null) {
|
23662 | throw new Error('No encryption key for this organization.');
|
23663 | }
|
23664 | const response = yield this.apiService.getCollectionDetails(cmd.organizationid, id);
|
23665 | const decCollection = new collectionView_CollectionView(response);
|
23666 | decCollection.name = yield this.cryptoService.decryptToUtf8(new cipherString_CipherString(response.name), orgKey);
|
23667 | const groups = response.groups == null ? null :
|
23668 | response.groups.map((g) => new SelectionReadOnly(g.id, g.readOnly));
|
23669 | const res = new organizationCollectionResponse_OrganizationCollectionResponse(decCollection, groups);
|
23670 | return Response.success(res);
|
23671 | }
|
23672 | catch (e) {
|
23673 | return Response.error(e);
|
23674 | }
|
23675 | });
|
23676 | }
|
23677 | getOrganization(id) {
|
23678 | return get_command_awaiter(this, void 0, void 0, function* () {
|
23679 | let org = null;
|
23680 | if (utils_Utils.isGuid(id)) {
|
23681 | org = yield this.userService.getOrganization(id);
|
23682 | }
|
23683 | else if (id.trim() !== '') {
|
23684 | let orgs = yield this.userService.getAllOrganizations();
|
23685 | orgs = utils_CliUtils.searchOrganizations(orgs, id);
|
23686 | if (orgs.length > 1) {
|
23687 | return Response.multipleResults(orgs.map((c) => c.id));
|
23688 | }
|
23689 | if (orgs.length > 0) {
|
23690 | org = orgs[0];
|
23691 | }
|
23692 | }
|
23693 | if (org == null) {
|
23694 | return Response.notFound();
|
23695 | }
|
23696 | const res = new response_organizationResponse_OrganizationResponse(org);
|
23697 | return Response.success(res);
|
23698 | });
|
23699 | }
|
23700 | getTemplate(id) {
|
23701 | return get_command_awaiter(this, void 0, void 0, function* () {
|
23702 | let template = null;
|
23703 | switch (id.toLowerCase()) {
|
23704 | case 'item':
|
23705 | template = export_cipher_Cipher.template();
|
23706 | break;
|
23707 | case 'item.field':
|
23708 | template = export_field_Field.template();
|
23709 | break;
|
23710 | case 'item.login':
|
23711 | template = export_login_Login.template();
|
23712 | break;
|
23713 | case 'item.login.uri':
|
23714 | template = export_loginUri_LoginUri.template();
|
23715 | break;
|
23716 | case 'item.card':
|
23717 | template = export_card_Card.template();
|
23718 | break;
|
23719 | case 'item.identity':
|
23720 | template = export_identity_Identity.template();
|
23721 | break;
|
23722 | case 'item.securenote':
|
23723 | template = export_secureNote_SecureNote.template();
|
23724 | break;
|
23725 | case 'folder':
|
23726 | template = export_folder_Folder.template();
|
23727 | break;
|
23728 | case 'collection':
|
23729 | template = export_collection_Collection.template();
|
23730 | break;
|
23731 | case 'item-collections':
|
23732 | template = ['collection-id1', 'collection-id2'];
|
23733 | break;
|
23734 | case 'org-collection':
|
23735 | template = organizationCollectionRequest_OrganizationCollectionRequest.template();
|
23736 | break;
|
23737 | default:
|
23738 | return Response.badRequest('Unknown template object.');
|
23739 | }
|
23740 | const res = new TemplateResponse(template);
|
23741 | return Response.success(res);
|
23742 | });
|
23743 | }
|
23744 | getFingerprint(id) {
|
23745 | return get_command_awaiter(this, void 0, void 0, function* () {
|
23746 | let fingerprint = null;
|
23747 | if (id === 'me') {
|
23748 | fingerprint = yield this.cryptoService.getFingerprint(yield this.userService.getUserId());
|
23749 | }
|
23750 | else if (utils_Utils.isGuid(id)) {
|
23751 | try {
|
23752 | const response = yield this.apiService.getUserPublicKey(id);
|
23753 | const pubKey = utils_Utils.fromB64ToArray(response.publicKey);
|
23754 | fingerprint = yield this.cryptoService.getFingerprint(id, pubKey.buffer);
|
23755 | }
|
23756 | catch (_a) { }
|
23757 | }
|
23758 | if (fingerprint == null) {
|
23759 | return Response.notFound();
|
23760 | }
|
23761 | const res = new StringResponse(fingerprint.join('-'));
|
23762 | return Response.success(res);
|
23763 | });
|
23764 | }
|
23765 | }
|
23766 |
|
23767 |
|
23768 | var import_command_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
23769 | return new (P || (P = Promise))(function (resolve, reject) {
|
23770 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
23771 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
23772 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
23773 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
23774 | });
|
23775 | };
|
23776 |
|
23777 |
|
23778 |
|
23779 | class import_command_ImportCommand {
|
23780 | constructor(importService) {
|
23781 | this.importService = importService;
|
23782 | }
|
23783 | run(format, filepath, cmd) {
|
23784 | return import_command_awaiter(this, void 0, void 0, function* () {
|
23785 | if (cmd.formats || false) {
|
23786 | return this.list();
|
23787 | }
|
23788 | else {
|
23789 | return this.import(format, filepath);
|
23790 | }
|
23791 | });
|
23792 | }
|
23793 | import(format, filepath) {
|
23794 | return import_command_awaiter(this, void 0, void 0, function* () {
|
23795 | if (format == null || format === '') {
|
23796 | return Response.badRequest('`format` was not provided.');
|
23797 | }
|
23798 | if (filepath == null || filepath === '') {
|
23799 | return Response.badRequest('`filepath` was not provided.');
|
23800 | }
|
23801 | const importer = yield this.importService.getImporter(format, false);
|
23802 | if (importer === null) {
|
23803 | return Response.badRequest('Proper importer type required.');
|
23804 | }
|
23805 | try {
|
23806 | const contents = yield utils_CliUtils.readFile(filepath);
|
23807 | if (contents === null || contents === '') {
|
23808 | return Response.badRequest('Import file was empty.');
|
23809 | }
|
23810 | const err = yield this.importService.import(importer, contents, null);
|
23811 | if (err != null) {
|
23812 | return Response.badRequest(err.message);
|
23813 | }
|
23814 | const res = new MessageResponse('Imported ' + filepath, null);
|
23815 | return Response.success(res);
|
23816 | }
|
23817 | catch (err) {
|
23818 | return Response.badRequest(err);
|
23819 | }
|
23820 | });
|
23821 | }
|
23822 | list() {
|
23823 | return import_command_awaiter(this, void 0, void 0, function* () {
|
23824 | const options = this.importService.getImportOptions().sort((a, b) => {
|
23825 | return a.id < b.id ? -1 : a.id > b.id ? 1 : 0;
|
23826 | }).map((option) => option.id).join('\n');
|
23827 | const res = new MessageResponse('Supported input formats:', options);
|
23828 | res.raw = options;
|
23829 | return Response.success(res);
|
23830 | });
|
23831 | }
|
23832 | }
|
23833 |
|
23834 |
|
23835 | class response_listResponse_ListResponse {
|
23836 | constructor(data) {
|
23837 | this.object = 'list';
|
23838 | this.data = data;
|
23839 | }
|
23840 | }
|
23841 |
|
23842 |
|
23843 | class response_organizationUserResponse_OrganizationUserResponse {
|
23844 | constructor() {
|
23845 | this.object = 'org-member';
|
23846 | }
|
23847 | }
|
23848 |
|
23849 |
|
23850 | var list_command_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
23851 | return new (P || (P = Promise))(function (resolve, reject) {
|
23852 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
23853 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
23854 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
23855 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
23856 | });
|
23857 | };
|
23858 |
|
23859 |
|
23860 |
|
23861 |
|
23862 |
|
23863 |
|
23864 |
|
23865 |
|
23866 |
|
23867 |
|
23868 |
|
23869 | class list_command_ListCommand {
|
23870 | constructor(cipherService, folderService, collectionService, userService, searchService, apiService) {
|
23871 | this.cipherService = cipherService;
|
23872 | this.folderService = folderService;
|
23873 | this.collectionService = collectionService;
|
23874 | this.userService = userService;
|
23875 | this.searchService = searchService;
|
23876 | this.apiService = apiService;
|
23877 | }
|
23878 | run(object, cmd) {
|
23879 | return list_command_awaiter(this, void 0, void 0, function* () {
|
23880 | switch (object.toLowerCase()) {
|
23881 | case 'items':
|
23882 | return yield this.listCiphers(cmd);
|
23883 | case 'folders':
|
23884 | return yield this.listFolders(cmd);
|
23885 | case 'collections':
|
23886 | return yield this.listCollections(cmd);
|
23887 | case 'org-collections':
|
23888 | return yield this.listOrganizationCollections(cmd);
|
23889 | case 'org-members':
|
23890 | return yield this.listOrganizationMembers(cmd);
|
23891 | case 'organizations':
|
23892 | return yield this.listOrganizations(cmd);
|
23893 | default:
|
23894 | return Response.badRequest('Unknown object.');
|
23895 | }
|
23896 | });
|
23897 | }
|
23898 | listCiphers(cmd) {
|
23899 | return list_command_awaiter(this, void 0, void 0, function* () {
|
23900 | let ciphers;
|
23901 | cmd.trash = cmd.trash || false;
|
23902 | if (cmd.url != null && cmd.url.trim() !== '') {
|
23903 | ciphers = yield this.cipherService.getAllDecryptedForUrl(cmd.url);
|
23904 | }
|
23905 | else {
|
23906 | ciphers = yield this.cipherService.getAllDecrypted();
|
23907 | }
|
23908 | if (cmd.folderid != null || cmd.collectionid != null || cmd.organizationid != null) {
|
23909 | ciphers = ciphers.filter((c) => {
|
23910 | if (cmd.trash !== c.isDeleted) {
|
23911 | return false;
|
23912 | }
|
23913 | if (cmd.folderid != null) {
|
23914 | if (cmd.folderid === 'notnull' && c.folderId != null) {
|
23915 | return true;
|
23916 | }
|
23917 | const folderId = cmd.folderid === 'null' ? null : cmd.folderid;
|
23918 | if (folderId === c.folderId) {
|
23919 | return true;
|
23920 | }
|
23921 | }
|
23922 | if (cmd.organizationid != null) {
|
23923 | if (cmd.organizationid === 'notnull' && c.organizationId != null) {
|
23924 | return true;
|
23925 | }
|
23926 | const organizationId = cmd.organizationid === 'null' ? null : cmd.organizationid;
|
23927 | if (organizationId === c.organizationId) {
|
23928 | return true;
|
23929 | }
|
23930 | }
|
23931 | if (cmd.collectionid != null) {
|
23932 | if (cmd.collectionid === 'notnull' && c.collectionIds != null && c.collectionIds.length > 0) {
|
23933 | return true;
|
23934 | }
|
23935 | const collectionId = cmd.collectionid === 'null' ? null : cmd.collectionid;
|
23936 | if (collectionId == null && (c.collectionIds == null || c.collectionIds.length === 0)) {
|
23937 | return true;
|
23938 | }
|
23939 | if (collectionId != null && c.collectionIds != null && c.collectionIds.indexOf(collectionId) > -1) {
|
23940 | return true;
|
23941 | }
|
23942 | }
|
23943 | return false;
|
23944 | });
|
23945 | }
|
23946 | else if (cmd.search == null || cmd.search.trim() === '') {
|
23947 | ciphers = ciphers.filter((c) => cmd.trash === c.isDeleted);
|
23948 | }
|
23949 | if (cmd.search != null && cmd.search.trim() !== '') {
|
23950 | ciphers = this.searchService.searchCiphersBasic(ciphers, cmd.search, cmd.trash);
|
23951 | }
|
23952 | const res = new response_listResponse_ListResponse(ciphers.map((o) => new response_cipherResponse_CipherResponse(o)));
|
23953 | return Response.success(res);
|
23954 | });
|
23955 | }
|
23956 | listFolders(cmd) {
|
23957 | return list_command_awaiter(this, void 0, void 0, function* () {
|
23958 | let folders = yield this.folderService.getAllDecrypted();
|
23959 | if (cmd.search != null && cmd.search.trim() !== '') {
|
23960 | folders = utils_CliUtils.searchFolders(folders, cmd.search);
|
23961 | }
|
23962 | const res = new response_listResponse_ListResponse(folders.map((o) => new response_folderResponse_FolderResponse(o)));
|
23963 | return Response.success(res);
|
23964 | });
|
23965 | }
|
23966 | listCollections(cmd) {
|
23967 | return list_command_awaiter(this, void 0, void 0, function* () {
|
23968 | let collections = yield this.collectionService.getAllDecrypted();
|
23969 | if (cmd.organizationid != null) {
|
23970 | collections = collections.filter((c) => {
|
23971 | if (cmd.organizationid === c.organizationId) {
|
23972 | return true;
|
23973 | }
|
23974 | return false;
|
23975 | });
|
23976 | }
|
23977 | if (cmd.search != null && cmd.search.trim() !== '') {
|
23978 | collections = utils_CliUtils.searchCollections(collections, cmd.search);
|
23979 | }
|
23980 | const res = new response_listResponse_ListResponse(collections.map((o) => new response_collectionResponse_CollectionResponse(o)));
|
23981 | return Response.success(res);
|
23982 | });
|
23983 | }
|
23984 | listOrganizationCollections(cmd) {
|
23985 | return list_command_awaiter(this, void 0, void 0, function* () {
|
23986 | if (cmd.organizationid == null || cmd.organizationid === '') {
|
23987 | return Response.badRequest('--organizationid <organizationid> required.');
|
23988 | }
|
23989 | if (!utils_Utils.isGuid(cmd.organizationid)) {
|
23990 | return Response.error('`' + cmd.organizationid + '` is not a GUID.');
|
23991 | }
|
23992 | const organization = yield this.userService.getOrganization(cmd.organizationid);
|
23993 | if (organization == null) {
|
23994 | return Response.error('Organization not found.');
|
23995 | }
|
23996 | try {
|
23997 | let response;
|
23998 | if (organization.isAdmin) {
|
23999 | response = yield this.apiService.getCollections(cmd.organizationid);
|
24000 | }
|
24001 | else {
|
24002 | response = yield this.apiService.getUserCollections();
|
24003 | }
|
24004 | const collections = response.data.filter((c) => c.organizationId === cmd.organizationid).map((r) => new collection_Collection(new CollectionData(r)));
|
24005 | let decCollections = yield this.collectionService.decryptMany(collections);
|
24006 | if (cmd.search != null && cmd.search.trim() !== '') {
|
24007 | decCollections = utils_CliUtils.searchCollections(decCollections, cmd.search);
|
24008 | }
|
24009 | const res = new response_listResponse_ListResponse(decCollections.map((o) => new response_collectionResponse_CollectionResponse(o)));
|
24010 | return Response.success(res);
|
24011 | }
|
24012 | catch (e) {
|
24013 | return Response.error(e);
|
24014 | }
|
24015 | });
|
24016 | }
|
24017 | listOrganizationMembers(cmd) {
|
24018 | return list_command_awaiter(this, void 0, void 0, function* () {
|
24019 | if (cmd.organizationid == null || cmd.organizationid === '') {
|
24020 | return Response.badRequest('--organizationid <organizationid> required.');
|
24021 | }
|
24022 | if (!utils_Utils.isGuid(cmd.organizationid)) {
|
24023 | return Response.error('`' + cmd.organizationid + '` is not a GUID.');
|
24024 | }
|
24025 | const organization = yield this.userService.getOrganization(cmd.organizationid);
|
24026 | if (organization == null) {
|
24027 | return Response.error('Organization not found.');
|
24028 | }
|
24029 | try {
|
24030 | const response = yield this.apiService.getOrganizationUsers(cmd.organizationid);
|
24031 | const res = new response_listResponse_ListResponse(response.data.map((r) => {
|
24032 | const u = new response_organizationUserResponse_OrganizationUserResponse();
|
24033 | u.email = r.email;
|
24034 | u.name = r.name;
|
24035 | u.id = r.id;
|
24036 | u.status = r.status;
|
24037 | u.type = r.type;
|
24038 | u.twoFactorEnabled = r.twoFactorEnabled;
|
24039 | return u;
|
24040 | }));
|
24041 | return Response.success(res);
|
24042 | }
|
24043 | catch (e) {
|
24044 | return Response.error(e);
|
24045 | }
|
24046 | });
|
24047 | }
|
24048 | listOrganizations(cmd) {
|
24049 | return list_command_awaiter(this, void 0, void 0, function* () {
|
24050 | let organizations = yield this.userService.getAllOrganizations();
|
24051 | if (cmd.search != null && cmd.search.trim() !== '') {
|
24052 | organizations = utils_CliUtils.searchOrganizations(organizations, cmd.search);
|
24053 | }
|
24054 | const res = new response_listResponse_ListResponse(organizations.map((o) => new response_organizationResponse_OrganizationResponse(o)));
|
24055 | return Response.success(res);
|
24056 | });
|
24057 | }
|
24058 | }
|
24059 |
|
24060 |
|
24061 | var lock_command_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
24062 | return new (P || (P = Promise))(function (resolve, reject) {
|
24063 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
24064 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
24065 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
24066 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
24067 | });
|
24068 | };
|
24069 |
|
24070 |
|
24071 | class lock_command_LockCommand {
|
24072 | constructor(vaultTimeoutService) {
|
24073 | this.vaultTimeoutService = vaultTimeoutService;
|
24074 | }
|
24075 | run(cmd) {
|
24076 | return lock_command_awaiter(this, void 0, void 0, function* () {
|
24077 | yield this.vaultTimeoutService.lock();
|
24078 | process.env.BW_SESSION = null;
|
24079 | const res = new MessageResponse('Your vault is locked.', null);
|
24080 | return Response.success(res);
|
24081 | });
|
24082 | }
|
24083 | }
|
24084 |
|
24085 |
|
24086 | class PasswordVerificationRequest {
|
24087 | }
|
24088 |
|
24089 |
|
24090 |
|
24091 | class twoFactorEmailRequest_TwoFactorEmailRequest extends PasswordVerificationRequest {
|
24092 | constructor(email, masterPasswordHash) {
|
24093 | super();
|
24094 | this.masterPasswordHash = masterPasswordHash;
|
24095 | this.email = email;
|
24096 | }
|
24097 | }
|
24098 |
|
24099 |
|
24100 | var login_command_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
24101 | return new (P || (P = Promise))(function (resolve, reject) {
|
24102 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
24103 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
24104 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
24105 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
24106 | });
|
24107 | };
|
24108 |
|
24109 |
|
24110 |
|
24111 |
|
24112 |
|
24113 |
|
24114 | class login_command_LoginCommand {
|
24115 | constructor(authService, apiService, i18nService) {
|
24116 | this.authService = authService;
|
24117 | this.apiService = apiService;
|
24118 | this.i18nService = i18nService;
|
24119 | }
|
24120 | run(email, password, cmd) {
|
24121 | return login_command_awaiter(this, void 0, void 0, function* () {
|
24122 | const canInteract = process.env.BW_NOINTERACTION !== 'true';
|
24123 | if ((email == null || email === '') && canInteract) {
|
24124 | const answer = yield external_inquirer_["createPromptModule"]({ output: process.stderr })({
|
24125 | type: 'input',
|
24126 | name: 'email',
|
24127 | message: 'Email address:',
|
24128 | });
|
24129 | email = answer.email;
|
24130 | }
|
24131 | if (email == null || email.trim() === '') {
|
24132 | return Response.badRequest('Email address is required.');
|
24133 | }
|
24134 | if (email.indexOf('@') === -1) {
|
24135 | return Response.badRequest('Email address is invalid.');
|
24136 | }
|
24137 | if (password == null || password === '') {
|
24138 | if (cmd.passwordfile) {
|
24139 | password = yield nodeUtils_NodeUtils.readFirstLine(cmd.passwordfile);
|
24140 | }
|
24141 | else if (cmd.passwordenv && process.env[cmd.passwordenv]) {
|
24142 | password = process.env[cmd.passwordenv];
|
24143 | }
|
24144 | else if (canInteract) {
|
24145 | const answer = yield external_inquirer_["createPromptModule"]({ output: process.stderr })({
|
24146 | type: 'password',
|
24147 | name: 'password',
|
24148 | message: 'Master password:',
|
24149 | });
|
24150 | password = answer.password;
|
24151 | }
|
24152 | }
|
24153 | if (password == null || password === '') {
|
24154 | return Response.badRequest('Master password is required.');
|
24155 | }
|
24156 | let twoFactorToken = cmd.code;
|
24157 | let twoFactorMethod = null;
|
24158 | try {
|
24159 | if (cmd.method != null) {
|
24160 | twoFactorMethod = parseInt(cmd.method, null);
|
24161 | }
|
24162 | }
|
24163 | catch (e) {
|
24164 | return Response.error('Invalid two-step login method.');
|
24165 | }
|
24166 | try {
|
24167 | if (this.validatedParams != null) {
|
24168 | yield this.validatedParams();
|
24169 | }
|
24170 | let response = null;
|
24171 | if (twoFactorToken != null && twoFactorMethod != null) {
|
24172 | response = yield this.authService.logInComplete(email, password, twoFactorMethod, twoFactorToken, false);
|
24173 | }
|
24174 | else {
|
24175 | response = yield this.authService.logIn(email, password);
|
24176 | if (response.twoFactor) {
|
24177 | let selectedProvider = null;
|
24178 | const twoFactorProviders = this.authService.getSupportedTwoFactorProviders(null);
|
24179 | if (twoFactorProviders.length === 0) {
|
24180 | return Response.badRequest('No providers available for this client.');
|
24181 | }
|
24182 | if (twoFactorMethod != null) {
|
24183 | try {
|
24184 | selectedProvider = twoFactorProviders.filter((p) => p.type === twoFactorMethod)[0];
|
24185 | }
|
24186 | catch (e) {
|
24187 | return Response.error('Invalid two-step login method.');
|
24188 | }
|
24189 | }
|
24190 | if (selectedProvider == null) {
|
24191 | if (twoFactorProviders.length === 1) {
|
24192 | selectedProvider = twoFactorProviders[0];
|
24193 | }
|
24194 | else if (canInteract) {
|
24195 | const options = twoFactorProviders.map((p) => p.name);
|
24196 | options.push(new external_inquirer_["Separator"]());
|
24197 | options.push('Cancel');
|
24198 | const answer = yield external_inquirer_["createPromptModule"]({ output: process.stderr })({
|
24199 | type: 'list',
|
24200 | name: 'method',
|
24201 | message: 'Two-step login method:',
|
24202 | choices: options,
|
24203 | });
|
24204 | const i = options.indexOf(answer.method);
|
24205 | if (i === (options.length - 1)) {
|
24206 | return Response.error('Login failed.');
|
24207 | }
|
24208 | selectedProvider = twoFactorProviders[i];
|
24209 | }
|
24210 | if (selectedProvider == null) {
|
24211 | return Response.error('Login failed. No provider selected.');
|
24212 | }
|
24213 | }
|
24214 | if (twoFactorToken == null && response.twoFactorProviders.size > 1 &&
|
24215 | selectedProvider.type === TwoFactorProviderType.Email) {
|
24216 | const emailReq = new twoFactorEmailRequest_TwoFactorEmailRequest(this.authService.email, this.authService.masterPasswordHash);
|
24217 | yield this.apiService.postTwoFactorEmail(emailReq);
|
24218 | }
|
24219 | if (twoFactorToken == null) {
|
24220 | if (canInteract) {
|
24221 | const answer = yield external_inquirer_["createPromptModule"]({ output: process.stderr })({
|
24222 | type: 'input',
|
24223 | name: 'token',
|
24224 | message: 'Two-step login code:',
|
24225 | });
|
24226 | twoFactorToken = answer.token;
|
24227 | }
|
24228 | if (twoFactorToken == null || twoFactorToken === '') {
|
24229 | return Response.badRequest('Code is required.');
|
24230 | }
|
24231 | }
|
24232 | response = yield this.authService.logInTwoFactor(selectedProvider.type, twoFactorToken, false);
|
24233 | }
|
24234 | }
|
24235 | if (response.twoFactor) {
|
24236 | return Response.error('Login failed.');
|
24237 | }
|
24238 | if (this.success != null) {
|
24239 | const res = yield this.success();
|
24240 | return Response.success(res);
|
24241 | }
|
24242 | else {
|
24243 | const res = new MessageResponse('You are logged in!', null);
|
24244 | return Response.success(res);
|
24245 | }
|
24246 | }
|
24247 | catch (e) {
|
24248 | return Response.error(e);
|
24249 | }
|
24250 | });
|
24251 | }
|
24252 | }
|
24253 |
|
24254 |
|
24255 | var commands_login_command_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
24256 | return new (P || (P = Promise))(function (resolve, reject) {
|
24257 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
24258 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
24259 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
24260 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
24261 | });
|
24262 | };
|
24263 |
|
24264 |
|
24265 |
|
24266 | class commands_login_command_LoginCommand extends login_command_LoginCommand {
|
24267 | constructor(authService, apiService, cryptoFunctionService, syncService, i18nService) {
|
24268 | super(authService, apiService, i18nService);
|
24269 | this.validatedParams = () => commands_login_command_awaiter(this, void 0, void 0, function* () {
|
24270 | const key = yield cryptoFunctionService.randomBytes(64);
|
24271 | process.env.BW_SESSION = utils_Utils.fromBufferToB64(key);
|
24272 | });
|
24273 | this.success = () => commands_login_command_awaiter(this, void 0, void 0, function* () {
|
24274 | yield syncService.fullSync(true);
|
24275 | const res = new MessageResponse('You are logged in!', '\n' +
|
24276 | 'To unlock your vault, set your session key to the `BW_SESSION` environment variable. ex:\n' +
|
24277 | '$ export BW_SESSION="' + process.env.BW_SESSION + '"\n' +
|
24278 | '> $env:BW_SESSION="' + process.env.BW_SESSION + '"\n\n' +
|
24279 | 'You can also pass the session key to any command with the `--session` option. ex:\n' +
|
24280 | '$ bw list items --session ' + process.env.BW_SESSION);
|
24281 | res.raw = process.env.BW_SESSION;
|
24282 | return res;
|
24283 | });
|
24284 | }
|
24285 | }
|
24286 |
|
24287 |
|
24288 | var restore_command_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
24289 | return new (P || (P = Promise))(function (resolve, reject) {
|
24290 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
24291 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
24292 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
24293 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
24294 | });
|
24295 | };
|
24296 |
|
24297 | class restore_command_RestoreCommand {
|
24298 | constructor(cipherService) {
|
24299 | this.cipherService = cipherService;
|
24300 | }
|
24301 | run(object, id, cmd) {
|
24302 | return restore_command_awaiter(this, void 0, void 0, function* () {
|
24303 | if (id != null) {
|
24304 | id = id.toLowerCase();
|
24305 | }
|
24306 | switch (object.toLowerCase()) {
|
24307 | case 'item':
|
24308 | return yield this.restoreCipher(id, cmd);
|
24309 | default:
|
24310 | return Response.badRequest('Unknown object.');
|
24311 | }
|
24312 | });
|
24313 | }
|
24314 | restoreCipher(id, cmd) {
|
24315 | return restore_command_awaiter(this, void 0, void 0, function* () {
|
24316 | const cipher = yield this.cipherService.get(id);
|
24317 | if (cipher == null) {
|
24318 | return Response.notFound();
|
24319 | }
|
24320 | if (cipher.deletedDate == null) {
|
24321 | return Response.badRequest('Cipher is not in trash.');
|
24322 | }
|
24323 | try {
|
24324 | yield this.cipherService.restoreWithServer(id);
|
24325 | return Response.success();
|
24326 | }
|
24327 | catch (e) {
|
24328 | return Response.error(e);
|
24329 | }
|
24330 | });
|
24331 | }
|
24332 | }
|
24333 |
|
24334 |
|
24335 | var share_command_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
24336 | return new (P || (P = Promise))(function (resolve, reject) {
|
24337 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
24338 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
24339 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
24340 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
24341 | });
|
24342 | };
|
24343 |
|
24344 |
|
24345 |
|
24346 | class share_command_ShareCommand {
|
24347 | constructor(cipherService) {
|
24348 | this.cipherService = cipherService;
|
24349 | }
|
24350 | run(id, organizationId, requestJson, cmd) {
|
24351 | return share_command_awaiter(this, void 0, void 0, function* () {
|
24352 | if (requestJson == null || requestJson === '') {
|
24353 | requestJson = yield utils_CliUtils.readStdin();
|
24354 | }
|
24355 | if (requestJson == null || requestJson === '') {
|
24356 | return Response.badRequest('`requestJson` was not provided.');
|
24357 | }
|
24358 | let req = [];
|
24359 | try {
|
24360 | const reqJson = Buffer.from(requestJson, 'base64').toString();
|
24361 | req = JSON.parse(reqJson);
|
24362 | if (req == null || req.length === 0) {
|
24363 | return Response.badRequest('You must provide at least one collection id for this item.');
|
24364 | }
|
24365 | }
|
24366 | catch (e) {
|
24367 | return Response.badRequest('Error parsing the encoded request data.');
|
24368 | }
|
24369 | if (id != null) {
|
24370 | id = id.toLowerCase();
|
24371 | }
|
24372 | if (organizationId != null) {
|
24373 | organizationId = organizationId.toLowerCase();
|
24374 | }
|
24375 | const cipher = yield this.cipherService.get(id);
|
24376 | if (cipher == null) {
|
24377 | return Response.notFound();
|
24378 | }
|
24379 | if (cipher.organizationId != null) {
|
24380 | return Response.badRequest('This item already belongs to an organization.');
|
24381 | }
|
24382 | const cipherView = yield cipher.decrypt();
|
24383 | try {
|
24384 | yield this.cipherService.shareWithServer(cipherView, organizationId, req);
|
24385 | const updatedCipher = yield this.cipherService.get(cipher.id);
|
24386 | const decCipher = yield updatedCipher.decrypt();
|
24387 | const res = new response_cipherResponse_CipherResponse(decCipher);
|
24388 | return Response.success(res);
|
24389 | }
|
24390 | catch (e) {
|
24391 | return Response.error(e);
|
24392 | }
|
24393 | });
|
24394 | }
|
24395 | }
|
24396 |
|
24397 |
|
24398 | var sync_command_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
24399 | return new (P || (P = Promise))(function (resolve, reject) {
|
24400 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
24401 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
24402 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
24403 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
24404 | });
|
24405 | };
|
24406 |
|
24407 |
|
24408 |
|
24409 | class sync_command_SyncCommand {
|
24410 | constructor(syncService) {
|
24411 | this.syncService = syncService;
|
24412 | }
|
24413 | run(cmd) {
|
24414 | return sync_command_awaiter(this, void 0, void 0, function* () {
|
24415 | if (cmd.last || false) {
|
24416 | return yield this.getLastSync();
|
24417 | }
|
24418 | try {
|
24419 | const result = yield this.syncService.fullSync(cmd.force || false);
|
24420 | const res = new MessageResponse('Syncing complete.', null);
|
24421 | return Response.success(res);
|
24422 | }
|
24423 | catch (e) {
|
24424 | return Response.error(e);
|
24425 | }
|
24426 | });
|
24427 | }
|
24428 | getLastSync() {
|
24429 | return sync_command_awaiter(this, void 0, void 0, function* () {
|
24430 | const lastSyncDate = yield this.syncService.getLastSync();
|
24431 | const res = new StringResponse(lastSyncDate == null ? null : lastSyncDate.toISOString());
|
24432 | return Response.success(res);
|
24433 | });
|
24434 | }
|
24435 | }
|
24436 |
|
24437 |
|
24438 | var unlock_command_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
24439 | return new (P || (P = Promise))(function (resolve, reject) {
|
24440 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
24441 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
24442 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
24443 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
24444 | });
|
24445 | };
|
24446 |
|
24447 |
|
24448 |
|
24449 |
|
24450 | class unlock_command_UnlockCommand {
|
24451 | constructor(cryptoService, userService, cryptoFunctionService) {
|
24452 | this.cryptoService = cryptoService;
|
24453 | this.userService = userService;
|
24454 | this.cryptoFunctionService = cryptoFunctionService;
|
24455 | }
|
24456 | run(password, cmd) {
|
24457 | return unlock_command_awaiter(this, void 0, void 0, function* () {
|
24458 | const canInteract = process.env.BW_NOINTERACTION !== 'true';
|
24459 | if ((password == null || password === '') && canInteract) {
|
24460 | const answer = yield external_inquirer_["createPromptModule"]({ output: process.stderr })({
|
24461 | type: 'password',
|
24462 | name: 'password',
|
24463 | message: 'Master password:',
|
24464 | });
|
24465 | password = answer.password;
|
24466 | }
|
24467 | if (password == null || password === '') {
|
24468 | return Response.badRequest('Master password is required.');
|
24469 | }
|
24470 | this.setNewSessionKey();
|
24471 | const email = yield this.userService.getEmail();
|
24472 | const kdf = yield this.userService.getKdf();
|
24473 | const kdfIterations = yield this.userService.getKdfIterations();
|
24474 | const key = yield this.cryptoService.makeKey(password, email, kdf, kdfIterations);
|
24475 | const keyHash = yield this.cryptoService.hashPassword(password, key);
|
24476 | const storedKeyHash = yield this.cryptoService.getKeyHash();
|
24477 | if (storedKeyHash != null && keyHash != null && storedKeyHash === keyHash) {
|
24478 | yield this.cryptoService.setKey(key);
|
24479 | const res = new MessageResponse('Your vault is now unlocked!', '\n' +
|
24480 | 'To unlock your vault, set your session key to the `BW_SESSION` environment variable. ex:\n' +
|
24481 | '$ export BW_SESSION="' + process.env.BW_SESSION + '"\n' +
|
24482 | '> $env:BW_SESSION="' + process.env.BW_SESSION + '"\n\n' +
|
24483 | 'You can also pass the session key to any command with the `--session` option. ex:\n' +
|
24484 | '$ bw list items --session ' + process.env.BW_SESSION);
|
24485 | res.raw = process.env.BW_SESSION;
|
24486 | return Response.success(res);
|
24487 | }
|
24488 | else {
|
24489 | return Response.error('Invalid master password.');
|
24490 | }
|
24491 | });
|
24492 | }
|
24493 | setNewSessionKey() {
|
24494 | return unlock_command_awaiter(this, void 0, void 0, function* () {
|
24495 | const key = yield this.cryptoFunctionService.randomBytes(64);
|
24496 | process.env.BW_SESSION = utils_Utils.fromBufferToB64(key);
|
24497 | });
|
24498 | }
|
24499 | }
|
24500 |
|
24501 |
|
24502 | var completion_command_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
24503 | return new (P || (P = Promise))(function (resolve, reject) {
|
24504 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
24505 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
24506 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
24507 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
24508 | });
|
24509 | };
|
24510 |
|
24511 |
|
24512 | const validShells = ['zsh'];
|
24513 | class completion_command_CompletionCommand {
|
24514 | run(cmd) {
|
24515 | return completion_command_awaiter(this, void 0, void 0, function* () {
|
24516 | const shell = cmd.shell;
|
24517 | if (!shell) {
|
24518 | return Response.badRequest('`shell` was not provided.');
|
24519 | }
|
24520 | if (!validShells.includes(shell)) {
|
24521 | return Response.badRequest('Unsupported shell.');
|
24522 | }
|
24523 | let content = '';
|
24524 | if (shell === 'zsh') {
|
24525 | content = this.zshCompletion('bw', cmd.parent).render();
|
24526 | }
|
24527 | const res = new MessageResponse(content, null);
|
24528 | return Response.success(res);
|
24529 | });
|
24530 | }
|
24531 | zshCompletion(rootName, rootCommand) {
|
24532 | return {
|
24533 | render: () => {
|
24534 | return [
|
24535 | `#compdef _${rootName} ${rootName}`,
|
24536 | '',
|
24537 | this.renderCommandBlock(rootName, rootCommand),
|
24538 | ].join('\n');
|
24539 | },
|
24540 | };
|
24541 | }
|
24542 | renderCommandBlock(name, command) {
|
24543 | const { commands = [], options = [] } = command;
|
24544 | const hasOptions = options.length > 0;
|
24545 | const hasCommands = commands.length > 0;
|
24546 | const args = options
|
24547 | .map(({ long, short, description }) => {
|
24548 | const aliases = [short, long].filter(Boolean);
|
24549 | const opts = aliases.join(',');
|
24550 | const desc = `[${description.replace(`'`, `'"'"'`)}]`;
|
24551 | return aliases.length > 1 ? `'(${aliases.join(' ')})'{${opts}}'${desc}'` : `'${opts}${desc}'`;
|
24552 | }).concat(`'(-h --help)'{-h,--help}'[output usage information]'`, hasCommands ? '"1: :->cmnds"' : null, '"*::arg:->args"').filter(Boolean);
|
24553 | const commandBlockFunctionParts = [];
|
24554 | if (hasCommands) {
|
24555 | commandBlockFunctionParts.push('local -a commands');
|
24556 | }
|
24557 | if (hasOptions) {
|
24558 | commandBlockFunctionParts.push(`_arguments -C \\\n ${args.join(` \\\n `)}`);
|
24559 | }
|
24560 | if (hasCommands) {
|
24561 | commandBlockFunctionParts.push(`case $state in
|
24562 | cmnds)
|
24563 | commands=(
|
24564 | ${commands.map(({ _name, _description }) => `"${_name}:${_description}"`).join('\n ')}
|
24565 | )
|
24566 | _describe "command" commands
|
24567 | ;;
|
24568 | esac
|
24569 |
|
24570 | case "$words[1]" in
|
24571 | ${commands.map(({ _name }) => [`${_name})`, `_${name}_${_name}`, ';;'].join('\n ')).join('\n ')}
|
24572 | esac`);
|
24573 | }
|
24574 | const commandBlocParts = [
|
24575 | `function _${name} {\n ${commandBlockFunctionParts.join('\n\n ')}\n}`,
|
24576 | ];
|
24577 | if (hasCommands) {
|
24578 | commandBlocParts.push(commands.map((c) => this.renderCommandBlock(`${name}_${c._name}`, c)).join('\n\n'));
|
24579 | }
|
24580 | return commandBlocParts.join('\n\n');
|
24581 | }
|
24582 | }
|
24583 |
|
24584 |
|
24585 | var logout_command_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
24586 | return new (P || (P = Promise))(function (resolve, reject) {
|
24587 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
24588 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
24589 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
24590 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
24591 | });
|
24592 | };
|
24593 |
|
24594 |
|
24595 | class logout_command_LogoutCommand {
|
24596 | constructor(authService, i18nService, logoutCallback) {
|
24597 | this.authService = authService;
|
24598 | this.i18nService = i18nService;
|
24599 | this.logoutCallback = logoutCallback;
|
24600 | }
|
24601 | run(cmd) {
|
24602 | return logout_command_awaiter(this, void 0, void 0, function* () {
|
24603 | yield this.logoutCallback();
|
24604 | this.authService.logOut(() => { });
|
24605 | const res = new MessageResponse('You have logged out.', null);
|
24606 | return Response.success(res);
|
24607 | });
|
24608 | }
|
24609 | }
|
24610 |
|
24611 |
|
24612 | var update_command_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
24613 | return new (P || (P = Promise))(function (resolve, reject) {
|
24614 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
24615 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
24616 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
24617 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
24618 | });
|
24619 | };
|
24620 |
|
24621 |
|
24622 |
|
24623 | class update_command_UpdateCommand {
|
24624 | constructor(platformUtilsService, i18nService, repoName, executableName, showExtendedMessage) {
|
24625 | this.platformUtilsService = platformUtilsService;
|
24626 | this.i18nService = i18nService;
|
24627 | this.repoName = repoName;
|
24628 | this.executableName = executableName;
|
24629 | this.showExtendedMessage = showExtendedMessage;
|
24630 | this.inPkg = false;
|
24631 | this.inPkg = !!process.pkg;
|
24632 | }
|
24633 | run(cmd) {
|
24634 | return update_command_awaiter(this, void 0, void 0, function* () {
|
24635 | const currentVersion = this.platformUtilsService.getApplicationVersion();
|
24636 | const response = yield external_node_fetch_default.a('https://api.github.com/repos/bitwarden/' +
|
24637 | this.repoName + '/releases/latest');
|
24638 | if (response.status === 200) {
|
24639 | const responseJson = yield response.json();
|
24640 | const res = new MessageResponse(null, null);
|
24641 | const tagName = responseJson.tag_name;
|
24642 | if (tagName === ('v' + currentVersion)) {
|
24643 | res.title = 'No update available.';
|
24644 | res.noColor = true;
|
24645 | return Response.success(res);
|
24646 | }
|
24647 | let downloadUrl = null;
|
24648 | if (responseJson.assets != null) {
|
24649 | for (const a of responseJson.assets) {
|
24650 | const download = a.browser_download_url;
|
24651 | if (download == null) {
|
24652 | continue;
|
24653 | }
|
24654 | if (download.indexOf('.zip') === -1) {
|
24655 | continue;
|
24656 | }
|
24657 | if (process.platform === 'win32' && download.indexOf(this.executableName + '-windows') > -1) {
|
24658 | downloadUrl = download;
|
24659 | break;
|
24660 | }
|
24661 | else if (process.platform === 'darwin' && download.indexOf(this.executableName + '-macos') > -1) {
|
24662 | downloadUrl = download;
|
24663 | break;
|
24664 | }
|
24665 | else if (process.platform === 'linux' && download.indexOf(this.executableName + '-linux') > -1) {
|
24666 | downloadUrl = download;
|
24667 | break;
|
24668 | }
|
24669 | }
|
24670 | }
|
24671 | res.title = 'A new version is available: ' + tagName;
|
24672 | if (downloadUrl == null) {
|
24673 | downloadUrl = 'https://github.com/bitwarden/' + this.repoName + '/releases';
|
24674 | }
|
24675 | else {
|
24676 | res.raw = downloadUrl;
|
24677 | }
|
24678 | res.message = '';
|
24679 | if (responseJson.body != null && responseJson.body !== '') {
|
24680 | res.message = responseJson.body + '\n\n';
|
24681 | }
|
24682 | res.message += 'You can download this update at ' + downloadUrl;
|
24683 | if (this.showExtendedMessage) {
|
24684 | if (this.inPkg) {
|
24685 | res.message += '\n\nIf you installed this CLI through a package manager ' +
|
24686 | 'you should probably update using its update command instead.';
|
24687 | }
|
24688 | else {
|
24689 | res.message += '\n\nIf you installed this CLI through NPM ' +
|
24690 | 'you should update using `npm install -g @bitwarden/' + this.repoName + '`';
|
24691 | }
|
24692 | }
|
24693 | return Response.success(res);
|
24694 | }
|
24695 | else {
|
24696 | return Response.error('Error contacting update API: ' + response.status);
|
24697 | }
|
24698 | });
|
24699 | }
|
24700 | }
|
24701 |
|
24702 |
|
24703 | var baseProgram_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
24704 | return new (P || (P = Promise))(function (resolve, reject) {
|
24705 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
24706 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
24707 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
24708 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
24709 | });
|
24710 | };
|
24711 |
|
24712 |
|
24713 | const chalk = external_chalk_default.a;
|
24714 | class baseProgram_BaseProgram {
|
24715 | constructor(userService, writeLn) {
|
24716 | this.userService = userService;
|
24717 | this.writeLn = writeLn;
|
24718 | }
|
24719 | processResponse(response, exitImmediately = false, dataProcessor = null) {
|
24720 | if (!response.success) {
|
24721 | if (process.env.BW_QUIET !== 'true') {
|
24722 | if (process.env.BW_RESPONSE === 'true') {
|
24723 | this.writeLn(this.getJson(response), true, true);
|
24724 | }
|
24725 | else {
|
24726 | this.writeLn(chalk.redBright(response.message), true, true);
|
24727 | }
|
24728 | }
|
24729 | if (exitImmediately) {
|
24730 | process.exit(1);
|
24731 | }
|
24732 | else {
|
24733 | process.exitCode = 1;
|
24734 | }
|
24735 | return;
|
24736 | }
|
24737 | if (process.env.BW_RESPONSE === 'true') {
|
24738 | this.writeLn(this.getJson(response), true, false);
|
24739 | }
|
24740 | else if (response.data != null) {
|
24741 | let out = dataProcessor != null ? dataProcessor() : null;
|
24742 | if (out == null) {
|
24743 | if (response.data.object === 'string') {
|
24744 | const data = response.data.data;
|
24745 | if (data != null) {
|
24746 | out = data;
|
24747 | }
|
24748 | }
|
24749 | else if (response.data.object === 'list') {
|
24750 | out = this.getJson(response.data.data);
|
24751 | }
|
24752 | else if (response.data.object === 'message') {
|
24753 | out = this.getMessage(response);
|
24754 | }
|
24755 | else {
|
24756 | out = this.getJson(response.data);
|
24757 | }
|
24758 | }
|
24759 | if (out != null && process.env.BW_QUIET !== 'true') {
|
24760 | this.writeLn(out, true, false);
|
24761 | }
|
24762 | }
|
24763 | if (exitImmediately) {
|
24764 | process.exit(0);
|
24765 | }
|
24766 | else {
|
24767 | process.exitCode = 0;
|
24768 | }
|
24769 | }
|
24770 | getJson(obj) {
|
24771 | if (process.env.BW_PRETTY === 'true') {
|
24772 | return JSON.stringify(obj, null, ' ');
|
24773 | }
|
24774 | else {
|
24775 | return JSON.stringify(obj);
|
24776 | }
|
24777 | }
|
24778 | getMessage(response) {
|
24779 | const message = response.data;
|
24780 | if (process.env.BW_RAW === 'true') {
|
24781 | return message.raw;
|
24782 | }
|
24783 | let out = '';
|
24784 | if (message.title != null) {
|
24785 | if (message.noColor) {
|
24786 | out = message.title;
|
24787 | }
|
24788 | else {
|
24789 | out = chalk.greenBright(message.title);
|
24790 | }
|
24791 | }
|
24792 | if (message.message != null) {
|
24793 | if (message.title != null) {
|
24794 | out += '\n';
|
24795 | }
|
24796 | out += message.message;
|
24797 | }
|
24798 | return out.trim() === '' ? null : out;
|
24799 | }
|
24800 | exitIfAuthed() {
|
24801 | return baseProgram_awaiter(this, void 0, void 0, function* () {
|
24802 | const authed = yield this.userService.isAuthenticated();
|
24803 | if (authed) {
|
24804 | const email = yield this.userService.getEmail();
|
24805 | this.processResponse(Response.error('You are already logged in as ' + email + '.'), true);
|
24806 | }
|
24807 | });
|
24808 | }
|
24809 | exitIfNotAuthed() {
|
24810 | return baseProgram_awaiter(this, void 0, void 0, function* () {
|
24811 | const authed = yield this.userService.isAuthenticated();
|
24812 | if (!authed) {
|
24813 | this.processResponse(Response.error('You are not logged in.'), true);
|
24814 | }
|
24815 | });
|
24816 | }
|
24817 | }
|
24818 |
|
24819 |
|
24820 | var program_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
24821 | return new (P || (P = Promise))(function (resolve, reject) {
|
24822 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
24823 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
24824 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
24825 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
24826 | });
|
24827 | };
|
24828 |
|
24829 |
|
24830 |
|
24831 |
|
24832 |
|
24833 |
|
24834 |
|
24835 |
|
24836 |
|
24837 |
|
24838 |
|
24839 |
|
24840 |
|
24841 |
|
24842 |
|
24843 |
|
24844 |
|
24845 |
|
24846 |
|
24847 |
|
24848 |
|
24849 |
|
24850 |
|
24851 |
|
24852 |
|
24853 |
|
24854 | const program_chalk = external_chalk_default.a;
|
24855 | const writeLn = utils_CliUtils.writeLn;
|
24856 | class program_Program extends baseProgram_BaseProgram {
|
24857 | constructor(main) {
|
24858 | super(main.userService, writeLn);
|
24859 | this.main = main;
|
24860 | }
|
24861 | run() {
|
24862 | external_commander_["option"]('--pretty', 'Format output. JSON is tabbed with two spaces.')
|
24863 | .option('--raw', 'Return raw output instead of a descriptive message.')
|
24864 | .option('--response', 'Return a JSON formatted version of response output.')
|
24865 | .option('--quiet', 'Don\'t return anything to stdout.')
|
24866 | .option('--nointeraction', 'Do not prompt for interactive user input.')
|
24867 | .option('--session <session>', 'Pass session key instead of reading from env.')
|
24868 | .version(this.main.platformUtilsService.getApplicationVersion(), '-v, --version');
|
24869 | external_commander_["on"]('option:pretty', () => {
|
24870 | process.env.BW_PRETTY = 'true';
|
24871 | });
|
24872 | external_commander_["on"]('option:raw', () => {
|
24873 | process.env.BW_RAW = 'true';
|
24874 | });
|
24875 | external_commander_["on"]('option:quiet', () => {
|
24876 | process.env.BW_QUIET = 'true';
|
24877 | });
|
24878 | external_commander_["on"]('option:response', () => {
|
24879 | process.env.BW_RESPONSE = 'true';
|
24880 | });
|
24881 | external_commander_["on"]('option:nointeraction', () => {
|
24882 | process.env.BW_NOINTERACTION = 'true';
|
24883 | });
|
24884 | external_commander_["on"]('option:session', (key) => {
|
24885 | process.env.BW_SESSION = key;
|
24886 | });
|
24887 | external_commander_["on"]('command:*', () => {
|
24888 | writeLn(program_chalk.redBright('Invalid command: ' + external_commander_["args"].join(' ')), false, true);
|
24889 | writeLn('See --help for a list of available commands.', true, true);
|
24890 | process.exitCode = 1;
|
24891 | });
|
24892 | external_commander_["on"]('--help', () => {
|
24893 | writeLn('\n Examples:');
|
24894 | writeLn('');
|
24895 | writeLn(' bw login');
|
24896 | writeLn(' bw lock');
|
24897 | writeLn(' bw unlock myPassword321');
|
24898 | writeLn(' bw list --help');
|
24899 | writeLn(' bw list items --search google');
|
24900 | writeLn(' bw get item 99ee88d2-6046-4ea7-92c2-acac464b1412');
|
24901 | writeLn(' bw get password google.com');
|
24902 | writeLn(' echo \'{"name":"My Folder"}\' | bw encode');
|
24903 | writeLn(' bw create folder eyJuYW1lIjoiTXkgRm9sZGVyIn0K');
|
24904 | writeLn(' bw edit folder c7c7b60b-9c61-40f2-8ccd-36c49595ed72 eyJuYW1lIjoiTXkgRm9sZGVyMiJ9Cg==');
|
24905 | writeLn(' bw delete item 99ee88d2-6046-4ea7-92c2-acac464b1412');
|
24906 | writeLn(' bw generate -lusn --length 18');
|
24907 | writeLn(' bw config server https://bitwarden.example.com');
|
24908 | writeLn('', true);
|
24909 | });
|
24910 | external_commander_["command"]('login [email] [password]')
|
24911 | .description('Log into a user account.')
|
24912 | .option('--method <method>', 'Two-step login method.')
|
24913 | .option('--code <code>', 'Two-step login code.')
|
24914 | .option('--check', 'Check login status.', () => program_awaiter(this, void 0, void 0, function* () {
|
24915 | const authed = yield this.main.userService.isAuthenticated();
|
24916 | if (authed) {
|
24917 | const res = new MessageResponse('You are logged in!', null);
|
24918 | this.processResponse(Response.success(res), true);
|
24919 | }
|
24920 | this.processResponse(Response.error('You are not logged in.'), true);
|
24921 | }))
|
24922 | .on('--help', () => {
|
24923 | writeLn('\n Notes:');
|
24924 | writeLn('');
|
24925 | writeLn(' See docs for valid `method` enum values.');
|
24926 | writeLn('');
|
24927 | writeLn(' Pass `--raw` option to only return the session key.');
|
24928 | writeLn('');
|
24929 | writeLn(' Examples:');
|
24930 | writeLn('');
|
24931 | writeLn(' bw login');
|
24932 | writeLn(' bw login john@example.com myPassword321 --raw');
|
24933 | writeLn(' bw login john@example.com myPassword321 --method 1 --code 249213');
|
24934 | writeLn('', true);
|
24935 | })
|
24936 | .action((email, password, cmd) => program_awaiter(this, void 0, void 0, function* () {
|
24937 | if (!cmd.check) {
|
24938 | yield this.exitIfAuthed();
|
24939 | const command = new commands_login_command_LoginCommand(this.main.authService, this.main.apiService, this.main.cryptoFunctionService, this.main.syncService, this.main.i18nService);
|
24940 | const response = yield command.run(email, password, cmd);
|
24941 | this.processResponse(response);
|
24942 | }
|
24943 | }));
|
24944 | external_commander_["command"]('logout')
|
24945 | .description('Log out of the current user account.')
|
24946 | .on('--help', () => {
|
24947 | writeLn('\n Examples:');
|
24948 | writeLn('');
|
24949 | writeLn(' bw logout');
|
24950 | writeLn('', true);
|
24951 | })
|
24952 | .action((cmd) => program_awaiter(this, void 0, void 0, function* () {
|
24953 | yield this.exitIfNotAuthed();
|
24954 | const command = new logout_command_LogoutCommand(this.main.authService, this.main.i18nService, () => program_awaiter(this, void 0, void 0, function* () { return yield this.main.logout(); }));
|
24955 | const response = yield command.run(cmd);
|
24956 | this.processResponse(response);
|
24957 | }));
|
24958 | external_commander_["command"]('lock')
|
24959 | .description('Lock the vault and destroy active session keys.')
|
24960 | .on('--help', () => {
|
24961 | writeLn('\n Examples:');
|
24962 | writeLn('');
|
24963 | writeLn(' bw lock');
|
24964 | writeLn('', true);
|
24965 | })
|
24966 | .action((cmd) => program_awaiter(this, void 0, void 0, function* () {
|
24967 | yield this.exitIfNotAuthed();
|
24968 | const command = new lock_command_LockCommand(this.main.vaultTimeoutService);
|
24969 | const response = yield command.run(cmd);
|
24970 | this.processResponse(response);
|
24971 | }));
|
24972 | external_commander_["command"]('unlock [password]')
|
24973 | .description('Unlock the vault and return a new session key.')
|
24974 | .on('--help', () => {
|
24975 | writeLn('\n Notes:');
|
24976 | writeLn('');
|
24977 | writeLn(' After unlocking, any previous session keys will no longer be valid.');
|
24978 | writeLn('');
|
24979 | writeLn(' Pass `--raw` option to only return the session key.');
|
24980 | writeLn('');
|
24981 | writeLn(' Examples:');
|
24982 | writeLn('');
|
24983 | writeLn(' bw unlock');
|
24984 | writeLn(' bw unlock myPassword321');
|
24985 | writeLn(' bw unlock myPassword321 --raw');
|
24986 | writeLn('', true);
|
24987 | })
|
24988 | .option('--check', 'Check lock status.', () => program_awaiter(this, void 0, void 0, function* () {
|
24989 | const locked = yield this.main.vaultTimeoutService.isLocked();
|
24990 | if (!locked) {
|
24991 | const res = new MessageResponse('Vault is unlocked!', null);
|
24992 | this.processResponse(Response.success(res), true);
|
24993 | }
|
24994 | this.processResponse(Response.error('Vault is locked.'), true);
|
24995 | }))
|
24996 | .action((password, cmd) => program_awaiter(this, void 0, void 0, function* () {
|
24997 | if (!cmd.check) {
|
24998 | yield this.exitIfNotAuthed();
|
24999 | const command = new unlock_command_UnlockCommand(this.main.cryptoService, this.main.userService, this.main.cryptoFunctionService);
|
25000 | const response = yield command.run(password, cmd);
|
25001 | this.processResponse(response);
|
25002 | }
|
25003 | }));
|
25004 | external_commander_["command"]('sync')
|
25005 | .description('Pull the latest vault data from server.')
|
25006 | .option('-f, --force', 'Force a full sync.')
|
25007 | .option('--last', 'Get the last sync date.')
|
25008 | .on('--help', () => {
|
25009 | writeLn('\n Examples:');
|
25010 | writeLn('');
|
25011 | writeLn(' bw sync');
|
25012 | writeLn(' bw sync -f');
|
25013 | writeLn(' bw sync --last');
|
25014 | writeLn('', true);
|
25015 | })
|
25016 | .action((cmd) => program_awaiter(this, void 0, void 0, function* () {
|
25017 | yield this.exitIfLocked();
|
25018 | const command = new sync_command_SyncCommand(this.main.syncService);
|
25019 | const response = yield command.run(cmd);
|
25020 | this.processResponse(response);
|
25021 | }));
|
25022 | external_commander_["command"]('list <object>')
|
25023 | .description('List an array of objects from the vault.')
|
25024 | .option('--search <search>', 'Perform a search on the listed objects.')
|
25025 | .option('--url <url>', 'Filter items of type login with a url-match search.')
|
25026 | .option('--folderid <folderid>', 'Filter items by folder id.')
|
25027 | .option('--collectionid <collectionid>', 'Filter items by collection id.')
|
25028 | .option('--organizationid <organizationid>', 'Filter items or collections by organization id.')
|
25029 | .option('--trash', 'Filter items that are deleted and in the trash.')
|
25030 | .on('--help', () => {
|
25031 | writeLn('\n Objects:');
|
25032 | writeLn('');
|
25033 | writeLn(' items');
|
25034 | writeLn(' folders');
|
25035 | writeLn(' collections');
|
25036 | writeLn(' organizations');
|
25037 | writeLn(' org-collections');
|
25038 | writeLn(' org-members');
|
25039 | writeLn('');
|
25040 | writeLn(' Notes:');
|
25041 | writeLn('');
|
25042 | writeLn(' Combining search with a filter performs a logical AND operation.');
|
25043 | writeLn('');
|
25044 | writeLn(' Combining multiple filters performs a logical OR operation.');
|
25045 | writeLn('');
|
25046 | writeLn(' Examples:');
|
25047 | writeLn('');
|
25048 | writeLn(' bw list items');
|
25049 | writeLn(' bw list items --folderid 60556c31-e649-4b5d-8daf-fc1c391a1bf2');
|
25050 | writeLn(' bw list items --search google --folderid 60556c31-e649-4b5d-8daf-fc1c391a1bf2');
|
25051 | writeLn(' bw list items --url https://google.com');
|
25052 | writeLn(' bw list items --folderid null');
|
25053 | writeLn(' bw list items --organizationid notnull');
|
25054 | writeLn(' bw list items --folderid 60556c31-e649-4b5d-8daf-fc1c391a1bf2 --organizationid notnull');
|
25055 | writeLn(' bw list items --trash');
|
25056 | writeLn(' bw list folders --search email');
|
25057 | writeLn(' bw list org-members --organizationid 60556c31-e649-4b5d-8daf-fc1c391a1bf2');
|
25058 | writeLn('', true);
|
25059 | })
|
25060 | .action((object, cmd) => program_awaiter(this, void 0, void 0, function* () {
|
25061 | yield this.exitIfLocked();
|
25062 | const command = new list_command_ListCommand(this.main.cipherService, this.main.folderService, this.main.collectionService, this.main.userService, this.main.searchService, this.main.apiService);
|
25063 | const response = yield command.run(object, cmd);
|
25064 | this.processResponse(response);
|
25065 | }));
|
25066 | external_commander_["command"]('get <object> <id>')
|
25067 | .description('Get an object from the vault.')
|
25068 | .option('--itemid <itemid>', 'Attachment\'s item id.')
|
25069 | .option('--output <output>', 'Output directory or filename for attachment.')
|
25070 | .option('--organizationid <organizationid>', 'Organization id for an organization object.')
|
25071 | .on('--help', () => {
|
25072 | writeLn('\n Objects:');
|
25073 | writeLn('');
|
25074 | writeLn(' item');
|
25075 | writeLn(' username');
|
25076 | writeLn(' password');
|
25077 | writeLn(' uri');
|
25078 | writeLn(' totp');
|
25079 | writeLn(' exposed');
|
25080 | writeLn(' attachment');
|
25081 | writeLn(' folder');
|
25082 | writeLn(' collection');
|
25083 | writeLn(' org-collection');
|
25084 | writeLn(' organization');
|
25085 | writeLn(' template');
|
25086 | writeLn(' fingerprint');
|
25087 | writeLn('');
|
25088 | writeLn(' Id:');
|
25089 | writeLn('');
|
25090 | writeLn(' Search term or object\'s globally unique `id`.');
|
25091 | writeLn('');
|
25092 | writeLn(' Examples:');
|
25093 | writeLn('');
|
25094 | writeLn(' bw get item 99ee88d2-6046-4ea7-92c2-acac464b1412');
|
25095 | writeLn(' bw get password https://google.com');
|
25096 | writeLn(' bw get totp google.com');
|
25097 | writeLn(' bw get exposed yahoo.com');
|
25098 | writeLn(' bw get attachment b857igwl1dzrs2 --itemid 99ee88d2-6046-4ea7-92c2-acac464b1412 ' +
|
25099 | '--output ./photo.jpg');
|
25100 | writeLn(' bw get attachment photo.jpg --itemid 99ee88d2-6046-4ea7-92c2-acac464b1412 --raw');
|
25101 | writeLn(' bw get folder email');
|
25102 | writeLn(' bw get template folder');
|
25103 | writeLn('', true);
|
25104 | })
|
25105 | .action((object, id, cmd) => program_awaiter(this, void 0, void 0, function* () {
|
25106 | yield this.exitIfLocked();
|
25107 | const command = new get_command_GetCommand(this.main.cipherService, this.main.folderService, this.main.collectionService, this.main.totpService, this.main.auditService, this.main.cryptoService, this.main.userService, this.main.searchService, this.main.apiService);
|
25108 | const response = yield command.run(object, id, cmd);
|
25109 | this.processResponse(response);
|
25110 | }));
|
25111 | external_commander_["command"]('create <object> [encodedJson]')
|
25112 | .option('--file <file>', 'Path to file for attachment.')
|
25113 | .option('--itemid <itemid>', 'Attachment\'s item id.')
|
25114 | .option('--organizationid <organizationid>', 'Organization id for an organization object.')
|
25115 | .description('Create an object in the vault.')
|
25116 | .on('--help', () => {
|
25117 | writeLn('\n Objects:');
|
25118 | writeLn('');
|
25119 | writeLn(' item');
|
25120 | writeLn(' attachment');
|
25121 | writeLn(' folder');
|
25122 | writeLn(' org-collection');
|
25123 | writeLn('');
|
25124 | writeLn(' Notes:');
|
25125 | writeLn('');
|
25126 | writeLn(' `encodedJson` can also be piped into stdin.');
|
25127 | writeLn('');
|
25128 | writeLn(' Examples:');
|
25129 | writeLn('');
|
25130 | writeLn(' bw create folder eyJuYW1lIjoiTXkgRm9sZGVyIn0K');
|
25131 | writeLn(' echo \'eyJuYW1lIjoiTXkgRm9sZGVyIn0K\' | bw create folder');
|
25132 | writeLn(' bw create attachment --file ./myfile.csv ' +
|
25133 | '--itemid 16b15b89-65b3-4639-ad2a-95052a6d8f66');
|
25134 | writeLn('', true);
|
25135 | })
|
25136 | .action((object, encodedJson, cmd) => program_awaiter(this, void 0, void 0, function* () {
|
25137 | yield this.exitIfLocked();
|
25138 | const command = new create_command_CreateCommand(this.main.cipherService, this.main.folderService, this.main.userService, this.main.cryptoService, this.main.apiService);
|
25139 | const response = yield command.run(object, encodedJson, cmd);
|
25140 | this.processResponse(response);
|
25141 | }));
|
25142 | external_commander_["command"]('edit <object> <id> [encodedJson]')
|
25143 | .option('--organizationid <organizationid>', 'Organization id for an organization object.')
|
25144 | .description('Edit an object from the vault.')
|
25145 | .on('--help', () => {
|
25146 | writeLn('\n Objects:');
|
25147 | writeLn('');
|
25148 | writeLn(' item');
|
25149 | writeLn(' item-collections');
|
25150 | writeLn(' folder');
|
25151 | writeLn(' org-collection');
|
25152 | writeLn('');
|
25153 | writeLn(' Id:');
|
25154 | writeLn('');
|
25155 | writeLn(' Object\'s globally unique `id`.');
|
25156 | writeLn('');
|
25157 | writeLn(' Notes:');
|
25158 | writeLn('');
|
25159 | writeLn(' `encodedJson` can also be piped into stdin.');
|
25160 | writeLn('');
|
25161 | writeLn(' Examples:');
|
25162 | writeLn('');
|
25163 | writeLn(' bw edit folder 5cdfbd80-d99f-409b-915b-f4c5d0241b02 eyJuYW1lIjoiTXkgRm9sZGVyMiJ9Cg==');
|
25164 | writeLn(' echo \'eyJuYW1lIjoiTXkgRm9sZGVyMiJ9Cg==\' | ' +
|
25165 | 'bw edit folder 5cdfbd80-d99f-409b-915b-f4c5d0241b02');
|
25166 | writeLn(' bw edit item-collections 78307355-fd25-416b-88b8-b33fd0e88c82 ' +
|
25167 | 'WyI5NzQwNTNkMC0zYjMzLTRiOTgtODg2ZS1mZWNmNWM4ZGJhOTYiXQ==');
|
25168 | writeLn('', true);
|
25169 | })
|
25170 | .action((object, id, encodedJson, cmd) => program_awaiter(this, void 0, void 0, function* () {
|
25171 | yield this.exitIfLocked();
|
25172 | const command = new edit_command_EditCommand(this.main.cipherService, this.main.folderService, this.main.cryptoService, this.main.apiService);
|
25173 | const response = yield command.run(object, id, encodedJson, cmd);
|
25174 | this.processResponse(response);
|
25175 | }));
|
25176 | external_commander_["command"]('delete <object> <id>')
|
25177 | .option('--itemid <itemid>', 'Attachment\'s item id.')
|
25178 | .option('--organizationid <organizationid>', 'Organization id for an organization object.')
|
25179 | .option('-p, --permanent', 'Permanently deletes the item instead of soft-deleting it (item only).')
|
25180 | .description('Delete an object from the vault.')
|
25181 | .on('--help', () => {
|
25182 | writeLn('\n Objects:');
|
25183 | writeLn('');
|
25184 | writeLn(' item');
|
25185 | writeLn(' attachment');
|
25186 | writeLn(' folder');
|
25187 | writeLn(' org-collection');
|
25188 | writeLn('');
|
25189 | writeLn(' Id:');
|
25190 | writeLn('');
|
25191 | writeLn(' Object\'s globally unique `id`.');
|
25192 | writeLn('');
|
25193 | writeLn(' Examples:');
|
25194 | writeLn('');
|
25195 | writeLn(' bw delete item 7063feab-4b10-472e-b64c-785e2b870b92');
|
25196 | writeLn(' bw delete item 89c21cd2-fab0-4f69-8c6e-ab8a0168f69a --permanent');
|
25197 | writeLn(' bw delete folder 5cdfbd80-d99f-409b-915b-f4c5d0241b02');
|
25198 | writeLn(' bw delete attachment b857igwl1dzrs2 --itemid 310d5ffd-e9a2-4451-af87-ea054dce0f78');
|
25199 | writeLn('', true);
|
25200 | })
|
25201 | .action((object, id, cmd) => program_awaiter(this, void 0, void 0, function* () {
|
25202 | yield this.exitIfLocked();
|
25203 | const command = new delete_command_DeleteCommand(this.main.cipherService, this.main.folderService, this.main.userService, this.main.apiService);
|
25204 | const response = yield command.run(object, id, cmd);
|
25205 | this.processResponse(response);
|
25206 | }));
|
25207 | external_commander_["command"]('restore <object> <id>')
|
25208 | .description('Restores an object from the trash.')
|
25209 | .on('--help', () => {
|
25210 | writeLn('\n Objects:');
|
25211 | writeLn('');
|
25212 | writeLn(' item');
|
25213 | writeLn('');
|
25214 | writeLn(' Id:');
|
25215 | writeLn('');
|
25216 | writeLn(' Object\'s globally unique `id`.');
|
25217 | writeLn('');
|
25218 | writeLn(' Examples:');
|
25219 | writeLn('');
|
25220 | writeLn(' bw restore item 7063feab-4b10-472e-b64c-785e2b870b92');
|
25221 | writeLn('', true);
|
25222 | })
|
25223 | .action((object, id, cmd) => program_awaiter(this, void 0, void 0, function* () {
|
25224 | yield this.exitIfLocked();
|
25225 | const command = new restore_command_RestoreCommand(this.main.cipherService);
|
25226 | const response = yield command.run(object, id, cmd);
|
25227 | this.processResponse(response);
|
25228 | }));
|
25229 | external_commander_["command"]('share <id> <organizationId> [encodedJson]')
|
25230 | .description('Share an item to an organization.')
|
25231 | .on('--help', () => {
|
25232 | writeLn('\n Id:');
|
25233 | writeLn('');
|
25234 | writeLn(' Item\'s globally unique `id`.');
|
25235 | writeLn('');
|
25236 | writeLn(' Organization Id:');
|
25237 | writeLn('');
|
25238 | writeLn(' Organization\'s globally unique `id`.');
|
25239 | writeLn('');
|
25240 | writeLn(' Notes:');
|
25241 | writeLn('');
|
25242 | writeLn(' `encodedJson` can also be piped into stdin. `encodedJson` contains ' +
|
25243 | 'an array of collection ids.');
|
25244 | writeLn('');
|
25245 | writeLn(' Examples:');
|
25246 | writeLn('');
|
25247 | writeLn(' bw share 4af958ce-96a7-45d9-beed-1e70fabaa27a 6d82949b-b44d-468a-adae-3f3bacb0ea32 ' +
|
25248 | 'WyI5NzQwNTNkMC0zYjMzLTRiOTgtODg2ZS1mZWNmNWM4ZGJhOTYiXQ==');
|
25249 | writeLn(' echo \'["974053d0-3b33-4b98-886e-fecf5c8dba96"]\' | bw encode | ' +
|
25250 | 'bw share 4af958ce-96a7-45d9-beed-1e70fabaa27a 6d82949b-b44d-468a-adae-3f3bacb0ea32');
|
25251 | writeLn('', true);
|
25252 | })
|
25253 | .action((id, organizationId, encodedJson, cmd) => program_awaiter(this, void 0, void 0, function* () {
|
25254 | yield this.exitIfLocked();
|
25255 | const command = new share_command_ShareCommand(this.main.cipherService);
|
25256 | const response = yield command.run(id, organizationId, encodedJson, cmd);
|
25257 | this.processResponse(response);
|
25258 | }));
|
25259 | external_commander_["command"]('confirm <object> <id>')
|
25260 | .option('--organizationid <organizationid>', 'Organization id for an organization object.')
|
25261 | .description('Confirm an object to the organization.')
|
25262 | .on('--help', () => {
|
25263 | writeLn('\n Objects:');
|
25264 | writeLn('');
|
25265 | writeLn(' org-member');
|
25266 | writeLn('');
|
25267 | writeLn(' Id:');
|
25268 | writeLn('');
|
25269 | writeLn(' Object\'s globally unique `id`.');
|
25270 | writeLn('');
|
25271 | writeLn(' Examples:');
|
25272 | writeLn('');
|
25273 | writeLn(' bw confirm org-member 7063feab-4b10-472e-b64c-785e2b870b92 ' +
|
25274 | '--organizationid 310d5ffd-e9a2-4451-af87-ea054dce0f78');
|
25275 | writeLn('', true);
|
25276 | })
|
25277 | .action((object, id, cmd) => program_awaiter(this, void 0, void 0, function* () {
|
25278 | yield this.exitIfLocked();
|
25279 | const command = new confirm_command_ConfirmCommand(this.main.apiService, this.main.cryptoService);
|
25280 | const response = yield command.run(object, id, cmd);
|
25281 | this.processResponse(response);
|
25282 | }));
|
25283 | external_commander_["command"]('import [format] [input]')
|
25284 | .description('Import vault data from a file.')
|
25285 | .option('--formats', 'List formats')
|
25286 | .on('--help', () => {
|
25287 | writeLn('\n Examples:');
|
25288 | writeLn('');
|
25289 | writeLn(' bw import --formats');
|
25290 | writeLn(' bw import bitwardencsv ./from/source.csv');
|
25291 | writeLn(' bw import keepass2xml keepass_backup.xml');
|
25292 | })
|
25293 | .action((format, filepath, cmd) => program_awaiter(this, void 0, void 0, function* () {
|
25294 | yield this.exitIfLocked();
|
25295 | const command = new import_command_ImportCommand(this.main.importService);
|
25296 | const response = yield command.run(format, filepath, cmd);
|
25297 | this.processResponse(response);
|
25298 | }));
|
25299 | external_commander_["command"]('export [password]')
|
25300 | .description('Export vault data to a CSV or JSON file.')
|
25301 | .option('--output <output>', 'Output directory or filename.')
|
25302 | .option('--format <format>', 'Export file format.')
|
25303 | .option('--organizationid <organizationid>', 'Organization id for an organization.')
|
25304 | .on('--help', () => {
|
25305 | writeLn('\n Notes:');
|
25306 | writeLn('');
|
25307 | writeLn(' Valid formats are `csv` and `json`. Default format is `csv`.');
|
25308 | writeLn('');
|
25309 | writeLn(' Examples:');
|
25310 | writeLn('');
|
25311 | writeLn(' bw export');
|
25312 | writeLn(' bw export myPassword321');
|
25313 | writeLn(' bw export myPassword321 --format json');
|
25314 | writeLn(' bw export --output ./exp/bw.csv');
|
25315 | writeLn(' bw export myPassword321 --output bw.json --format json');
|
25316 | writeLn(' bw export myPassword321 --organizationid 7063feab-4b10-472e-b64c-785e2b870b92');
|
25317 | writeLn('', true);
|
25318 | })
|
25319 | .action((password, cmd) => program_awaiter(this, void 0, void 0, function* () {
|
25320 | yield this.exitIfLocked();
|
25321 | const command = new export_command_ExportCommand(this.main.cryptoService, this.main.exportService);
|
25322 | const response = yield command.run(password, cmd);
|
25323 | this.processResponse(response);
|
25324 | }));
|
25325 | external_commander_["command"]('generate')
|
25326 | .description('Generate a password/passphrase.')
|
25327 | .option('-u, --uppercase', 'Include uppercase characters.')
|
25328 | .option('-l, --lowercase', 'Include lowercase characters.')
|
25329 | .option('-n, --number', 'Include numeric characters.')
|
25330 | .option('-s, --special', 'Include special characters.')
|
25331 | .option('-p, --passphrase', 'Generate a passphrase.')
|
25332 | .option('--length <length>', 'Length of the password.')
|
25333 | .option('--words <words>', 'Number of words.')
|
25334 | .option('--separator <separator>', 'Word separator.')
|
25335 | .on('--help', () => {
|
25336 | writeLn('\n Notes:');
|
25337 | writeLn('');
|
25338 | writeLn(' Default options are `-uln --length 14`.');
|
25339 | writeLn('');
|
25340 | writeLn(' Minimum `length` is 5.');
|
25341 | writeLn('');
|
25342 | writeLn(' Minimum `words` is 3.');
|
25343 | writeLn('');
|
25344 | writeLn(' Examples:');
|
25345 | writeLn('');
|
25346 | writeLn(' bw generate');
|
25347 | writeLn(' bw generate -u -l --length 18');
|
25348 | writeLn(' bw generate -ulns --length 25');
|
25349 | writeLn(' bw generate -ul');
|
25350 | writeLn(' bw generate -p --separator _');
|
25351 | writeLn(' bw generate -p --words 5 --separator space');
|
25352 | writeLn('', true);
|
25353 | })
|
25354 | .action((cmd) => program_awaiter(this, void 0, void 0, function* () {
|
25355 | const command = new generate_command_GenerateCommand(this.main.passwordGenerationService);
|
25356 | const response = yield command.run(cmd);
|
25357 | this.processResponse(response);
|
25358 | }));
|
25359 | external_commander_["command"]('encode')
|
25360 | .description('Base 64 encode stdin.')
|
25361 | .on('--help', () => {
|
25362 | writeLn('\n Notes:');
|
25363 | writeLn('');
|
25364 | writeLn(' Use to create `encodedJson` for `create` and `edit` commands.');
|
25365 | writeLn('');
|
25366 | writeLn(' Examples:');
|
25367 | writeLn('');
|
25368 | writeLn(' echo \'{"name":"My Folder"}\' | bw encode');
|
25369 | writeLn('', true);
|
25370 | })
|
25371 | .action((object, id, cmd) => program_awaiter(this, void 0, void 0, function* () {
|
25372 | const command = new encode_command_EncodeCommand();
|
25373 | const response = yield command.run(cmd);
|
25374 | this.processResponse(response);
|
25375 | }));
|
25376 | external_commander_["command"]('config <setting> [value]')
|
25377 | .description('Configure CLI settings.')
|
25378 | .option('--web-vault <url>', 'Provides a custom web vault URL that differs from the base URL.')
|
25379 | .option('--api <url>', 'Provides a custom API URL that differs from the base URL.')
|
25380 | .option('--identity <url>', 'Provides a custom identity URL that differs from the base URL.')
|
25381 | .option('--icons <url>', 'Provides a custom icons service URL that differs from the base URL.')
|
25382 | .option('--notifications <url>', 'Provides a custom notifications URL that differs from the base URL.')
|
25383 | .option('--events <url>', 'Provides a custom events URL that differs from the base URL.')
|
25384 | .on('--help', () => {
|
25385 | writeLn('\n Settings:');
|
25386 | writeLn('');
|
25387 | writeLn(' server - On-premises hosted installation URL.');
|
25388 | writeLn('');
|
25389 | writeLn(' Examples:');
|
25390 | writeLn('');
|
25391 | writeLn(' bw config server');
|
25392 | writeLn(' bw config server https://bw.company.com');
|
25393 | writeLn(' bw config server bitwarden.com');
|
25394 | writeLn(' bw config server --api http://localhost:4000 --identity http://localhost:33656');
|
25395 | writeLn('', true);
|
25396 | })
|
25397 | .action((setting, value, cmd) => program_awaiter(this, void 0, void 0, function* () {
|
25398 | const command = new config_command_ConfigCommand(this.main.environmentService);
|
25399 | const response = yield command.run(setting, value, cmd);
|
25400 | this.processResponse(response);
|
25401 | }));
|
25402 | external_commander_["command"]('update')
|
25403 | .description('Check for updates.')
|
25404 | .on('--help', () => {
|
25405 | writeLn('\n Notes:');
|
25406 | writeLn('');
|
25407 | writeLn(' Returns the URL to download the newest version of this CLI tool.');
|
25408 | writeLn('');
|
25409 | writeLn(' Use the `--raw` option to return only the download URL for the update.');
|
25410 | writeLn('');
|
25411 | writeLn(' Examples:');
|
25412 | writeLn('');
|
25413 | writeLn(' bw update');
|
25414 | writeLn(' bw update --raw');
|
25415 | writeLn('', true);
|
25416 | })
|
25417 | .action((cmd) => program_awaiter(this, void 0, void 0, function* () {
|
25418 | const command = new update_command_UpdateCommand(this.main.platformUtilsService, this.main.i18nService, 'cli', 'bw', true);
|
25419 | const response = yield command.run(cmd);
|
25420 | this.processResponse(response);
|
25421 | }));
|
25422 | external_commander_["command"]('completion')
|
25423 | .description('Generate shell completions.')
|
25424 | .option('--shell <shell>', 'Shell to generate completions for.')
|
25425 | .on('--help', () => {
|
25426 | writeLn('\n Notes:');
|
25427 | writeLn('');
|
25428 | writeLn(' Valid shells are `zsh`.');
|
25429 | writeLn('');
|
25430 | writeLn(' Examples:');
|
25431 | writeLn('');
|
25432 | writeLn(' bw completion --shell zsh');
|
25433 | writeLn('', true);
|
25434 | })
|
25435 | .action((cmd) => program_awaiter(this, void 0, void 0, function* () {
|
25436 | const command = new completion_command_CompletionCommand();
|
25437 | const response = yield command.run(cmd);
|
25438 | this.processResponse(response);
|
25439 | }));
|
25440 | external_commander_["parse"](process.argv);
|
25441 | if (process.argv.slice(2).length === 0) {
|
25442 | external_commander_["outputHelp"]();
|
25443 | }
|
25444 | }
|
25445 | processResponse(response, exitImmediately = false) {
|
25446 | super.processResponse(response, exitImmediately, () => {
|
25447 | if (response.data.object === 'template') {
|
25448 | return this.getJson(response.data.template);
|
25449 | }
|
25450 | return null;
|
25451 | });
|
25452 | }
|
25453 | exitIfLocked() {
|
25454 | return program_awaiter(this, void 0, void 0, function* () {
|
25455 | yield this.exitIfNotAuthed();
|
25456 | const hasKey = yield this.main.cryptoService.hasKey();
|
25457 | if (!hasKey) {
|
25458 | const canInteract = process.env.BW_NOINTERACTION !== 'true';
|
25459 | if (canInteract) {
|
25460 | const command = new unlock_command_UnlockCommand(this.main.cryptoService, this.main.userService, this.main.cryptoFunctionService);
|
25461 | const response = yield command.run(null, null);
|
25462 | if (!response.success) {
|
25463 | this.processResponse(response, true);
|
25464 | }
|
25465 | }
|
25466 | else {
|
25467 | this.processResponse(Response.error('Vault is locked.'), true);
|
25468 | }
|
25469 | }
|
25470 | });
|
25471 | }
|
25472 | }
|
25473 |
|
25474 |
|
25475 | __webpack_require__.d(__webpack_exports__, "Main", function() { return bw_Main; });
|
25476 | var bw_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
25477 | return new (P || (P = Promise))(function (resolve, reject) {
|
25478 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
25479 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
25480 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
25481 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
25482 | });
|
25483 | };
|
25484 |
|
25485 |
|
25486 |
|
25487 |
|
25488 |
|
25489 |
|
25490 |
|
25491 |
|
25492 |
|
25493 |
|
25494 |
|
25495 |
|
25496 |
|
25497 |
|
25498 |
|
25499 |
|
25500 |
|
25501 |
|
25502 |
|
25503 |
|
25504 |
|
25505 |
|
25506 |
|
25507 |
|
25508 |
|
25509 |
|
25510 |
|
25511 |
|
25512 |
|
25513 |
|
25514 |
|
25515 |
|
25516 |
|
25517 | global.DOMParser = new external_jsdom_["JSDOM"]().window.DOMParser;
|
25518 |
|
25519 | const packageJson = __webpack_require__(20);
|
25520 | class bw_Main {
|
25521 | constructor() {
|
25522 | let p = null;
|
25523 | const relativeDataDir = external_path_["join"](external_path_["dirname"](process.execPath), 'bw-data');
|
25524 | if (external_fs_["existsSync"](relativeDataDir)) {
|
25525 | p = relativeDataDir;
|
25526 | }
|
25527 | else if (process.env.BITWARDENCLI_APPDATA_DIR) {
|
25528 | p = external_path_["resolve"](process.env.BITWARDENCLI_APPDATA_DIR);
|
25529 | }
|
25530 | else if (process.platform === 'darwin') {
|
25531 | p = external_path_["join"](process.env.HOME, 'Library/Application Support/Bitwarden CLI');
|
25532 | }
|
25533 | else if (process.platform === 'win32') {
|
25534 | p = external_path_["join"](process.env.APPDATA, 'Bitwarden CLI');
|
25535 | }
|
25536 | else if (process.env.XDG_CONFIG_HOME) {
|
25537 | p = external_path_["join"](process.env.XDG_CONFIG_HOME, 'Bitwarden CLI');
|
25538 | }
|
25539 | else {
|
25540 | p = external_path_["join"](process.env.HOME, '.config/Bitwarden CLI');
|
25541 | }
|
25542 | this.i18nService = new services_i18n_service_I18nService('en', './locales');
|
25543 | this.platformUtilsService = new cliPlatformUtils_service_CliPlatformUtilsService('cli', packageJson);
|
25544 | this.cryptoFunctionService = new nodeCryptoFunction_service_NodeCryptoFunctionService();
|
25545 | this.storageService = new lowdbStorage_service_LowdbStorageService(null, p, true);
|
25546 | this.secureStorageService = new nodeEnvSecureStorage_service_NodeEnvSecureStorageService(this.storageService, () => this.cryptoService);
|
25547 | this.cryptoService = new crypto_service_CryptoService(this.storageService, this.secureStorageService, this.cryptoFunctionService);
|
25548 | this.appIdService = new appId_service_AppIdService(this.storageService);
|
25549 | this.tokenService = new token_service_TokenService(this.storageService);
|
25550 | this.messagingService = new NoopMessagingService();
|
25551 | this.apiService = new nodeApi_service_NodeApiService(this.tokenService, this.platformUtilsService, (expired) => bw_awaiter(this, void 0, void 0, function* () { return yield this.logout(); }), 'Bitwarden_CLI/' + this.platformUtilsService.getApplicationVersion() +
|
25552 | ' (' + this.platformUtilsService.getDeviceString().toUpperCase() + ')');
|
25553 | this.environmentService = new environment_service_EnvironmentService(this.apiService, this.storageService, null);
|
25554 | this.userService = new user_service_UserService(this.tokenService, this.storageService);
|
25555 | this.containerService = new ContainerService(this.cryptoService);
|
25556 | this.settingsService = new SettingsService(this.userService, this.storageService);
|
25557 | this.cipherService = new cipher_service_CipherService(this.cryptoService, this.userService, this.settingsService, this.apiService, this.storageService, this.i18nService, null);
|
25558 | this.folderService = new folder_service_FolderService(this.cryptoService, this.userService, this.apiService, this.storageService, this.i18nService, this.cipherService);
|
25559 | this.collectionService = new collection_service_CollectionService(this.cryptoService, this.userService, this.storageService, this.i18nService);
|
25560 | this.searchService = new search_service_SearchService(this.cipherService, this.platformUtilsService);
|
25561 | this.policyService = new policy_service_PolicyService(this.userService, this.storageService);
|
25562 | this.vaultTimeoutService = new vaultTimeout_service_VaultTimeoutService(this.cipherService, this.folderService, this.collectionService, this.cryptoService, this.platformUtilsService, this.storageService, this.messagingService, this.searchService, this.userService, this.tokenService, null, null);
|
25563 | this.syncService = new sync_service_SyncService(this.userService, this.apiService, this.settingsService, this.folderService, this.cipherService, this.cryptoService, this.collectionService, this.storageService, this.messagingService, this.policyService, (expired) => bw_awaiter(this, void 0, void 0, function* () { return yield this.logout(); }));
|
25564 | this.passwordGenerationService = new passwordGeneration_service_PasswordGenerationService(this.cryptoService, this.storageService, this.policyService);
|
25565 | this.totpService = new totp_service_TotpService(this.storageService, this.cryptoFunctionService);
|
25566 | this.importService = new import_service_ImportService(this.cipherService, this.folderService, this.apiService, this.i18nService, this.collectionService);
|
25567 | this.exportService = new export_service_ExportService(this.folderService, this.cipherService, this.apiService);
|
25568 | this.authService = new auth_service_AuthService(this.cryptoService, this.apiService, this.userService, this.tokenService, this.appIdService, this.i18nService, this.platformUtilsService, this.messagingService, true);
|
25569 | this.auditService = new audit_service_AuditService(this.cryptoFunctionService, this.apiService);
|
25570 | this.program = new program_Program(this);
|
25571 | }
|
25572 | run() {
|
25573 | return bw_awaiter(this, void 0, void 0, function* () {
|
25574 | yield this.init();
|
25575 | this.program.run();
|
25576 | });
|
25577 | }
|
25578 | logout() {
|
25579 | return bw_awaiter(this, void 0, void 0, function* () {
|
25580 | const userId = yield this.userService.getUserId();
|
25581 | yield Promise.all([
|
25582 | this.syncService.setLastSync(new Date(0)),
|
25583 | this.tokenService.clearToken(),
|
25584 | this.cryptoService.clearKeys(),
|
25585 | this.userService.clear(),
|
25586 | this.settingsService.clear(userId),
|
25587 | this.cipherService.clear(userId),
|
25588 | this.folderService.clear(userId),
|
25589 | this.collectionService.clear(userId),
|
25590 | this.policyService.clear(userId),
|
25591 | this.passwordGenerationService.clear(),
|
25592 | ]);
|
25593 | process.env.BW_SESSION = null;
|
25594 | });
|
25595 | }
|
25596 | init() {
|
25597 | return bw_awaiter(this, void 0, void 0, function* () {
|
25598 | this.storageService.init();
|
25599 | this.containerService.attachToWindow(global);
|
25600 | yield this.environmentService.setUrlsFromStorage();
|
25601 |
|
25602 |
|
25603 |
|
25604 |
|
25605 |
|
25606 |
|
25607 | const locale = yield this.storageService.get(ConstantsService.localeKey);
|
25608 | yield this.i18nService.init(locale);
|
25609 | this.authService.init();
|
25610 | const installedVersion = yield this.storageService.get(ConstantsService.installedVersionKey);
|
25611 | const currentVersion = this.platformUtilsService.getApplicationVersion();
|
25612 | if (installedVersion == null || installedVersion !== currentVersion) {
|
25613 | yield this.storageService.save(ConstantsService.installedVersionKey, currentVersion);
|
25614 | }
|
25615 | });
|
25616 | }
|
25617 | }
|
25618 | const main = new bw_Main();
|
25619 | main.run();
|
25620 |
|
25621 |
|
25622 | })
|
25623 | ]);
|
25624 |
|
\ | No newline at end of file |