scopedkey

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAuthDisabled  = errors.New("goncho: key creation is disabled when auth is off")
	ErrAdminRequired = errors.New("goncho: scoped key creation requires admin credentials")
	ErrScopeRequired = errors.New("goncho: at least one of workspace_id, peer_id, or session_id is required")
	ErrSecretMissing = errors.New("goncho: jwt secret is required")
	ErrInvalid       = errors.New("goncho: invalid scoped key")
	ErrExpired       = errors.New("goncho: scoped key expired")
)

Functions

This section is empty.

Types

type Claims

type Claims struct {
	Timestamp   string `json:"t,omitempty"`
	ExpiresAt   string `json:"exp,omitempty"`
	Admin       *bool  `json:"ad,omitempty"`
	WorkspaceID string `json:"w,omitempty"`
	PeerID      string `json:"p,omitempty"`
	SessionID   string `json:"s,omitempty"`
}

func Verify

func Verify(token, secret string, now time.Time) (Claims, error)

type Params

type Params struct {
	WorkspaceID string
	PeerID      string
	SessionID   string
	ExpiresAt   time.Time
	AuthEnabled bool
	Admin       bool
	Secret      string
	Now         time.Time
}

type Result

type Result struct {
	Key    string `json:"key"`
	Claims Claims `json:"claims"`
}

func Create

func Create(params Params) (Result, error)

Jump to

Keyboard shortcuts

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