event

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

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

Go to latest
Published: Nov 11, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLoginAttempts

func GetLoginAttempts(userID, afterTime int64) (attempts int64, err error)

GetLoginAttempts for user

func InsertLoginAttempt

func InsertLoginAttempt(c *fiber.Ctx, userID int64, pk ...*key.Public) error

InsertLoginAttempt for user

Types

type Event

type Event struct {
	UserID  int64 `msg:"userId"`
	Type    Types `msg:"type"`
	Created int64 `msg:"created"`
	// Encrypted Info
	EncInfo string `msg:"encInfo"`
	// Encrypted Info Keys
	EncInfoKeys map[int64]string `msg:"encInfoKey"`
	// contains filtered or unexported fields
}

Event struct

func InsertNew

func InsertNew(c *fiber.Ctx, t Types, userID int64, pubKeys ...*key.Public) (*Event, error)

InsertNew Create and insert User Event

func New

func New(c *fiber.Ctx, t Types, userID int64, pubKeys ...*key.Public) (*Event, error)

New User Event

func (*Event) DecodeMsg

func (z *Event) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*Event) EncodeMsg

func (z *Event) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*Event) Insert

func (e *Event) Insert() error

Insert event and encrypted info into db

func (*Event) MarshalMsg

func (z *Event) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*Event) Msgsize

func (z *Event) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Event) UnmarshalMsg

func (z *Event) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Info

type Info struct {
	IP        string `msg:"ip"`
	UserAgent string `msg:"userAgent"`
}

Info struct for events

func (*Info) DecodeMsg

func (z *Info) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (Info) EncodeMsg

func (z Info) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (Info) MarshalMsg

func (z Info) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (Info) Msgsize

func (z Info) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Info) UnmarshalMsg

func (z *Info) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Types

type Types int8

Types for user events

const (
	// LoginAttempt Failed Login
	LoginAttempt Types = iota
	// Login Successful Login
	Login
	// Reset Password/Key Reset
	Reset
)

func (*Types) DecodeMsg

func (z *Types) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (Types) EncodeMsg

func (z Types) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (Types) MarshalMsg

func (z Types) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (Types) Msgsize

func (z Types) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Types) UnmarshalMsg

func (z *Types) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

Jump to

Keyboard shortcuts

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