util

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateElevation

func GenerateElevation(ttl time.Duration, pl ElevationClaims, secret string) (string, error)

GenerateElevation signs a short-lived elevation token. ttl is typically 5 minutes; the matching cookie should expire at the same time.

Types

type ElevationClaims

type ElevationClaims struct {
	Email     string
	Host      string
	Role      string
	IssuedAt  time.Time
	ExpiresAt time.Time
}

ElevationClaims is the payload of an elevation token. Distinct from the session JWT (entity.TokenPayload) so a stolen session cookie can't be used as an elevation token.

Role is the per-host role the agent granted to this caller at /auth time. "user" by default; "admin" if the agent's MATRIX_ADMIN_USERS list includes the caller's email. The cloud uses it to gate per-app access (guest apps bypass entirely, user/admin apps require role >= required).

IssuedAt/ExpiresAt are populated by ValidateElevation. For GenerateElevation: a zero IssuedAt is replaced by now (fresh elevation); a non-zero IssuedAt is preserved (slide refresh) so the absolute lifetime cap stays anchored to the original password prompt.

func ValidateElevation

func ValidateElevation(token, secret string) (*ElevationClaims, error)

ValidateElevation parses and verifies an elevation JWT.

Jump to

Keyboard shortcuts

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