user

package
v0.0.0-...-2c276d8 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

SPDX-License-Identifier: Apache-2.0 Copyright © 2022 Roberto Hidalgo <nidito@un.rob.mx>

SPDX-License-Identifier: Apache-2.0 Copyright © 2022 Roberto Hidalgo <nidito@un.rob.mx>

SPDX-License-Identifier: Apache-2.0 Copyright © 2022 Roberto Hidalgo <nidito@un.rob.mx>

SPDX-License-Identifier: Apache-2.0 Copyright © 2022 Roberto Hidalgo <nidito@un.rob.mx>

SPDX-License-Identifier: Apache-2.0 Copyright © 2022 Roberto Hidalgo <nidito@un.rob.mx>

Index

Constants

This section is empty.

Variables

View Source
var DefaultTTL = TTL{/* contains filtered or unexported fields */}

Functions

This section is empty.

Types

type Credential

type Credential struct {
	UserID int    `db:"user"`
	Data   string `db:"data"`
	// contains filtered or unexported fields
}

func (*Credential) AsWebAuthn

func (c *Credential) AsWebAuthn() webauthn.Credential

func (*Credential) Store

func (c *Credential) Store(sess db.Session) db.Store

type Schedule

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

func (*Schedule) AllowedAt

func (sch *Schedule) AllowedAt(t time.Time) bool

func (Schedule) MarshalDB

func (d Schedule) MarshalDB() (any, error)

func (Schedule) MarshalJSON

func (d Schedule) MarshalJSON() ([]byte, error)

func (*Schedule) Parse

func (d *Schedule) Parse() error

func (*Schedule) Scan

func (d *Schedule) Scan(value any) error

func (*Schedule) UnmarshalJSON

func (d *Schedule) UnmarshalJSON(value []byte) error

type Subscription

type Subscription struct {
	UserID int  `db:"user"`
	Data   *WPS `db:"data"`
}

func (*Subscription) AsWebPush

func (s *Subscription) AsWebPush() *webpush.Subscription

func (*Subscription) ID

func (s *Subscription) ID() string

func (*Subscription) Store

func (s *Subscription) Store(sess db.Session) db.Store

type TTL

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

func (*TTL) FromNow

func (ttl *TTL) FromNow() time.Time

func (*TTL) MarshalDB

func (ttl *TTL) MarshalDB() (any, error)

func (*TTL) MarshalJSON

func (ttl *TTL) MarshalJSON() ([]byte, error)

func (*TTL) Parse

func (ttl *TTL) Parse() (err error)

func (*TTL) Scan

func (ttl *TTL) Scan(value any) error

func (*TTL) Seconds

func (ttl *TTL) Seconds() int

func (*TTL) UnmarshalJSON

func (ttl *TTL) UnmarshalJSON(value []byte) error

type UTCTime

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

func (*UTCTime) Before

func (t *UTCTime) Before(other time.Time) bool

func (*UTCTime) MarshalDB

func (t *UTCTime) MarshalDB() (any, error)

func (*UTCTime) MarshalJSON

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

func (*UTCTime) Parse

func (t *UTCTime) Parse() (err error)

func (*UTCTime) Scan

func (t *UTCTime) Scan(value any) error

func (*UTCTime) UnmarshalJSON

func (t *UTCTime) UnmarshalJSON(value []byte) error

type User

type User struct {
	ID         int       `db:"id,omitempty" json:"-"`
	Expires    *UTCTime  `db:"expires,omitempty" json:"expires,omitempty"`
	Greeting   string    `db:"greeting" json:"greeting"`
	Handle     string    `db:"handle" json:"handle"`
	IsAdmin    bool      `db:"is_admin" json:"is_admin"`
	Name       string    `db:"name" json:"name"`
	Password   string    `db:"password" json:"password"`
	Require2FA bool      `db:"second_factor" json:"second_factor"`
	Schedule   *Schedule `db:"schedule,omitempty" json:"schedule,omitempty"`
	TTL        *TTL      `db:"max_ttl,omitempty" json:"max_ttl,omitempty"`
	IsNotified bool      `db:"receives_notifications" json:"receives_notifications"`
	// contains filtered or unexported fields
}

func FromContext

func FromContext(req *http.Request) *User

func (*User) DeleteCredentials

func (u *User) DeleteCredentials(sess db.Session) error

func (*User) Expired

func (user *User) Expired() bool

func (*User) FetchCredentials

func (u *User) FetchCredentials(sess db.Session) error

func (*User) HasCredentials

func (user *User) HasCredentials() bool

func (*User) IsAllowed

func (user *User) IsAllowed(t time.Time) error

func (*User) Login

func (user *User) Login(password string) error

func (*User) MarshalJSON

func (u *User) MarshalJSON() ([]byte, error)

func (*User) Store

func (u *User) Store(sess db.Session) db.Store

func (*User) UnmarshalJSON

func (o *User) UnmarshalJSON(b []byte) error

func (*User) WebAuthnCredentials

func (u *User) WebAuthnCredentials() []webauthn.Credential

Credentials owned by the user

func (*User) WebAuthnDisplayName

func (u *User) WebAuthnDisplayName() string

Display Name of the user

func (*User) WebAuthnID

func (u *User) WebAuthnID() []byte

func (*User) WebAuthnIcon

func (u *User) WebAuthnIcon() string

User's icon url

func (*User) WebAuthnName

func (u *User) WebAuthnName() string

User Name according to the Relying Party

type WPS

type WPS struct {
	*webpush.Subscription
}

func (WPS) MarshalDB

func (w WPS) MarshalDB() (any, error)

func (WPS) MarshalJSON

func (w WPS) MarshalJSON() ([]byte, error)

func (*WPS) Scan

func (w *WPS) Scan(value any) error

func (*WPS) UnmarshalJSON

func (w *WPS) UnmarshalJSON(value []byte) error

Jump to

Keyboard shortcuts

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