mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-13 11:34:26 +00:00
24 lines
618 B
Go
24 lines
618 B
Go
|
package command
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"time"
|
||
|
|
||
|
"github.com/caos/zitadel/internal/command/preparation"
|
||
|
"github.com/caos/zitadel/internal/crypto"
|
||
|
"github.com/caos/zitadel/internal/domain"
|
||
|
)
|
||
|
|
||
|
type Email struct {
|
||
|
Address string
|
||
|
Verified bool
|
||
|
}
|
||
|
|
||
|
func (e *Email) Valid() bool {
|
||
|
return e.Address != "" && domain.EmailRegex.MatchString(e.Address)
|
||
|
}
|
||
|
|
||
|
func newEmailCode(ctx context.Context, filter preparation.FilterToQueryReducer, alg crypto.EncryptionAlgorithm) (value *crypto.CryptoValue, expiry time.Duration, err error) {
|
||
|
return newCryptoCodeWithExpiry(ctx, filter, domain.SecretGeneratorTypeVerifyEmailCode, alg)
|
||
|
}
|