sandbox

package
v1.42.1 Latest Latest
Warning

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

Go to latest
Published: May 28, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package sandbox provisions anonymous Stripe sandbox environments.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnsupportedAlgorithm = errors.New("unsupported algorithm: only SHA-256 is supported")
	ErrMaxIterationsReached = errors.New("proof-of-work exceeded maximum iterations")
)
View Source
var GitConfigFunc = defaultGitConfig

GitConfigFunc resolves git config values. Replaceable in tests.

Functions

func SolveChallenge

func SolveChallenge(ctx context.Context, algorithm, challenge, salt string) (int64, error)

SolveChallenge brute-forces the proof-of-work: finds n where SHA-256(salt + n) == challenge.

Types

type ChallengeResponse

type ChallengeResponse struct {
	Algorithm string `json:"algorithm"`
	Challenge string `json:"challenge"`
	Salt      string `json:"salt"`
	Signature string `json:"signature"`
}

type Client

type Client struct {
	BaseURL    string
	HTTPClient *http.Client
}

func NewClient

func NewClient(baseURL string) *Client

func (*Client) GetChallenge

func (c *Client) GetChallenge(ctx context.Context, email string) (*ChallengeResponse, error)

func (*Client) Provision

func (c *Client) Provision(ctx context.Context, req ProvisionRequest) (*ProvisionResponse, error)

type HTTPError

type HTTPError struct {
	StatusCode int
	Body       string
}

HTTPError is returned when the sandbox server responds with a non-200 status.

func (*HTTPError) Error

func (e *HTTPError) Error() string

type ProvisionRequest

type ProvisionRequest struct {
	Algorithm string `json:"algorithm"`
	Challenge string `json:"challenge"`
	Salt      string `json:"salt"`
	Signature string `json:"signature"`
	Number    int64  `json:"number"`
	Email     string `json:"email"`
	Name      string `json:"name,omitempty"`
}

type ProvisionResponse

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

ProvisionResponse wraps the server response loosely so field additions or type changes don't break the CLI.

func (*ProvisionResponse) GetAccountID

func (r *ProvisionResponse) GetAccountID() string

func (*ProvisionResponse) GetClaimURL

func (r *ProvisionResponse) GetClaimURL() string

func (*ProvisionResponse) GetExpiresAt

func (r *ProvisionResponse) GetExpiresAt() string

func (*ProvisionResponse) GetPublishableKey

func (r *ProvisionResponse) GetPublishableKey() string

func (*ProvisionResponse) GetSecretKey

func (r *ProvisionResponse) GetSecretKey() string

func (*ProvisionResponse) UnmarshalJSON

func (r *ProvisionResponse) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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