licensebootstrap

package
v2.935.2 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultServerURL = "https://app.speakeasy.com"

Variables

View Source
var ErrAccessTokenMissing = errors.New("the platform allowed generation but issued no token")
View Source
var ErrInsecureServerURL = errors.New("the Speakeasy server URL must use https (plain http is allowed for loopback addresses only)")
View Source
var ErrNoAPIKey = errors.New("no Speakeasy API key: set SPEAKEASY_API_KEY or run `speakeasy auth login`")
View Source
var ErrNotEntitled = errors.New("workspace has no commercial entitlement; no license token was issued")
View Source
var ErrUnauthorized = errors.New("the Speakeasy API key was rejected; run `speakeasy auth login` again")

Functions

func ReadEnvValue

func ReadEnvValue(path, key string) (string, error)

func ResolveAPIKey

func ResolveAPIKey(getenv func(string) string, homeDir string) (string, error)

func ResolveServerURL

func ResolveServerURL(flagValue string, getenv func(string) string) string

func SetEnvValue

func SetEnvValue(path, key, value string) error

func UnsetEnvValue

func UnsetEnvValue(path, key string) error

func WriteElection

func WriteElection(path, key, value string, unsetKeys ...string) error

Types

type AccessResponse

type AccessResponse struct {
	GenerationAllowed bool    `json:"generation_allowed"`
	Message           string  `json:"message"`
	Level             string  `json:"level"`
	LicenseJWT        *string `json:"license_jwt"`
}

func FetchAccessLicenseToken

func FetchAccessLicenseToken(ctx context.Context, client *http.Client, serverURL, apiKey, target string) (string, AccessResponse, error)

type ValidateResponse

type ValidateResponse struct {
	WorkspaceID   string  `json:"workspace_id"`
	WorkspaceSlug string  `json:"workspace_slug"`
	OrgSlug       string  `json:"org_slug"`
	AccountType   string  `json:"account_type_v2"`
	LicenseJWT    *string `json:"license_jwt"`
}

func FetchLicenseToken

func FetchLicenseToken(ctx context.Context, client *http.Client, serverURL, apiKey string) (string, ValidateResponse, error)

Jump to

Keyboard shortcuts

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