schema

package
v0.0.0-...-1f1cd5d Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package schema contains service definition for Users service

Index

Constants

View Source
const ServiceID schema.ServiceID = "users"

ServiceID - ID for user service.

Variables

View Source
var (
	// ErrUnexpectedSignMethod - signing method not supported.
	ErrUnexpectedSignMethod = errors.New("unexpected signing method")
	// ErrInvalidPrivateKeySize - ed25519 private key size not matched.
	ErrInvalidPrivateKeySize = errors.New("private key size is invalid")
)

Functions

This section is empty.

Types

type Claims

type Claims struct {
	jwt.RegisteredClaims

	Username string `json:"username"`
	UserUUID string `json:"user_uuid"`
}

Claims - JWT payload contents.

type User

type User struct {
	UUID     string `json:"uuid"`
	Username string `json:"username"`
	Password string `json:"-"` // hex-encoded password, make sure it's not reaching JSON
	FullName string `json:"full_name"`
}

User holds user data.

type UserService

type UserService interface {
	GetUser(ctx context.Context, username string) (*User, error)
	SaveUser(ctx context.Context, user User) error
	GenerateUserToken(ctx context.Context, user User) (string, error)
}

UserService - service handling user-related functionality.

Jump to

Keyboard shortcuts

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