@eaccess/auth 0.1.5 → 0.1.7

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
@@ -64,17 +64,29 @@ __export(index_exports, {
64
64
  UserInactiveError: () => UserInactiveError,
65
65
  UserNotFoundError: () => UserNotFoundError,
66
66
  UserNotLoggedInError: () => UserNotLoggedInError,
67
+ addRoleForUserBy: () => addRoleForUserBy,
67
68
  addRoleToUser: () => addRoleToUser,
68
69
  authFunctions: () => auth_functions_exports,
70
+ changePasswordForUserBy: () => changePasswordForUserBy,
69
71
  cleanupExpiredTokens: () => cleanupExpiredTokens,
72
+ confirmResetPassword: () => confirmResetPassword,
70
73
  createAuthContext: () => createAuthContext,
71
74
  createAuthMiddleware: () => createAuthMiddleware,
72
75
  createAuthTables: () => createAuthTables,
76
+ createUser: () => createUser,
77
+ deleteUserBy: () => deleteUserBy,
73
78
  dropAuthTables: () => dropAuthTables,
79
+ forceLogoutForUserBy: () => forceLogoutForUserBy,
74
80
  getAuthTableStats: () => getAuthTableStats,
75
81
  getUserRoles: () => getUserRoles,
82
+ hasRoleForUserBy: () => hasRoleForUserBy,
83
+ initiatePasswordResetForUserBy: () => initiatePasswordResetForUserBy,
76
84
  isValidEmail: () => isValidEmail,
85
+ register: () => register,
86
+ removeRoleForUserBy: () => removeRoleForUserBy,
77
87
  removeRoleFromUser: () => removeRoleFromUser,
88
+ resetPassword: () => resetPassword,
89
+ setStatusForUserBy: () => setStatusForUserBy,
78
90
  setUserRoles: () => setUserRoles,
79
91
  validateEmail: () => validateEmail
80
92
  });
@@ -1392,6 +1404,18 @@ var TwoFactorManager = class {
1392
1404
  const method = await this.queries.findTwoFactorMethodByAccountAndMechanism(accountId, mechanism);
1393
1405
  return method?.secret || null;
1394
1406
  }
1407
+ async getTotpUri() {
1408
+ const accountId = this.getAccountId();
1409
+ const email = this.getEmail();
1410
+ if (!accountId || !email) {
1411
+ return null;
1412
+ }
1413
+ const method = await this.queries.findTwoFactorMethodByAccountAndMechanism(accountId, 1 /* TOTP */);
1414
+ if (!method?.secret) {
1415
+ return null;
1416
+ }
1417
+ return this.totpProvider.generateQRCode(email, method.secret);
1418
+ }
1395
1419
  // challenge creation (used during login)
1396
1420
  async createChallenge(accountId) {
1397
1421
  const methods = await this.queries.findTwoFactorMethodsByAccountId(accountId);
@@ -2735,17 +2759,29 @@ async function getUserRoles(config, identifier) {
2735
2759
  UserInactiveError,
2736
2760
  UserNotFoundError,
2737
2761
  UserNotLoggedInError,
2762
+ addRoleForUserBy,
2738
2763
  addRoleToUser,
2739
2764
  authFunctions,
2765
+ changePasswordForUserBy,
2740
2766
  cleanupExpiredTokens,
2767
+ confirmResetPassword,
2741
2768
  createAuthContext,
2742
2769
  createAuthMiddleware,
2743
2770
  createAuthTables,
2771
+ createUser,
2772
+ deleteUserBy,
2744
2773
  dropAuthTables,
2774
+ forceLogoutForUserBy,
2745
2775
  getAuthTableStats,
2746
2776
  getUserRoles,
2777
+ hasRoleForUserBy,
2778
+ initiatePasswordResetForUserBy,
2747
2779
  isValidEmail,
2780
+ register,
2781
+ removeRoleForUserBy,
2748
2782
  removeRoleFromUser,
2783
+ resetPassword,
2784
+ setStatusForUserBy,
2749
2785
  setUserRoles,
2750
2786
  validateEmail
2751
2787
  });