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
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.