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 ¶
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
Click to show internal directories.
Click to hide internal directories.