auth

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2023 License: Apache-2.0 Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithAPIKeyName

func WithAPIKeyName(apiKeyName, apiKeyPrivateKey string) apiKeyOption

WithAPIKeyName returns an option to set the API Key.

func WithLoadAPIKeyFromEnv

func WithLoadAPIKeyFromEnv(loadAPIKeyFromEnv bool) apiKeyOption

WithLoadAPIKeyFromEnv returns an option to set whether or not to load the API Key from environment variables. If the API Key name and private key are both set, they take precedence over the environment variables.

Types

type APIKey

type APIKey struct {
	Name       string
	PrivateKey string
}

APIKey represents a Coinbase Cloud API Key.

func NewAPIKey

func NewAPIKey(opts ...apiKeyOption) (*APIKey, error)

NewAPIKey creates a new Coinbase Cloud API Key based on the provided options.

type APIKeyClaims

type APIKeyClaims struct {
	*jwt.Claims
	URI string `json:"uri"`
}

APIKeyClaims holds public claim values for a JWT, as well as a URI.

type Authenticator

type Authenticator struct {
	// contains filtered or unexported fields
}

Authenticator builds a JWT based on the APIKey.

func NewAuthenticator

func NewAuthenticator(apiKey *APIKey) *Authenticator

NewAuthenticator returns a new Authenticator.

func (*Authenticator) BuildJWT

func (a *Authenticator) BuildJWT(service, uri string) (string, error)

BuildJWT constructs and returns the JWT as a string along with an error, if any.

Jump to

Keyboard shortcuts

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