Interface EmailVerificationTokenStore

All Known Implementing Classes:
InMemoryEmailVerificationTokenStore

@ExperimentalJSentinelApi public interface EmailVerificationTokenStore
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 Details

    • findByHash

      Looks up a token record by its hash.
      Parameters:
      tokenHash - token hash; must not be null or blank
      Returns:
      the record, if present (consumed or otherwise)
    • save

      void save(EmailVerificationTokenRecord record)
      Persists or replaces the supplied token record (keyed on EmailVerificationTokenRecord.tokenHash()).
      Parameters:
      record - record to persist; must not be null
    • markConsumed

      boolean markConsumed(String tokenHash, Instant at)
      Marks the record for tokenHash consumed. No-op when already consumed.
      Parameters:
      tokenHash - token hash; must not be null or blank
      at - consumption instant; must not be null
      Returns:
      true if a pending record was just marked consumed; false otherwise
    • deleteBySubject

      int deleteBySubject(TenantId tenant, SubjectId subjectId)
      Drops every token issued to subjectId within tenant.
      Parameters:
      tenant - tenant scope; must not be null
      subjectId - subject; must not be null
      Returns:
      number of records removed
    • purgeExpired

      int purgeExpired(Instant now)
      Drops every record whose expiresAt is at or before now.
      Parameters:
      now - retention boundary; must not be null
      Returns:
      number of records purged