utils

package
v0.0.0-...-8e21e68 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Signup        = "Signup"
	Session       = "Session"
	ResetPassword = "ResetPassword"
)

const .

View Source
const (
	// MockSMTPPort .
	MockSMTPPort = 7777
)

Variables

This section is empty.

Functions

func DigitCode

func DigitCode(n int) string

DigitCode .

func DigitCodes

func DigitCodes(c, n int) []string

DigitCodes .

func NameFromEmail

func NameFromEmail(email string) string

NameFromEmail .

func NewLocalListener

func NewLocalListener(p int) (net.Listener, error)

NewLocalListener . reference - https://golang.org/src/net/smtp/smtp_test.go

Types

type Email

type Email struct {
	// contains filtered or unexported fields
}

Email sends an email.

func NewEmail

func NewEmail(name, from, to, subject, body string) *Email

NewEmail creates and returns a new Email object.

func (*Email) Send

func (m *Email) Send(addr string) error

Send 는 local postfix 로 email 을 보낸다.

type JWTParseError

type JWTParseError struct {
	Func         string
	SignedString string
	Err          error
}

JWTParseError .

func (*JWTParseError) Error

func (e *JWTParseError) Error() string

type MockHandler

type MockHandler interface {
	Handle() error
}

MockHandler .

type MockSMTPHandler

type MockSMTPHandler struct {
	Con     net.Conn
	Name    string
	From    string
	To      string
	Subject string
	Body    string
}

MockSMTPHandler .

func (*MockSMTPHandler) Handle

func (h *MockSMTPHandler) Handle() error

Handle . reference - https://golang.org/src/net/smtp/smtp_test.go

type ResetPasswordClaims

type ResetPasswordClaims struct {
	Email           string
	PasswordResetTs int
	jwt.StandardClaims
}

ResetPasswordClaims .

type SessionClaims

type SessionClaims struct {
	SessionUser
	jwt.StandardClaims
}

SessionClaims .

func ParseSessionJWT

func ParseSessionJWT(signedString, secretkey string) (*SessionClaims, error)

ParseSessionJWT .

type SessionUser

type SessionUser struct {
	UserID    uint
	UserEmail string
}

SessionUser .

type SignupClaims

type SignupClaims struct {
	Email string
	jwt.StandardClaims
}

SignupClaims .

func ParseSignupJWT

func ParseSignupJWT(signedString, secretkey string) (*SignupClaims, error)

ParseSignupJWT .

type Token

type Token struct {
	jwt.Token
	// contains filtered or unexported fields
}

Token .

func NewJWT

func NewJWT(expireAfterSec int) *Token

NewJWT .

func (*Token) ResetPassword

func (t *Token) ResetPassword(email string, passwordResetTs int, secretkey, issuer string) (string, error)

ResetPassword .

func (*Token) Session

func (t *Token) Session(userID uint, userEmail, secretkey, issuer string) (string, error)

Session .

func (*Token) Signup

func (t *Token) Signup(email, secretkey, issuer string) (string, error)

Signup .

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL