2021-01-04 14:52:13 +01:00
|
|
|
package domain
|
2020-12-11 15:49:19 +01:00
|
|
|
|
|
|
|
type SecondFactorType int32
|
|
|
|
|
|
|
|
const (
|
|
|
|
SecondFactorTypeUnspecified SecondFactorType = iota
|
2023-07-28 07:39:30 +02:00
|
|
|
SecondFactorTypeTOTP
|
2020-12-11 15:49:19 +01:00
|
|
|
SecondFactorTypeU2F
|
2023-07-28 07:39:30 +02:00
|
|
|
SecondFactorTypeOTPEmail
|
|
|
|
SecondFactorTypeOTPSMS
|
2021-03-19 11:12:56 +01:00
|
|
|
|
|
|
|
secondFactorCount
|
2020-12-11 15:49:19 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
type MultiFactorType int32
|
|
|
|
|
|
|
|
const (
|
|
|
|
MultiFactorTypeUnspecified MultiFactorType = iota
|
|
|
|
MultiFactorTypeU2FWithPIN
|
2021-03-19 11:12:56 +01:00
|
|
|
|
|
|
|
multiFactorCount
|
2020-12-11 15:49:19 +01:00
|
|
|
)
|
2021-01-07 16:06:45 +01:00
|
|
|
|
|
|
|
type FactorState int32
|
|
|
|
|
|
|
|
const (
|
|
|
|
FactorStateUnspecified FactorState = iota
|
|
|
|
FactorStateActive
|
|
|
|
FactorStateRemoved
|
|
|
|
|
|
|
|
factorStateCount
|
|
|
|
)
|
|
|
|
|
2021-03-19 11:12:56 +01:00
|
|
|
func (f SecondFactorType) Valid() bool {
|
|
|
|
return f > 0 && f < secondFactorCount
|
|
|
|
}
|
|
|
|
|
|
|
|
func (f MultiFactorType) Valid() bool {
|
|
|
|
return f > 0 && f < multiFactorCount
|
|
|
|
}
|
|
|
|
|
2021-01-07 16:06:45 +01:00
|
|
|
func (f FactorState) Valid() bool {
|
|
|
|
return f >= 0 && f < factorStateCount
|
|
|
|
}
|