Interface EmailVerificationTokenStore
- All Known Implementing Classes:
InMemoryEmailVerificationTokenStore
Persistent store for
EmailVerificationTokenRecords —
backs the planned email-verification workflow (V00.70 Phase 7).
Same lifecycle as
PasswordResetTokenStore: hash-only, single-use, consumed
records remain visible to findByHash(String) so callers
can distinguish "already consumed" from "never existed".
Implementations must be thread-safe.
-
Method Summary
Modifier and TypeMethodDescriptionintdeleteBySubject(TenantId tenant, SubjectId subjectId) Drops every token issued tosubjectIdwithintenant.findByHash(String tokenHash) Looks up a token record by its hash.booleanmarkConsumed(String tokenHash, Instant at) Marks the record fortokenHashconsumed.intpurgeExpired(Instant now) Drops every record whoseexpiresAtis at or beforenow.voidsave(EmailVerificationTokenRecord record) Persists or replaces the supplied token record (keyed onEmailVerificationTokenRecord.tokenHash()).
-
Method Details
-
findByHash
Looks up a token record by its hash.- Parameters:
tokenHash- token hash; must not benullor blank- Returns:
- the record, if present (consumed or otherwise)
-
save
Persists or replaces the supplied token record (keyed onEmailVerificationTokenRecord.tokenHash()).- Parameters:
record- record to persist; must not benull
-
markConsumed
Marks the record fortokenHashconsumed. No-op when already consumed.- Parameters:
tokenHash- token hash; must not benullor blankat- consumption instant; must not benull- Returns:
trueif a pending record was just marked consumed;falseotherwise
-
deleteBySubject
-
purgeExpired
Drops every record whoseexpiresAtis at or beforenow.- Parameters:
now- retention boundary; must not benull- Returns:
- number of records purged
-