@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 +36 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +24 -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
|
|
|
@@ -1168,4 +1169,4 @@ declare class AzureProvider extends BaseOAuthProvider {
|
|
|
1168
1169
|
protected exchangeCodeForToken(code: string, tokenUrl: string): Promise<string>;
|
|
1169
1170
|
}
|
|
1170
1171
|
|
|
1171
|
-
export { ActivityLogger, type AuthAccount, type AuthActivity, AuthActivityAction, type AuthActivityActionType, type AuthConfig, type AuthConfirmation, type AuthContext, AuthError, type AuthManager$1 as AuthManager, type AuthProvider, type AuthRemember, type AuthReset, AuthRole, type AuthSession, AuthStatus, AzureProvider, type AzureProviderConfig, BaseOAuthProvider, ConfirmationExpiredError, ConfirmationNotFoundError, EmailNotVerifiedError, EmailTakenError, GitHubProvider, type GitHubProviderConfig, GoogleProvider, type GoogleProviderConfig, InvalidBackupCodeError, InvalidEmailError, InvalidPasswordError, InvalidTokenError, InvalidTwoFactorCodeError, type OAuthProvider, type OAuthProviderConfig, type OAuthUserData, OtpProvider, ResetDisabledError, ResetExpiredError, ResetNotFoundError, SecondFactorRequiredError, type TokenCallback, TooManyResetsError, TotpProvider, TwoFactorAlreadyEnabledError, type TwoFactorChallenge, TwoFactorExpiredError, TwoFactorManager, TwoFactorMechanism, type TwoFactorMethod, TwoFactorNotSetupError, TwoFactorSetupIncompleteError, type TwoFactorSetupResult, type TwoFactorToken, type UserIdentifier, UserInactiveError, UserNotFoundError, UserNotLoggedInError, addRoleToUser, authFunctions, cleanupExpiredTokens, createAuthContext, createAuthMiddleware, createAuthTables, dropAuthTables, getAuthTableStats, getUserRoles, isValidEmail, removeRoleFromUser, setUserRoles, validateEmail };
|
|
1172
|
+
export { ActivityLogger, type AuthAccount, type AuthActivity, AuthActivityAction, type AuthActivityActionType, type AuthConfig, type AuthConfirmation, type AuthContext, AuthError, type AuthManager$1 as AuthManager, type AuthProvider, type AuthRemember, type AuthReset, AuthRole, type AuthSession, AuthStatus, AzureProvider, type AzureProviderConfig, BaseOAuthProvider, ConfirmationExpiredError, ConfirmationNotFoundError, EmailNotVerifiedError, EmailTakenError, GitHubProvider, type GitHubProviderConfig, GoogleProvider, type GoogleProviderConfig, InvalidBackupCodeError, InvalidEmailError, InvalidPasswordError, InvalidTokenError, InvalidTwoFactorCodeError, type OAuthProvider, type OAuthProviderConfig, type OAuthUserData, OtpProvider, ResetDisabledError, ResetExpiredError, ResetNotFoundError, SecondFactorRequiredError, type TokenCallback, TooManyResetsError, TotpProvider, TwoFactorAlreadyEnabledError, type TwoFactorChallenge, TwoFactorExpiredError, TwoFactorManager, TwoFactorMechanism, type TwoFactorMethod, TwoFactorNotSetupError, TwoFactorSetupIncompleteError, type TwoFactorSetupResult, type TwoFactorToken, type UserIdentifier, UserInactiveError, UserNotFoundError, UserNotLoggedInError, addRoleForUserBy, addRoleToUser, authFunctions, changePasswordForUserBy, cleanupExpiredTokens, confirmResetPassword, createAuthContext, createAuthMiddleware, createAuthTables, createUser, deleteUserBy, dropAuthTables, forceLogoutForUserBy, getAuthTableStats, getUserRoles, hasRoleForUserBy, initiatePasswordResetForUserBy, isValidEmail, register, removeRoleForUserBy, removeRoleFromUser, resetPassword, setStatusForUserBy, setUserRoles, validateEmail };
|
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
|
|
|
@@ -1168,4 +1169,4 @@ declare class AzureProvider extends BaseOAuthProvider {
|
|
|
1168
1169
|
protected exchangeCodeForToken(code: string, tokenUrl: string): Promise<string>;
|
|
1169
1170
|
}
|
|
1170
1171
|
|
|
1171
|
-
export { ActivityLogger, type AuthAccount, type AuthActivity, AuthActivityAction, type AuthActivityActionType, type AuthConfig, type AuthConfirmation, type AuthContext, AuthError, type AuthManager$1 as AuthManager, type AuthProvider, type AuthRemember, type AuthReset, AuthRole, type AuthSession, AuthStatus, AzureProvider, type AzureProviderConfig, BaseOAuthProvider, ConfirmationExpiredError, ConfirmationNotFoundError, EmailNotVerifiedError, EmailTakenError, GitHubProvider, type GitHubProviderConfig, GoogleProvider, type GoogleProviderConfig, InvalidBackupCodeError, InvalidEmailError, InvalidPasswordError, InvalidTokenError, InvalidTwoFactorCodeError, type OAuthProvider, type OAuthProviderConfig, type OAuthUserData, OtpProvider, ResetDisabledError, ResetExpiredError, ResetNotFoundError, SecondFactorRequiredError, type TokenCallback, TooManyResetsError, TotpProvider, TwoFactorAlreadyEnabledError, type TwoFactorChallenge, TwoFactorExpiredError, TwoFactorManager, TwoFactorMechanism, type TwoFactorMethod, TwoFactorNotSetupError, TwoFactorSetupIncompleteError, type TwoFactorSetupResult, type TwoFactorToken, type UserIdentifier, UserInactiveError, UserNotFoundError, UserNotLoggedInError, addRoleToUser, authFunctions, cleanupExpiredTokens, createAuthContext, createAuthMiddleware, createAuthTables, dropAuthTables, getAuthTableStats, getUserRoles, isValidEmail, removeRoleFromUser, setUserRoles, validateEmail };
|
|
1172
|
+
export { ActivityLogger, type AuthAccount, type AuthActivity, AuthActivityAction, type AuthActivityActionType, type AuthConfig, type AuthConfirmation, type AuthContext, AuthError, type AuthManager$1 as AuthManager, type AuthProvider, type AuthRemember, type AuthReset, AuthRole, type AuthSession, AuthStatus, AzureProvider, type AzureProviderConfig, BaseOAuthProvider, ConfirmationExpiredError, ConfirmationNotFoundError, EmailNotVerifiedError, EmailTakenError, GitHubProvider, type GitHubProviderConfig, GoogleProvider, type GoogleProviderConfig, InvalidBackupCodeError, InvalidEmailError, InvalidPasswordError, InvalidTokenError, InvalidTwoFactorCodeError, type OAuthProvider, type OAuthProviderConfig, type OAuthUserData, OtpProvider, ResetDisabledError, ResetExpiredError, ResetNotFoundError, SecondFactorRequiredError, type TokenCallback, TooManyResetsError, TotpProvider, TwoFactorAlreadyEnabledError, type TwoFactorChallenge, TwoFactorExpiredError, TwoFactorManager, TwoFactorMechanism, type TwoFactorMethod, TwoFactorNotSetupError, TwoFactorSetupIncompleteError, type TwoFactorSetupResult, type TwoFactorToken, type UserIdentifier, UserInactiveError, UserNotFoundError, UserNotLoggedInError, addRoleForUserBy, addRoleToUser, authFunctions, changePasswordForUserBy, cleanupExpiredTokens, confirmResetPassword, createAuthContext, createAuthMiddleware, createAuthTables, createUser, deleteUserBy, dropAuthTables, forceLogoutForUserBy, getAuthTableStats, getUserRoles, hasRoleForUserBy, initiatePasswordResetForUserBy, isValidEmail, register, removeRoleForUserBy, removeRoleFromUser, resetPassword, setStatusForUserBy, setUserRoles, validateEmail };
|
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);
|
|
@@ -2658,17 +2670,29 @@ export {
|
|
|
2658
2670
|
UserInactiveError,
|
|
2659
2671
|
UserNotFoundError,
|
|
2660
2672
|
UserNotLoggedInError,
|
|
2673
|
+
addRoleForUserBy,
|
|
2661
2674
|
addRoleToUser,
|
|
2662
2675
|
auth_functions_exports as authFunctions,
|
|
2676
|
+
changePasswordForUserBy,
|
|
2663
2677
|
cleanupExpiredTokens,
|
|
2678
|
+
confirmResetPassword,
|
|
2664
2679
|
createAuthContext,
|
|
2665
2680
|
createAuthMiddleware,
|
|
2666
2681
|
createAuthTables,
|
|
2682
|
+
createUser,
|
|
2683
|
+
deleteUserBy,
|
|
2667
2684
|
dropAuthTables,
|
|
2685
|
+
forceLogoutForUserBy,
|
|
2668
2686
|
getAuthTableStats,
|
|
2669
2687
|
getUserRoles,
|
|
2688
|
+
hasRoleForUserBy,
|
|
2689
|
+
initiatePasswordResetForUserBy,
|
|
2670
2690
|
isValidEmail,
|
|
2691
|
+
register,
|
|
2692
|
+
removeRoleForUserBy,
|
|
2671
2693
|
removeRoleFromUser,
|
|
2694
|
+
resetPassword,
|
|
2695
|
+
setStatusForUserBy,
|
|
2672
2696
|
setUserRoles,
|
|
2673
2697
|
validateEmail
|
|
2674
2698
|
};
|