internal

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

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

Go to latest
Published: Jan 1, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EmailKey   = ContextKey("account-email")
	TokenKey   = ContextKey("jwt-token-key")
	RoomKey    = ContextKey("conn-pool-key")
	UpgradeKey = ContextKey("upgrade-http-key")
)
View Source
const (
	Unknown = iota

	Create
	Delete

	Join
	Leave
	Message

	NoteOn
	NoteOff
)

Variables

View Source
var (
	ErrInvalidEmail   = errors.New("invalid email")
	ErrNotImplemented = errors.New("not implemented")
	ErrInvalidType    = errors.New("invalid type")
	ErrAlreadyExists  = errors.New("already exists")
	ErrNotFound       = errors.New("not found")
	ErrContextValue   = errors.New("failed to retrieve value from context")
)

Functions

This section is empty.

Types

type ContextKey

type ContextKey string

type MsgTyp

type MsgTyp int

func (*MsgTyp) MarshalJSON

func (t *MsgTyp) MarshalJSON() ([]byte, error)

func (*MsgTyp) String

func (t *MsgTyp) String() string

func (*MsgTyp) UnmarshalJSON

func (t *MsgTyp) UnmarshalJSON(b []byte) error

type RTokenClient

type RTokenClient interface {
	ValidateRefreshToken(ctx context.Context, token string) error
	ValidateClientID(ctx context.Context, cid string) error
}

type RepoCloser

type RepoCloser interface {
	Close()
}

type RepoReader

type RepoReader[Entry any] interface {
	// Returns an array of users subject to any filter
	// conditions that are required
	SelectMany(ctx context.Context) ([]Entry, error)
	// Returns a user form the database, the "key"
	// can be either the "id", "email" or "username"
	// as these are all given unique values
	Select(ctx context.Context, key any) (*Entry, error)
}

type RepoWriter

type RepoWriter[Entry any] interface {
	// Insert a new item to the database
	Insert(ctx context.Context, e *Entry) error
	// Performs a "hard" delete from database
	// Restricted to admin only
	Delete(ctx context.Context, key any) error
}

type TokenClient

type TokenClient interface {
	RTokenClient
	WTokenClient
}

type TokenReader

type TokenReader interface {
	ValidateRefreshToken(ctx context.Context, token string) error
	ValidateClientID(ctx context.Context, cid string) error
}

type TokenWriter

type TokenWriter interface {
	BlackListClientID(ctx context.Context, cid, email string) error
	BlackListRefreshToken(ctx context.Context, token string) error
}

type User

type User struct {
	ID       suid.UUID             `json:"id"`
	Username string                `json:"username"`
	Email    email.Email           `json:"email"`
	Password password.PasswordHash `json:"-"`
}

Custom user type required

type WTokenClient

type WTokenClient interface {
	BlackListClientID(ctx context.Context, cid, email string) error
	BlackListRefreshToken(ctx context.Context, token string) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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