2019-04-24 21:52:08 +00:00
package authentication
// Level is the type representing a level of authentication
type Level int
const (
2020-04-09 01:05:17 +00:00
// NotAuthenticated if the user is not authenticated yet
2019-04-24 21:52:08 +00:00
NotAuthenticated Level = iota
2020-04-09 01:05:17 +00:00
// OneFactor if the user has passed first factor only
2019-04-24 21:52:08 +00:00
OneFactor Level = iota
2020-04-09 01:05:17 +00:00
// TwoFactor if the user has passed two factors
2019-04-24 21:52:08 +00:00
TwoFactor Level = iota
)
const (
// TOTP Method using Time-Based One-Time Password applications like Google Authenticator
TOTP = "totp"
// U2F Method using U2F devices like Yubikeys
U2F = "u2f"
2020-04-09 01:05:17 +00:00
// Push Method using Duo application to receive push notifications
2019-12-07 11:18:22 +00:00
Push = "mobile_push"
2019-04-24 21:52:08 +00:00
)
2020-04-09 01:05:17 +00:00
// PossibleMethods is the set of all possible 2FA methods
2019-12-07 11:18:22 +00:00
var PossibleMethods = [ ] string { TOTP , U2F , Push }
2020-03-06 01:38:02 +00:00
const (
//Argon2id Hash Identifier
HashingAlgorithmArgon2id = "argon2id"
//SHA512 Hash Identifier
HashingAlgorithmSHA512 = "6"
)
// These are the default values from the upstream crypt module, we use them to for GetInt, and they need to be checked when updating github.com/simia-tech/crypt
const (
HashingDefaultArgon2idTime = 1
HashingDefaultArgon2idMemory = 32 * 1024
HashingDefaultArgon2idParallelism = 4
HashingDefaultArgon2idKeyLength = 32
HashingDefaultSHA512Iterations = 5000
)
2020-04-09 01:05:17 +00:00
// HashingPossibleSaltCharacters represents valid hashing runes
2020-03-06 01:38:02 +00:00
var HashingPossibleSaltCharacters = [ ] rune ( "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/" )