@eaccess/auth 0.1.6 → 0.1.8

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
@@ -1404,6 +1404,18 @@ var TwoFactorManager = class {
1404
1404
  const method = await this.queries.findTwoFactorMethodByAccountAndMechanism(accountId, mechanism);
1405
1405
  return method?.secret || null;
1406
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
+ }
1407
1419
  // challenge creation (used during login)
1408
1420
  async createChallenge(accountId) {
1409
1421
  const methods = await this.queries.findTwoFactorMethodsByAccountId(accountId);