sandbox

package
v1.54.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package sandbox provisions anonymous Stripe sandbox environments.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnsupportedAlgorithm = errorcategory.New(errorcategory.UserInput, "unsupported algorithm: only SHA-256 is supported")
	ErrMaxIterationsReached = errorcategory.New(errorcategory.Internal, "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 CreateOptions added in v1.54.0

type CreateOptions struct {
	Name    string
	Blank   bool
	Country string
}

CreateOptions describes one authenticated sandbox creation request.

type CreatedSandbox added in v1.54.0

type CreatedSandbox struct {
	AccountID string
}

CreatedSandbox is the public identifier returned after creation.

type DeletedSandbox added in v1.54.0

type DeletedSandbox struct {
	AccountID string
	Name      string
}

DeletedSandbox is the public result returned after deletion is confirmed.

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 ManagedSandbox added in v1.54.0

type ManagedSandbox struct {
	WorkspaceID      string
	AccountID        string
	Name             string
	AccessLevel      SandboxAccessLevel
	IsLegacyTestmode bool
}

ManagedSandbox is the normalized representation shared by sandbox list and delete. WorkspaceID is retained for later targeting but must not be shown to users.

type ManagementClient added in v1.54.0

type ManagementClient struct {
	APIBaseURL string
	Profile    *config.Profile
}

ManagementClient discovers sandboxes authorized by the active live OAuth account.

func NewManagementClient added in v1.54.0

func NewManagementClient(apiBaseURL string, profile *config.Profile) *ManagementClient

NewManagementClient creates a sandbox management client using the supplied Stripe API base URL and CLI profile.

func (*ManagementClient) Create added in v1.54.0

Create creates a sandbox beneath the active live OAuth account.

func (*ManagementClient) Delete added in v1.54.0

func (c *ManagementClient) Delete(ctx context.Context, accountID string) (DeletedSandbox, error)

Delete closes a sandbox beneath the active live OAuth account.

func (*ManagementClient) ListAccessible added in v1.54.0

func (c *ManagementClient) ListAccessible(ctx context.Context) ([]ManagedSandbox, error)

ListAccessible resolves the active live OAuth workspace and returns the sandboxes accessible beneath it.

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

type SandboxAccessLevel added in v1.54.0

type SandboxAccessLevel int

SandboxAccessLevel describes the sandbox's default team access setting.

const (
	SandboxAccessLevelPrivate SandboxAccessLevel = iota + 1
	SandboxAccessLevelGlobal
	SandboxAccessLevelDeveloper
)

Jump to

Keyboard shortcuts

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