model

package
v0.0.0-...-5b9be47 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidIssuerType   = errors.New("model: invalid issuer type")
	ErrInvalidIV3Key       = errors.New("model: issuer_v3: invalid key")
	ErrIssuerV3NoCryptoKey = errors.New("model: issuer_v3: no crypto signing key for period")
)

Functions

This section is empty.

Types

type Issuer

type Issuer struct {
	ID                   *uuid.UUID   `json:"id" db:"issuer_id"`
	IssuerType           string       `json:"issuer_type" db:"issuer_type"`
	IssuerCohort         int16        `json:"issuer_cohort" db:"issuer_cohort"`
	SigningKey           []byte       `db:"signing_key"`
	MaxTokens            int          `json:"max_tokens" db:"max_tokens"`
	CreatedAt            pq.NullTime  `json:"created_at" db:"created_at"`
	ExpiresAt            pq.NullTime  `json:"expires_at" db:"expires_at"`
	RotatedAt            pq.NullTime  `json:"rotated_at" db:"last_rotated_at"`
	Version              int          `json:"version" db:"version"`
	ValidFrom            *time.Time   `json:"valid_from" db:"valid_from"`
	Buffer               int          `json:"buffer" db:"buffer"`
	DaysOut              int          `json:"days_out" db:"days_out"`
	Overlap              int          `json:"overlap" db:"overlap"`
	Duration             *string      `json:"duration" db:"duration"`
	RedemptionRepository string       `json:"-" db:"redemption_repository"`
	Keys                 []IssuerKeys `json:"keys" db:"-"`
}

Issuer represents an issuer of tokens.

func (*Issuer) ExpiresAtTime

func (x *Issuer) ExpiresAtTime() time.Time

func (*Issuer) FindSigningKeys

func (x *Issuer) FindSigningKeys(now time.Time) ([]*crypto.SigningKey, error)

func (*Issuer) HasExpired

func (x *Issuer) HasExpired(now time.Time) bool

type IssuerKeys

type IssuerKeys struct {
	ID         *uuid.UUID `json:"id" db:"key_id"`
	SigningKey []byte     `json:"-" db:"signing_key"`
	PublicKey  *string    `json:"public_key" db:"public_key"`
	Cohort     int16      `json:"cohort" db:"cohort"`
	IssuerID   *uuid.UUID `json:"issuer_id" db:"issuer_id"`
	CreatedAt  *time.Time `json:"created_at" db:"created_at"`
	StartAt    *time.Time `json:"start_at" db:"start_at"`
	EndAt      *time.Time `json:"end_at" db:"end_at"`
}

IssuerKeys represents time-based keys.

func (*IssuerKeys) CryptoSigningKey

func (x *IssuerKeys) CryptoSigningKey() *crypto.SigningKey

Jump to

Keyboard shortcuts

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