summaryrefslogtreecommitdiff
path: root/internal/authentication/const.go
diff options
context:
space:
mode:
authorClément Michaud <clement.michaud34@gmail.com>2020-05-03 06:06:09 +0200
committerGitHub <noreply@github.com>2020-05-03 14:06:09 +1000
commite5ccdb44491e05aaa8e4c86f9324a00640276bdf (patch)
tree8aec44b9e104f6024b3ab0adafeea559deca7be9 /internal/authentication/const.go
parentda5c722cf8ba9255f247ffa0ef38fb76934fac99 (diff)
[MISC] Introduce CryptAlgo type. (#960)
* [MISC] Introduce CryptAlgo type. It helps distinguish between the configuration representation of an algorithm and the crypt representation (6 and argon2id vs sha512 vs argon2id). * Add a description to CryptAlgo. * use const Co-authored-by: James Elliott <james-d-elliott@users.noreply.github.com>
Diffstat (limited to 'internal/authentication/const.go')
-rw-r--r--internal/authentication/const.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/internal/authentication/const.go b/internal/authentication/const.go
index 6133ddd3b..a939ab25f 100644
--- a/internal/authentication/const.go
+++ b/internal/authentication/const.go
@@ -24,11 +24,14 @@ const (
// PossibleMethods is the set of all possible 2FA methods.
var PossibleMethods = []string{TOTP, U2F, Push}
+// CryptAlgo the crypt representation of an algorithm used in the prefix of the hash.
+type CryptAlgo string
+
const (
// HashingAlgorithmArgon2id Argon2id hash identifier.
- HashingAlgorithmArgon2id = "argon2id"
+ HashingAlgorithmArgon2id CryptAlgo = "argon2id"
// HashingAlgorithmSHA512 SHA512 hash identifier.
- HashingAlgorithmSHA512 = "6"
+ HashingAlgorithmSHA512 CryptAlgo = "6"
)
// These are the default values from the upstream crypt module we use them to for GetInt