@gbozee/ultimate 0.0.2-136 → 0.0.2-138

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 CHANGED
@@ -51576,7 +51576,9 @@ class AppDatabase {
51576
51576
  password: encrypted
51577
51577
  }
51578
51578
  });
51579
+ return true;
51579
51580
  }
51581
+ return false;
51580
51582
  }
51581
51583
  async getUserCredentials() {
51582
51584
  const record = await this.getUserByEmail();
@@ -51646,6 +51648,31 @@ class AppDatabase {
51646
51648
  }
51647
51649
  return false;
51648
51650
  }
51651
+ async verifyAdminPassword(payload) {
51652
+ const { password } = payload;
51653
+ if (!this.email) {
51654
+ const instance = await this.pb.collection("_superusers").getOne(this.pb.authStore.record.id);
51655
+ if (instance) {
51656
+ const userPassword = decryptObject(instance.settings.password, instance.settings.salt);
51657
+ return userPassword === password;
51658
+ }
51659
+ }
51660
+ return false;
51661
+ }
51662
+ async setAdminPassword(payload) {
51663
+ const { password, salt } = payload;
51664
+ if (!this.email) {
51665
+ const encrypted = encryptObject(password, salt);
51666
+ await this.pb.collection("_superusers").update(this.pb.authStore.record.id, {
51667
+ settings: {
51668
+ password: encrypted,
51669
+ salt
51670
+ }
51671
+ });
51672
+ return true;
51673
+ }
51674
+ return false;
51675
+ }
51649
51676
  async addNewCredential(params) {
51650
51677
  const { password, payload } = params;
51651
51678
  let credentials = await this.getCredentials({ password });
package/dist/index.d.ts CHANGED
@@ -548,7 +548,7 @@ export declare class AppDatabase {
548
548
  });
549
549
  getUserByEmail(): Promise<import("pocketbase").RecordModel>;
550
550
  verifyUserPassword(password: string): Promise<boolean>;
551
- generateUserPassword(): Promise<void>;
551
+ generateUserPassword(): Promise<boolean>;
552
552
  getUserCredentials(): Promise<any>;
553
553
  getCredentials(payload: {
554
554
  password?: string;
@@ -560,6 +560,13 @@ export declare class AppDatabase {
560
560
  changeUserPassword(payload: {
561
561
  password: string;
562
562
  }): Promise<boolean>;
563
+ verifyAdminPassword(payload: {
564
+ password: string;
565
+ }): Promise<boolean>;
566
+ setAdminPassword(payload: {
567
+ password: string;
568
+ salt: string;
569
+ }): Promise<boolean>;
563
570
  addNewCredential(params: {
564
571
  password?: string;
565
572
  payload: {
package/dist/index.js CHANGED
@@ -51524,7 +51524,9 @@ class AppDatabase {
51524
51524
  password: encrypted
51525
51525
  }
51526
51526
  });
51527
+ return true;
51527
51528
  }
51529
+ return false;
51528
51530
  }
51529
51531
  async getUserCredentials() {
51530
51532
  const record = await this.getUserByEmail();
@@ -51594,6 +51596,31 @@ class AppDatabase {
51594
51596
  }
51595
51597
  return false;
51596
51598
  }
51599
+ async verifyAdminPassword(payload) {
51600
+ const { password } = payload;
51601
+ if (!this.email) {
51602
+ const instance = await this.pb.collection("_superusers").getOne(this.pb.authStore.record.id);
51603
+ if (instance) {
51604
+ const userPassword = decryptObject(instance.settings.password, instance.settings.salt);
51605
+ return userPassword === password;
51606
+ }
51607
+ }
51608
+ return false;
51609
+ }
51610
+ async setAdminPassword(payload) {
51611
+ const { password, salt } = payload;
51612
+ if (!this.email) {
51613
+ const encrypted = encryptObject(password, salt);
51614
+ await this.pb.collection("_superusers").update(this.pb.authStore.record.id, {
51615
+ settings: {
51616
+ password: encrypted,
51617
+ salt
51618
+ }
51619
+ });
51620
+ return true;
51621
+ }
51622
+ return false;
51623
+ }
51597
51624
  async addNewCredential(params) {
51598
51625
  const { password, payload } = params;
51599
51626
  let credentials = await this.getCredentials({ password });
@@ -58278,7 +58278,9 @@ class AppDatabase {
58278
58278
  password: encrypted
58279
58279
  }
58280
58280
  });
58281
+ return true;
58281
58282
  }
58283
+ return false;
58282
58284
  }
58283
58285
  async getUserCredentials() {
58284
58286
  const record2 = await this.getUserByEmail();
@@ -58348,6 +58350,31 @@ class AppDatabase {
58348
58350
  }
58349
58351
  return false;
58350
58352
  }
58353
+ async verifyAdminPassword(payload) {
58354
+ const { password } = payload;
58355
+ if (!this.email) {
58356
+ const instance = await this.pb.collection("_superusers").getOne(this.pb.authStore.record.id);
58357
+ if (instance) {
58358
+ const userPassword = decryptObject(instance.settings.password, instance.settings.salt);
58359
+ return userPassword === password;
58360
+ }
58361
+ }
58362
+ return false;
58363
+ }
58364
+ async setAdminPassword(payload) {
58365
+ const { password, salt } = payload;
58366
+ if (!this.email) {
58367
+ const encrypted = encryptObject(password, salt);
58368
+ await this.pb.collection("_superusers").update(this.pb.authStore.record.id, {
58369
+ settings: {
58370
+ password: encrypted,
58371
+ salt
58372
+ }
58373
+ });
58374
+ return true;
58375
+ }
58376
+ return false;
58377
+ }
58351
58378
  async addNewCredential(params) {
58352
58379
  const { password, payload } = params;
58353
58380
  let credentials = await this.getCredentials({ password });
@@ -58255,7 +58255,9 @@ class AppDatabase {
58255
58255
  password: encrypted
58256
58256
  }
58257
58257
  });
58258
+ return true;
58258
58259
  }
58260
+ return false;
58259
58261
  }
58260
58262
  async getUserCredentials() {
58261
58263
  const record2 = await this.getUserByEmail();
@@ -58325,6 +58327,31 @@ class AppDatabase {
58325
58327
  }
58326
58328
  return false;
58327
58329
  }
58330
+ async verifyAdminPassword(payload) {
58331
+ const { password } = payload;
58332
+ if (!this.email) {
58333
+ const instance = await this.pb.collection("_superusers").getOne(this.pb.authStore.record.id);
58334
+ if (instance) {
58335
+ const userPassword = decryptObject(instance.settings.password, instance.settings.salt);
58336
+ return userPassword === password;
58337
+ }
58338
+ }
58339
+ return false;
58340
+ }
58341
+ async setAdminPassword(payload) {
58342
+ const { password, salt } = payload;
58343
+ if (!this.email) {
58344
+ const encrypted = encryptObject(password, salt);
58345
+ await this.pb.collection("_superusers").update(this.pb.authStore.record.id, {
58346
+ settings: {
58347
+ password: encrypted,
58348
+ salt
58349
+ }
58350
+ });
58351
+ return true;
58352
+ }
58353
+ return false;
58354
+ }
58328
58355
  async addNewCredential(params) {
58329
58356
  const { password, payload } = params;
58330
58357
  let credentials = await this.getCredentials({ password });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gbozee/ultimate",
3
3
  "type": "module",
4
- "version": "0.0.2-136",
4
+ "version": "0.0.2-138",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",