feat: rt sessions OTP email challenge (#11941)

# Which Problems Are Solved

Add OTP Email challenge needed for Create/Set session in the RT model.

# How the Problems Are Solved

Introduce `OTPEmailChallengeCommand` (validate/execute/events) for
session creation checks
Add unit tests

# Additional Changes
Remove unused fields from `session_challenge_otp_sms.go`

# Additional Context
- Related to https://github.com/zitadel/zitadel/issues/11035

---------

Co-authored-by: Marco A. <[email protected]>
This commit is contained in:
Gayathri Vijayan
2026-03-31 11:50:53 +00:00
committed by GitHub
co-authored by Marco A.
parent 9bab764796
commit 7c3d26b23b
11 changed files with 1607 additions and 102 deletions
+14 -9
View File
@@ -9,15 +9,16 @@ import (
)
var (
pool database.Pool
legacyEventstore eventstore.LegacyEventstore
sysConfig systemdefaults.SystemDefaults
passwordHasher *crypto.Hasher
idpEncryptionAlgo crypto.EncryptionAlgorithm
sessionTokenDecryptor SessionTokenDecryptor
mfaEncryptionAlgo crypto.EncryptionAlgorithm
otpSMSSecretGeneratorConfig *crypto.GeneratorConfig
webauthnConfig *webauthn.Config
pool database.Pool
legacyEventstore eventstore.LegacyEventstore
sysConfig systemdefaults.SystemDefaults
passwordHasher *crypto.Hasher
idpEncryptionAlgo crypto.EncryptionAlgorithm
sessionTokenDecryptor SessionTokenDecryptor
mfaEncryptionAlgo crypto.EncryptionAlgorithm
otpSMSSecretGeneratorConfig *crypto.GeneratorConfig
otpEmailSecretGeneratorConfig *crypto.GeneratorConfig
webauthnConfig *webauthn.Config
)
func SetPool(p database.Pool) {
@@ -48,6 +49,10 @@ func SetOTPSMSSecretGeneratorConfig(cfg *crypto.GeneratorConfig) {
otpSMSSecretGeneratorConfig = cfg
}
func SetOTPEmailSecretGeneratorConfig(cfg *crypto.GeneratorConfig) {
otpEmailSecretGeneratorConfig = cfg
}
func SetMFAEncryptionAlgorithm(mfaEncryptionAlg crypto.EncryptionAlgorithm) {
mfaEncryptionAlgo = mfaEncryptionAlg
}