Documentation
¶
Index ¶
- Constants
- Variables
- func AuthRequired(method string) bool
- func CheckPasswordHash(password, hashedPassword string) bool
- func ConvertToProtoChats(mongoChat models.Chat) *pb.ChatResponse
- func GenerateToken(username, userId string) (string, error)
- func HashPassword(password string) (string, error)
- func StreamInterceptor(srv any, ss grpc.ServerStream, info *grpc.StreamServerInfo, ...) error
- func UnaryInterceptor(ctx context.Context, req any, info *grpc.UnaryServerInfo, ...) (any, error)
- func ValidateToken(tokenString string) (string, string, error)
- type UserClaim
Constants ¶
View Source
const (
CLAIM_EXPIRY_MINS = 30
)
View Source
const (
USERNAME_HEADER = "username"
)
Variables ¶
View Source
var ( ErrMissingMetadata = status.Errorf(codes.InvalidArgument, "missing metadata") ErrInvalidToken = status.Errorf(codes.Unauthenticated, "invalid token") ErrTokenGeneration = status.Errorf(codes.Unauthenticated, "unable to generate token") ErrInvalidClaim = status.Errorf(codes.Unauthenticated, "invalid claim") ErrTokenNotFound = status.Errorf(codes.InvalidArgument, "token not found") )
Functions ¶
func AuthRequired ¶
func CheckPasswordHash ¶
func ConvertToProtoChats ¶
func ConvertToProtoChats(mongoChat models.Chat) *pb.ChatResponse
func GenerateToken ¶
func HashPassword ¶
func StreamInterceptor ¶
func StreamInterceptor(srv any, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error
func UnaryInterceptor ¶
func UnaryInterceptor(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (any, error)
Types ¶
Click to show internal directories.
Click to hide internal directories.