mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 21:27:42 +00:00
feat(v2): implement user register OTP (#6030)
* feat(v2): implement user register OTP * feat(v2): implement user verify OTP * session: retry on permission denied
This commit is contained in:
@@ -17,10 +17,17 @@ type OTP struct {
|
||||
State MFAState
|
||||
}
|
||||
|
||||
type OTPv2 struct {
|
||||
*ObjectDetails
|
||||
|
||||
Secret string
|
||||
URI string
|
||||
}
|
||||
|
||||
func NewOTPKey(issuer, accountName string, cryptoAlg crypto.EncryptionAlgorithm) (*otp.Key, *crypto.CryptoValue, error) {
|
||||
key, err := totp.Generate(totp.GenerateOpts{Issuer: issuer, AccountName: accountName})
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
return nil, nil, caos_errs.ThrowInternal(err, "TOTP-ieY3o", "Errors.Internal")
|
||||
}
|
||||
encryptedSecret, err := crypto.Encrypt([]byte(key.Secret()), cryptoAlg)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user