@eaccess/auth 0.1.6 → 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 +12 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -838,6 +838,7 @@ declare class TwoFactorManager implements TwoFactorManager$1 {
|
|
|
838
838
|
disable(mechanism: TwoFactorMechanism): Promise<void>;
|
|
839
839
|
generateNewBackupCodes(): Promise<string[]>;
|
|
840
840
|
getContact(mechanism: TwoFactorMechanism.EMAIL | TwoFactorMechanism.SMS): Promise<string | null>;
|
|
841
|
+
getTotpUri(): Promise<string | null>;
|
|
841
842
|
createChallenge(accountId: number): Promise<TwoFactorChallenge>;
|
|
842
843
|
}
|
|
843
844
|
|
package/dist/index.d.ts
CHANGED
|
@@ -838,6 +838,7 @@ declare class TwoFactorManager implements TwoFactorManager$1 {
|
|
|
838
838
|
disable(mechanism: TwoFactorMechanism): Promise<void>;
|
|
839
839
|
generateNewBackupCodes(): Promise<string[]>;
|
|
840
840
|
getContact(mechanism: TwoFactorMechanism.EMAIL | TwoFactorMechanism.SMS): Promise<string | null>;
|
|
841
|
+
getTotpUri(): Promise<string | null>;
|
|
841
842
|
createChallenge(accountId: number): Promise<TwoFactorChallenge>;
|
|
842
843
|
}
|
|
843
844
|
|
package/dist/index.js
CHANGED
|
@@ -1316,6 +1316,18 @@ var TwoFactorManager = class {
|
|
|
1316
1316
|
const method = await this.queries.findTwoFactorMethodByAccountAndMechanism(accountId, mechanism);
|
|
1317
1317
|
return method?.secret || null;
|
|
1318
1318
|
}
|
|
1319
|
+
async getTotpUri() {
|
|
1320
|
+
const accountId = this.getAccountId();
|
|
1321
|
+
const email = this.getEmail();
|
|
1322
|
+
if (!accountId || !email) {
|
|
1323
|
+
return null;
|
|
1324
|
+
}
|
|
1325
|
+
const method = await this.queries.findTwoFactorMethodByAccountAndMechanism(accountId, 1 /* TOTP */);
|
|
1326
|
+
if (!method?.secret) {
|
|
1327
|
+
return null;
|
|
1328
|
+
}
|
|
1329
|
+
return this.totpProvider.generateQRCode(email, method.secret);
|
|
1330
|
+
}
|
|
1319
1331
|
// challenge creation (used during login)
|
|
1320
1332
|
async createChallenge(accountId) {
|
|
1321
1333
|
const methods = await this.queries.findTwoFactorMethodsByAccountId(accountId);
|