Interface IChangeEmailTokenStore

Assembly: redb.Identity.Core.dll

N-4 (Session E, sub-step N4-7): server-side store for single-use
change-of-e-mail tokens. Direct mirror of
with two extra bindings —
the address the user wants to switch to (newEmail) and a snapshot of
the address at issue time (currentEmail) so the confirm step can detect a
race where the e-mail was modified through another path between request and confirm.

public interface IChangeEmailTokenStore

Methods

IssueAsync(long, string, string, string, TimeSpan, bool, CancellationToken)

Issues a new change-of-e-mail token. Generates a 32-byte CSPRNG secret

Task<ChangeEmailIssueResult> IssueAsync(long userId, string newEmail, string currentEmail, string callerConfirmUrl, TimeSpan ttl, bool invalidatePrevious, CancellationToken ct = default)

VerifyAndConsumeAsync(Guid, string, CancellationToken)

Verifies and atomically consumes a change-of-e-mail token keyed by jti.

Task<ChangeEmailVerifyResult> VerifyAndConsumeAsync(Guid jti, string token, CancellationToken ct = default)