wallaby-cash 2.0.1-rc.21 → 2.0.1-rc.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -593,7 +593,7 @@ var browser$1 = {
593
593
  uptime: uptime
594
594
  };
595
595
 
596
- if (browser$1.env.ENABLE_DEVELOPMENT_LOGGING) {
596
+ if (browser$1.env.ENABLE_DEVELOPMENT_LOGGING && browser$1.env.NODE_ENV !== 'production') {
597
597
  log__default.default.setLevel('trace');
598
598
  }
599
599
  else {
@@ -603,10 +603,10 @@ var logger = log__default.default;
603
603
 
604
604
  var _a;
605
605
  /**
606
- * The default environment will be set to NODE_ENV if environment is not set in config.
606
+ * The default environment will be set to 'development' if environment is not set in config.
607
607
  * For production builds, it is recommended to set NODE_ENV to 'production'.
608
608
  */
609
- var defaultEnvironment = (_a = browser$1.env.NODE_ENV) !== null && _a !== void 0 ? _a : 'production';
609
+ var defaultEnvironment = (_a = browser$1.env.NODE_ENV) !== null && _a !== void 0 ? _a : 'development';
610
610
  /**
611
611
  * The default network is set to 'testnet' for protection during development.
612
612
  * Please pass the network value in the WallabyConfigOptions object to override it for production-mainnet.
@@ -4451,6 +4451,46 @@ var StorageService = /** @class */ (function () {
4451
4451
  }
4452
4452
  throw new Error('removeItem function is not defined');
4453
4453
  };
4454
+ StorageService.prototype.checkPrivateKeyExists = function () {
4455
+ return __awaiter(this, void 0, void 0, function () {
4456
+ return __generator(this, function (_a) {
4457
+ switch (_a.label) {
4458
+ case 0: return [4 /*yield*/, this.fetch(exports.LocalStorageItems.EncryptedDevicePrivateKey)];
4459
+ case 1: return [2 /*return*/, !!(_a.sent())];
4460
+ }
4461
+ });
4462
+ });
4463
+ };
4464
+ StorageService.prototype.checkPrimaryKeyShareExists = function () {
4465
+ return __awaiter(this, void 0, void 0, function () {
4466
+ return __generator(this, function (_a) {
4467
+ switch (_a.label) {
4468
+ case 0: return [4 /*yield*/, this.fetch(exports.LocalStorageItems.PrimaryDeviceKeyShare)];
4469
+ case 1: return [2 /*return*/, !!(_a.sent())];
4470
+ }
4471
+ });
4472
+ });
4473
+ };
4474
+ StorageService.prototype.checkBackupKeyShareExists = function () {
4475
+ return __awaiter(this, void 0, void 0, function () {
4476
+ return __generator(this, function (_a) {
4477
+ switch (_a.label) {
4478
+ case 0: return [4 /*yield*/, this.fetch(exports.LocalStorageItems.BackupDeviceKeyShare)];
4479
+ case 1: return [2 /*return*/, !!(_a.sent())];
4480
+ }
4481
+ });
4482
+ });
4483
+ };
4484
+ StorageService.prototype.checkSeedPhraseExists = function () {
4485
+ return __awaiter(this, void 0, void 0, function () {
4486
+ return __generator(this, function (_a) {
4487
+ switch (_a.label) {
4488
+ case 0: return [4 /*yield*/, this.fetch(exports.LocalStorageItems.EncryptedStandardSeedPhrase)];
4489
+ case 1: return [2 /*return*/, !!(_a.sent())];
4490
+ }
4491
+ });
4492
+ });
4493
+ };
4454
4494
  /**
4455
4495
  *
4456
4496
  * Stores Wallaby auth public key to local storage
@@ -4547,7 +4587,6 @@ var StorageService = /** @class */ (function () {
4547
4587
  /**
4548
4588
  *
4549
4589
  * Fetches encrypted private key from local storage
4550
- * @param userId
4551
4590
  */
4552
4591
  StorageService.prototype.getEncryptedPrivateKey = function () {
4553
4592
  return __awaiter(this, void 0, void 0, function () {
@@ -7409,6 +7448,70 @@ var WalletService = /** @class */ (function (_super) {
7409
7448
  _this.userId = config.userId;
7410
7449
  return _this;
7411
7450
  }
7451
+ /**
7452
+ * @public
7453
+ * @returns {boolean} Returns true if the device has a seed phrase.
7454
+ */
7455
+ WalletService.prototype.hasSeedPhraseOnDevice = function () {
7456
+ return __awaiter(this, void 0, void 0, function () {
7457
+ return __generator(this, function (_a) {
7458
+ switch (_a.label) {
7459
+ case 0: return [4 /*yield*/, this.storageService.checkSeedPhraseExists()];
7460
+ case 1: return [2 /*return*/, _a.sent()];
7461
+ }
7462
+ });
7463
+ });
7464
+ };
7465
+ /**
7466
+ * @public
7467
+ * @returns {boolean} Returns true if the device has a primary key share.
7468
+ */
7469
+ WalletService.prototype.hasPrimaryKeyShareOnDevice = function () {
7470
+ return __awaiter(this, void 0, void 0, function () {
7471
+ return __generator(this, function (_a) {
7472
+ switch (_a.label) {
7473
+ case 0: return [4 /*yield*/, this.storageService.checkPrimaryKeyShareExists()];
7474
+ case 1: return [2 /*return*/, _a.sent()];
7475
+ }
7476
+ });
7477
+ });
7478
+ };
7479
+ /**
7480
+ * @public
7481
+ * @returns {boolean} Returns true if the device has a backup key share.
7482
+ */
7483
+ WalletService.prototype.hasBackupKeyShareOnDevice = function () {
7484
+ return __awaiter(this, void 0, void 0, function () {
7485
+ return __generator(this, function (_a) {
7486
+ switch (_a.label) {
7487
+ case 0: return [4 /*yield*/, this.storageService.checkBackupKeyShareExists()];
7488
+ case 1: return [2 /*return*/, _a.sent()];
7489
+ }
7490
+ });
7491
+ });
7492
+ };
7493
+ /**
7494
+ * @public
7495
+ * @returns {boolean} Returns true if the device has a wallet (either seed phrase or primary key share).
7496
+ */
7497
+ WalletService.prototype.hasWalletOnDevice = function () {
7498
+ return __awaiter(this, void 0, void 0, function () {
7499
+ var _a;
7500
+ return __generator(this, function (_b) {
7501
+ switch (_b.label) {
7502
+ case 0: return [4 /*yield*/, this.hasSeedPhraseOnDevice()];
7503
+ case 1:
7504
+ _a = (_b.sent());
7505
+ if (_a) return [3 /*break*/, 3];
7506
+ return [4 /*yield*/, this.hasPrimaryKeyShareOnDevice()];
7507
+ case 2:
7508
+ _a = (_b.sent());
7509
+ _b.label = 3;
7510
+ case 3: return [2 /*return*/, _a];
7511
+ }
7512
+ });
7513
+ });
7514
+ };
7412
7515
  /**
7413
7516
  *
7414
7517
  * @public