player

package
v0.0.0-...-4144884 Latest Latest
Warning

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

Go to latest
Published: May 9, 2023 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth interface {
	SetPlayer(context.Context, *pb.Player) error
	CurrPlayer(context.Context) (*pb.Player, error)
}

type Authn

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

func NewAuth

func NewAuth(key []byte) *Authn

func (*Authn) CurrPlayer

func (a *Authn) CurrPlayer(ctx context.Context) (*pb.Player, error)

CurrPlayer returns the current player from an incoming metadata.MD. If the authorization has expired within refreshWindow of expiring, the authorization may be refreshed and updated (using grpc.SetHeader) on the passed in context.

func (*Authn) SetPlayer

func (a *Authn) SetPlayer(ctx context.Context, player *pb.Player) error

SetPlayer sets headers on ctx (using grpc.SetHeader) to save player as the currently logged in player in cookies.

type EntryService

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

func NewEntryService

func NewEntryService(auth Auth, store Storage) *EntryService

func (*EntryService) Current

func (e *EntryService) Current(ctx context.Context, _ *pb.Empty) (*pb.PlayerMessage, error)

func (*EntryService) Invite

func (e *EntryService) Invite(ctx context.Context, req *pb.PlayerMessage) (*pb.PlayerMessage, error)

func (*EntryService) Login

func (e *EntryService) Login(ctx context.Context, req *pb.LoginRequest) (*pb.PlayerMessage, error)

func (*EntryService) SignUp

type Storage

type Storage interface {
	RegisterPlayer(context.Context, *pb.PlayerPassword) (*pb.Player, error)
	Login(ctx context.Context, email string) (_ *pb.Player, passhash string, _ error)
}

Jump to

Keyboard shortcuts

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