console

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrWrongPassword = errors.New("wrong email or password")

Functions

func CheckPassword

func CheckPassword(hash, password string) error

func HashPassword

func HashPassword(password string) (string, error)

func NewSessionToken

func NewSessionToken() (cookie string, digest []byte, err error)

The cookie carries the token; the database stores only its digest, so a leaked table does not hand over live sessions.

func SessionDigest

func SessionDigest(cookie string) ([]byte, error)

Types

type Attempt

type Attempt struct {
	Round       int32
	Attempt     int32
	AttemptedAt time.Time
	Status      int32
	Error       string
	DurationMs  int32
	// SignedWith is what this attempt went out signed with, as it stood then.
	// After a rotation the destination's current secrets no longer answer it.
	SignedWith string
	// Forced says the event's signature had failed and somebody decided it
	// should go anyway.
	Forced bool
	// Answer is what the destination said back. A status code is usually the
	// whole of it and cannot be counted on to be.
	Answer          []byte
	AnswerType      string
	AnswerTruncated bool
}

type Delivery

type Delivery struct {
	ID            uuid.UUID
	Destination   string
	URL           string
	State         string
	Attempts      int32
	NextAttemptAt time.Time
	LastStatus    int32
	LastError     string
	DeliveredAt   time.Time
	ReplayCount   int32
	ReplayedAt    time.Time
	// Whether the destination is still routed for this event's provider and
	// enabled. A delivery that is not stays as history and is never resent.
	Routed bool
	Rounds []Round
}

type EventDetail

type EventDetail struct {
	ID         uuid.UUID
	Provider   string
	Path       string
	ReceivedAt time.Time
	BodySize   int32
	Signature  string
	Planned    bool
	Headers    map[string][]string
	Body       []byte
	// Overruled is the decision that had this delivered although it did not
	// verify, when there was one. The signature above still says what it said.
	Overruled *Overruled
}

type EventSummary

type EventSummary struct {
	ID         uuid.UUID
	Provider   string
	Path       string
	ReceivedAt time.Time
	BodySize   int32
	Signature  string
	Planned    bool
	Deliveries int64
	Delivered  int64
	Dead       int64
	Pending    int64
	// Deliveries left over from a destination that is no longer routed. Kept
	// out of the counts above so they reconcile with the routes page.
	Unrouted int64
	// The highest attempt count among the routed deliveries, so the list shows
	// what is struggling without opening it.
	Attempts int32
	// Forced says an operator overruled a failed signature to have this
	// delivered. The signature itself still says what it said.
	Forced bool
}

type Filter

type Filter struct {
	Provider  string
	State     string
	Signature string
	Search    string
	Since     time.Time
	Until     time.Time
	Page      int
	PageSize  int
}

func (Filter) Offset

func (f Filter) Offset() int

func (Filter) Size

func (f Filter) Size() int

type Mapping

type Mapping struct {
	Method string
	Claim  string
	Tenant string
	Role   string
}

Mapping is a claim an identity provider sends and where it lands.

type Membership

type Membership struct {
	Tenant uuid.UUID
	Slug   string
	Name   string
	Role   string
	// Since is when they joined. The oldest is where they started, which is
	// where they are put when they have not chosen.
	Since time.Time
}

Membership is somebody belonging to a tenant, as a role. A person can hold several, and sees one at a time.

type Operator

type Operator struct {
	ID          uuid.UUID
	Email       string
	Role        string
	Subject     string
	CreatedAt   time.Time
	SystemAdmin bool
}

Operator is someone who can sign in to the panel of one tenant.

func (Operator) SignsInWithSingleSignOn

func (o Operator) SignsInWithSingleSignOn() bool

SignsInWithSingleSignOn reports whether the account is linked to an identity provider, which is the difference between an operator created here and one that arrived from outside.

type Overruled

type Overruled struct {
	Reason    string
	DecidedBy string
	DecidedAt time.Time
}

Overruled is why something that failed verification was delivered anyway, and who said so.

type Placement

type Placement struct {
	Tenant uuid.UUID
	Role   string
}

Placement is a tenant and the role held in it. It is what a mapping says and what joining a tenant records.

type Round

type Round struct {
	Number   int32
	Attempts []Attempt
}

A run of attempts. Round zero is the original delivery; every replay opens the next one, and each keeps its own attempt numbering.

func (Round) Title

func (r Round) Title() string

type RouteRow

type RouteRow struct {
	ID            uuid.UUID
	Provider      string
	DestinationID uuid.UUID
	Destination   string
	Transport     string
	URL           string
	Enabled       bool
	Deliveries    int64
	Signing       []SigningSecret
}

type SigningSecret

type SigningSecret struct {
	Reference string
	Added     time.Time
	Checked   bool
	Readable  bool
	Detail    string
	CheckedAt time.Time
}

One secret a destination signs with: where it is kept, when it was added, and what the process that delivers last found when it tried to read it. Whether it is readable is never decided here, because the panel does not run where the signing happens.

type Tenant

type Tenant struct {
	ID        uuid.UUID
	Slug      string
	Name      string
	CreatedAt time.Time
}

Tenant is the boundary everything recorded belongs to.

type UnroutedProvider

type UnroutedProvider struct {
	Provider     string
	Events       int64
	LastReceived time.Time
}

A provider whose events have been recorded but that has no route at all, so nothing it sent has anywhere to go.

type UnsignedDestination

type UnsignedDestination struct {
	Name   string
	Routes int64
}

A destination that is delivered to and signs with nothing, which once signing exists is a finding rather than a default.

type User

type User struct {
	ID           uuid.UUID
	Email        string
	PasswordHash string
	Subject      string
	// SystemAdmin is not a role: a role is held inside a tenant, and the whole
	// point of this is not being confined to one.
	SystemAdmin bool
}

func (User) CanSignInWithPassword

func (u User) CanSignInWithPassword() bool

A user provisioned through single sign-on has no password, and must not be able to sign in with one.

type Verification

type Verification struct {
	Provider           string
	Verifier           string
	Scheme             string
	Algorithm          string
	Encoding           string
	Header             string
	SecretEnv          string
	SecretPresent      bool
	VerifyTokenEnv     string
	VerifyTokenPresent bool
	Refused            int64
}

Verification is a provider's signature settings as the panel shows them. No secret ever appears here: only the names of the variables that hold them.

Jump to

Keyboard shortcuts

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