forked from volatiletech/authboss
/
twofactor.go
50 lines (41 loc) · 1.03 KB
/
twofactor.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package twofactor
import "github.com/justin-wilxite/authboss/v3"
// Page constants
const (
PageRecovery2FA = "recovery2fa"
PageVerify2FA = "twofactor_verify"
PageVerifyEnd2FA = "twofactor_verify_end"
)
// Email constants
const (
EmailVerifyHTML = "twofactor_verify_email_html"
EmailVerifyTxt = "twofactor_verify_email_txt"
)
// Form value constants
const (
FormValueToken = "token"
)
// Data constants
const (
DataRecoveryCode = "recovery_code"
DataRecoveryCodes = "recovery_codes"
DataNumRecoveryCodes = "n_recovery_codes"
DataVerifyEmail = "email"
DataVerifyURL = "url"
)
const (
alphabet = "abcdefghijkmnopqrstuvwxyz0123456789"
recoveryCodeLength = 10
verifyEmailTokenSize = 16
)
// User interface
type User interface {
authboss.User
GetEmail() string
PutEmail(string)
// GetRecoveryCodes retrieves a CSV string of bcrypt'd recovery codes
GetRecoveryCodes() string
// PutRecoveryCodes uses a single string to store many
// bcrypt'd recovery codes
PutRecoveryCodes(codes string)
}