tokenutil

package
v1.23.9 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAuthenticationFailed = errors.New("token authentication failed")

ErrAuthenticationFailed is returned when token authentication fails

View Source
var ErrTokenUnclaimed = errors.New("token is unclaimed")

ErrTokenUnclaimed is returned when trying to use an unclaimed token

Functions

func GenerateToken

func GenerateToken() (string, string, string, error)

GenerateToken creates a new token with a randomly generated RSA key pair The token ID is prefixed with "T" and contains random bytes Returns the token ID, base64 encoded public key, and base64 encoded private key

func ParsePrivateKey

func ParsePrivateKey(privateKeyBase64 string) (*rsa.PrivateKey, error)

ParsePrivateKey decodes a base64-encoded private key string into an RSA private key

Types

type TokenRequest

type TokenRequest struct {
	Token     string `json:"token"`
	PublicKey string `json:"public_key"`
	UserID    int    `json:"user_id"`
}

TokenRequest represents a token request to the Connect API

type TokenResponse

type TokenResponse struct {
	TokenClaimURL string `json:"token_claim_url"`
}

TokenResponse represents the response from the Connect API for a token request

Jump to

Keyboard shortcuts

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