style(be):拆分模块目录

This commit is contained in:
teaser
2021-03-20 21:42:32 +08:00
committed by dushixiang
parent 86e8e25aac
commit c31b3c8359
36 changed files with 68 additions and 48 deletions

19
pkg/totp/totp.go Normal file
View File

@ -0,0 +1,19 @@
package totp
import (
otp_t "github.com/pquerna/otp"
totp_t "github.com/pquerna/otp/totp"
)
type GenerateOpts totp_t.GenerateOpts
func NewTOTP(opt GenerateOpts) (*otp_t.Key, error) {
return totp_t.Generate(totp_t.GenerateOpts(opt))
}
func Validate(code string, secret string) bool {
if secret == "" {
return true
}
return totp_t.Validate(code, secret)
}