Documentation
¶
Index ¶
- type AuthService
- type PlaidKeyFetcher
- type Service
- func (s *Service) EmailValidation(email string) bool
- func (s *Service) GenerateCode() string
- func (s *Service) GetBearerToken(headers http.Header) (string, error)
- func (s *Service) HashPassword(password string) (string, error)
- func (s *Service) HashRefreshToken(token string) string
- func (s *Service) MakeJWT(cfg *config.Config, userID uuid.UUID) (string, error)
- func (s *Service) MakeRefreshToken(tokenStore TokenStore, userID uuid.UUID, delegation database.Delegation) (string, error)
- func (s *Service) ValidateJWT(cfg *config.Config, tokenString string) (uuid.UUID, error)
- func (s *Service) ValidatePasswordHash(hash, password string) error
- func (s *Service) VerifyPlaidJWT(p PlaidKeyFetcher, ctx context.Context, tokenString string) error
- type TokenStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthService ¶
type AuthService interface { EmailValidation(email string) bool ValidatePasswordHash(hash, password string) error HashPassword(password string) (string, error) GenerateCode() string GetBearerToken(headers http.Header) (string, error) MakeJWT(cfg *config.Config, userID uuid.UUID) (string, error) ValidateJWT(cfg *config.Config, tokenString string) (uuid.UUID, error) VerifyPlaidJWT(p PlaidKeyFetcher, ctx context.Context, tokenString string) error MakeRefreshToken(tokenStore TokenStore, userID uuid.UUID, delegation database.Delegation) (string, error) HashRefreshToken(token string) string }
Auth interface
type PlaidKeyFetcher ¶
type Service ¶
type Service struct{}
Struct that holds auth functions as methods
func (*Service) EmailValidation ¶
Validates that a given string represents a valid email address
func (*Service) GenerateCode ¶
Function generates a random 8 character string. Creates a new UUID, and returns the first 8 characters of the converted string
func (*Service) GetBearerToken ¶
Function gets bearer authorization token from incoming request header
func (*Service) HashPassword ¶
Function accepts a string password, and hashes it
func (*Service) HashRefreshToken ¶
Hash a refresh token using sha256
func (*Service) MakeRefreshToken ¶
func (s *Service) MakeRefreshToken(tokenStore TokenStore, userID uuid.UUID, delegation database.Delegation) (string, error)
Function creates a new token string, hashes the token, and creates a record of it in the database
func (*Service) ValidateJWT ¶
Validates a token input based off the secret string
func (*Service) ValidatePasswordHash ¶
Compares hashed password input against stored password hash
func (*Service) VerifyPlaidJWT ¶
Validates the JWT provided from Plaid webhooks
type TokenStore ¶
type TokenStore interface {
CreateToken(ctx context.Context, params database.CreateTokenParams) (database.RefreshToken, error)
}
Interface to access database.Queries in auth package