mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
21 lines
418 B
Go
21 lines
418 B
Go
|
package totp
|
||
|
|
||
|
import (
|
||
|
"github.com/pquerna/otp"
|
||
|
|
||
|
"github.com/authelia/authelia/v4/internal/configuration/schema"
|
||
|
)
|
||
|
|
||
|
func otpStringToAlgo(in string) (algorithm otp.Algorithm) {
|
||
|
switch in {
|
||
|
case schema.TOTPAlgorithmSHA1:
|
||
|
return otp.AlgorithmSHA1
|
||
|
case schema.TOTPAlgorithmSHA256:
|
||
|
return otp.AlgorithmSHA256
|
||
|
case schema.TOTPAlgorithmSHA512:
|
||
|
return otp.AlgorithmSHA512
|
||
|
default:
|
||
|
return otp.AlgorithmSHA1
|
||
|
}
|
||
|
}
|