summaryrefslogtreecommitdiff
path: root/internal/totp/helpers.go
blob: 1f56ed8322e99d98958af4d72b8aa1df1b260181 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package totp

import (
	"github.com/authelia/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
	}
}