The last login module records every successful authentication event per user. You can show users when and how they last signed in on a security page, or use login history to detect unusual activity.Documentation Index
Fetch the complete documentation index at: https://docs.kavachos.com/llms.txt
Use this file to discover all available pages before exploring further.
Setup
createLastLoginModule is stateless and safe to call multiple times against the same database instance.
Recording a login
CallrecordLogin after any successful authentication:
maxHistoryPerUser (default: 10) are pruned automatically on every write.
Reading login data
Last login
null in data when no history exists for the user.
Full history
limit parameter overrides the module’s maxHistoryPerUser.
Supported methods
| Value | Description |
|---|---|
email-password | Email and password sign-in |
magic-link | Passwordless email link |
email-otp | One-time code via email |
passkey | WebAuthn / FIDO2 |
username-password | Username and password |
phone-sms | SMS one-time code |
siwe | Sign-in with Ethereum |
device-auth | OAuth 2.0 device flow |
anonymous | Anonymous session |
api-key | API key authentication |
oauth:{provider} | Any OAuth provider, e.g. oauth:github |
Result type
All methods returnResult<T>, either { success: true; data: T } or { success: false; error: KavachError }. No exceptions are thrown.
IP addresses are stored as-is. Normalise or hash them before passing if your privacy policy requires it.