Help us shape the future of Go! Take the 2026 Go Developer Survey

testing

package
v1.23.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package testing makes the keys and proofs that tests of DPoP need.

A proof is assembled here by hand rather than through utils_go's token encoder, so that a test can write what no conforming client would: an "alg" of "none", a "jwk" naming a key other than the one that signed, an "iat" an hour old. The defaults are what a conforming client sends.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Jwk

func Jwk(publicKey *ecdsa.PublicKey) map[string]any

Jwk is the public key as a proof's "jwk" header carries it.

func KeyThumbprint

func KeyThumbprint(publicKey *ecdsa.PublicKey) string

KeyThumbprint is the key's RFC 7638 thumbprint as utils_go computes it, which is a second implementation to hold the one under test to rather than a copy of it.

func MakeProof

func MakeProof(
	privateKey *ecdsa.PrivateKey,
	method string,
	targetUri string,
	accessToken string,
	mutate func(header map[string]any, payload map[string]any),
) string

MakeProof makes a proof for a request: method and targetUri as "htm" and "htu", a fresh "jti", "iat" now, and "ath" when accessToken is not empty. mutate, when not nil, may change the header and payload before they are signed by privateKey.

func NewKey

func NewKey() *ecdsa.PrivateKey

NewKey makes a P-256 key, the kind a client holds in Android Keystore or a key manager.

Types

This section is empty.

Jump to

Keyboard shortcuts

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