keys

package
v1.40.5 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package keys handles API key retrieval and configuration during login.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncPollResult

type AsyncPollResult struct {
	IsAboutToSaveCreds bool
	TestModeAPIKey     string
	Account            *acct.Account
	Err                error
}

AsyncPollResult is the data returned from polling for keys

type Configurer

type Configurer interface {
	SaveLoginDetails(response *PollAPIKeyResponse) error
}

Configurer is an interface for saving login details

type KeyTransfer

type KeyTransfer interface {
	AsyncPollKey(ctx context.Context, pollURL string, interval time.Duration, maxAttempts int, ch chan AsyncPollResult)
}

KeyTransfer handles polling for API keys

type PollAPIKeyResponse

type PollAPIKeyResponse struct {
	Redeemed               bool   `json:"redeemed"`
	AccountID              string `json:"account_id"`
	AccountDisplayName     string `json:"account_display_name"`
	LiveModeAPIKey         string `json:"livemode_key_secret"`
	LiveModePublishableKey string `json:"livemode_key_publishable"`
	TestModeAPIKey         string `json:"testmode_key_secret"`
	TestModePublishableKey string `json:"testmode_key_publishable"`
}

PollAPIKeyResponse returns the data of the polling client login

func PollForKey

func PollForKey(ctx context.Context, pollURL string, interval time.Duration, maxAttempts int) (*PollAPIKeyResponse, *acct.Account, error)

PollForKey polls Stripe at the specified interval until either the API key is available or we've reached the max attempts.

type RAKConfigurer

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

RAKConfigurer saves login details into the filesystem after the user has gone through the login flow

func NewRAKConfigurer

func NewRAKConfigurer(cfg *config.Config, fs afero.Fs) *RAKConfigurer

NewRAKConfigurer returns a new RAKConfigurer

func (*RAKConfigurer) SaveLoginDetails

func (c *RAKConfigurer) SaveLoginDetails(response *PollAPIKeyResponse) error

SaveLoginDetails function sets config for this profile.

type RAKTransfer

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

RAKTransfer implements KeyTransfer to poll for RAKs

func NewRAKTransfer

func NewRAKTransfer(configurer Configurer) *RAKTransfer

NewRAKTransfer creates a new RAKTransfer object

func (*RAKTransfer) AsyncPollKey

func (rt *RAKTransfer) AsyncPollKey(ctx context.Context, pollURL string, interval time.Duration, maxAttempts int, ch chan AsyncPollResult)

AsyncPollKey polls for RAKs

Jump to

Keyboard shortcuts

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