domain

package
v0.0.0-...-79c48be Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2022 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrValue             = errors.New("invalid argument")
	ErrExists            = errors.New("the key already exists")
	ErrKey               = errors.New("the key does not exist")
	ErrExpired           = errors.New("the key has expired")
	ErrSessionTerminated = errors.New("the session had been terminated")
)

Functions

func ReleaseSessionHttpToken

func ReleaseSessionHttpToken(t *SessionHttpToken)

Types

type Session

type Session struct {
	Id           int64
	UserId       int64
	Type         SessionType
	CreatedAt    time.Time
	ExpiresAt    time.Time
	TerminatedAt time.Time
	Http         SessionHttp
}

Session is a protocol agnostic user session. You must assume [Type] field to be valid if it matches the session type.

func (*Session) Reset

func (s *Session) Reset()

type SessionHttp

type SessionHttp struct {
	IpAddr    string
	UserAgent string
}

func (*SessionHttp) Reset

func (w *SessionHttp) Reset()

type SessionHttpToken

type SessionHttpToken struct {
	SessionId int64                `json:"sid"`
	User      SessionHttpTokenUser `json:"usr"`
	ExpiresAt int64                `json:"exp"`
	Ctx       actkn.Ctx            `json:"-"`
}

func AcquireSessionHttpToken

func AcquireSessionHttpToken() *SessionHttpToken

func (SessionHttpToken) MarshalEasyJSON

func (v SessionHttpToken) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (SessionHttpToken) MarshalJSON

func (v SessionHttpToken) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*SessionHttpToken) Reset

func (t *SessionHttpToken) Reset()

func (*SessionHttpToken) UnmarshalEasyJSON

func (v *SessionHttpToken) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*SessionHttpToken) UnmarshalJSON

func (v *SessionHttpToken) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type SessionHttpTokenUser

type SessionHttpTokenUser struct {
	Id    int64  `json:"id"`
	Email string `json:"email,nocopy"`
}

func (SessionHttpTokenUser) MarshalEasyJSON

func (v SessionHttpTokenUser) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (SessionHttpTokenUser) MarshalJSON

func (v SessionHttpTokenUser) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*SessionHttpTokenUser) Reset

func (u *SessionHttpTokenUser) Reset()

func (*SessionHttpTokenUser) UnmarshalEasyJSON

func (v *SessionHttpTokenUser) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*SessionHttpTokenUser) UnmarshalJSON

func (v *SessionHttpTokenUser) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type SessionType

type SessionType = int
const (
	SessionTypeUndef SessionType = iota
	SessionTypeHttp
)

type User

type User struct {
	Id             int64
	Email          string
	Surname        string
	GivenNames     string
	Phone164       uint64
	BornAt         time.Time
	HasProof       UserProof
	PasswordDigest []byte
	CreatedAt      time.Time
}

func (*User) Reset

func (u *User) Reset()

type UserProof

type UserProof = int
const (
	UserProofNone  UserProof = 0
	UserProofEmail UserProof = 1 << iota
	UserProofPhone
	UserProofBoris
)

Jump to

Keyboard shortcuts

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