ctstest

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT Imports: 17 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ctstest serves a fake CipherStash Token Service over TLS that signs tokens with a test key, for auth and manage tests.

Index

Constants

View Source
const (
	CRN       = "crn:ap-southeast-2.aws:GXT2N5F4X2SKVEJX"
	Workspace = "GXT2N5F4X2SKVEJX"
	AccessKey = "CSAKtest-id.test-secret"
	Host      = "ap-southeast-2.aws.cts.cipherstashmanaged.net"
	Issuer    = "https://" + Host + "/"
	Audience  = "ap-southeast-2.aws.viturhosted.net"
)

Variables

This section is empty.

Functions

func Claims

func Claims() map[string]any

Claims returns valid claims for a Control token with an hour's lifetime.

func Redirect

func Redirect(t *testing.T, server *httptest.Server, hosts ...string) http.RoundTripper

Redirect sends requests for hosts to server, keeping their Host header, and leaves other requests on server's TLS transport, which trusts only test certificates.

Types

type CTS

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

func New

func New(t *testing.T, authorize http.HandlerFunc) *CTS

New serves signing keys and validates access-key exchange requests before passing them to authorize. Requests without the expected User-Agent fail.

func (*CTS) Rotate

func (c *CTS) Rotate(t *testing.T)

Rotate replaces the signing key with a new key under a new key ID and publishes only the new key.

func (*CTS) Sign

func (c *CTS) Sign(t *testing.T, claims map[string]any) string

Sign returns a compact RS256 JWT signed with the key the fake publishes.

func (*CTS) SignWithUnpublishedKey

func (c *CTS) SignWithUnpublishedKey(t *testing.T, claims map[string]any) string

SignWithUnpublishedKey signs with a new key under the published key ID, for signature failures.

func (*CTS) Transport

func (c *CTS) Transport() http.RoundTripper

Transport routes requests for the real CTS host to the fake, keeping the public issuer in signed tokens.

type RoundTripFunc

type RoundTripFunc func(*http.Request) (*http.Response, error)

func (RoundTripFunc) RoundTrip

func (f RoundTripFunc) RoundTrip(req *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

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