@@ -14,9 +14,7 @@ type Token struct {
|
||||
Email string
|
||||
}
|
||||
|
||||
func NewAuthCode(clientId string, email string) (string, error) {
|
||||
ctx := context.Background()
|
||||
|
||||
func NewAuthCode(ctx context.Context, clientId string, email string) (string, error) {
|
||||
// generate random code
|
||||
b := make([]byte, 32)
|
||||
if _, err := rand.Read(b); err != nil {
|
||||
@@ -48,8 +46,7 @@ func NewAuthCode(clientId string, email string) (string, error) {
|
||||
return code, nil
|
||||
}
|
||||
|
||||
func VerifyAuthCode(code string) (*Token, bool) {
|
||||
ctx := context.Background()
|
||||
func VerifyAuthCode(ctx context.Context, code string) (*Token, bool) {
|
||||
key := "auth_code:" + code
|
||||
|
||||
// Read auth code payload
|
||||
|
||||
Reference in New Issue
Block a user