Skip to main content

countAttempt

@webda/core


Function: countAttempt()

countAttempt(ref, attrCount, attrTs, params?, currentSnapshot?): Promise<boolean>

Defined in: packages/core/src/utils/throttle.ts:20

Atomic attempt counting and lockout check generalised across stores and models

Parameters​

ref​

any

model reference (e.g. ident.ref(), user.ref())

attrCount​

string

attribute name tracking attempts (e.g. "_loginAttempts", "_mfaAttempts")

attrTs​

string

attribute name tracking last attempt timestamp (e.g. "_lastLoginAttemptAt", "_lastMfaAttemptAt")

params?​

ThrottleParameters = {}

throttle parameters

currentSnapshot?​

any

optional current in-memory record

Returns​

Promise<boolean>

true if this attempt is locked out