Skip to content

Fix OTP snapshot validation and verification transitions - #24

Closed
Amir-Golmoradi wants to merge 1 commit into
mainfrom
amg-fix-otp-state-transitions
Closed

Amir-Golmoradi wants to merge 1 commit into
mainfrom
amg-fix-otp-state-transitions

Conversation

@Amir-Golmoradi

Copy link
Copy Markdown
Member

OTP state is now validated through OtpSnapshot during construction and restoration. Verification records failed, locking, and successful attempts as complete snapshot transitions, avoiding an invalid ACTIVE snapshot when the attempt limit is reached.

Supporting changes:

  • Move aggregate state into OtpSnapshot.
  • Extract rejection checks into OtpVerificationPolicy.
  • Update OTP to use snapshot-based transitions.

Validation:

  • Last wrong attempt locks the OTP.
  • Correct code on the last allowed attempt consumes the OTP.
  • Invalid restored snapshots are rejected.
  • Blank user IDs remain rejected.
  • Relevant tests and lint pass.

Introduce OtpSnapshot to validate OTP state during construction and restoration.
Record failed, locking, and successful attempts as complete snapshot transitions.
Refactor OTP to manage its state through snapshots.
@Amir-Golmoradi
Amir-Golmoradi marked this pull request as draft October 11, 2026 22:48
@Amir-Golmoradi
Amir-Golmoradi deleted the amg-fix-otp-state-transitions branch October 11, 2026 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant