signer

package
v1.13.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LocalConfig

type LocalConfig struct {
	// KeysRotationPeriod defines the duration of time after which the signing keys will be rotated.
	KeysRotationPeriod string `json:"keysRotationPeriod"`
}

LocalConfig holds configuration for the local signer.

func (*LocalConfig) Open

func (c *LocalConfig) Open(_ context.Context, s storage.Storage, idTokenValidFor time.Duration, now func() time.Time, logger *slog.Logger) (Signer, error)

Open creates a new local signer.

type MockConfig

type MockConfig struct {
	Key *rsa.PrivateKey
}

MockConfig creates a mock signer with a static key for testing.

func (*MockConfig) Open

func (c *MockConfig) Open(_ context.Context) (Signer, error)

Open creates a new mock signer.

type Signer

type Signer interface {
	// Sign signs the provided payload.
	Sign(ctx context.Context, payload []byte) (string, error)
	// ValidationKeys returns the current public keys used for signature validation.
	ValidationKeys(ctx context.Context) ([]*jose.JSONWebKey, error)
	// Algorithm returns the signing algorithm used by this signer.
	Algorithm(ctx context.Context) (jose.SignatureAlgorithm, error)
	// Start starts any background tasks required by the signer (e.g., key rotation).
	Start(ctx context.Context)
}

Signer is an interface for signing payloads and retrieving validation keys.

func NewMockSigner

func NewMockSigner(key *rsa.PrivateKey) (Signer, error)

NewMockSigner creates a mock signer with the provided key for testing. If key is nil, a new one will be generated.

type VaultConfig

type VaultConfig struct {
	Addr    string `json:"addr"`
	Token   string `json:"token"`
	KeyName string `json:"keyName"`
}

VaultConfig holds configuration for the Vault signer.

func (*VaultConfig) Open

func (c *VaultConfig) Open(_ context.Context) (Signer, error)

Open creates a new Vault signer.

func (*VaultConfig) UnmarshalJSON

func (c *VaultConfig) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals a VaultConfig and applies environment variables. If Addr or Token are not provided in the config, they are read from VAULT_ADDR and VAULT_TOKEN environment variables respectively.

Jump to

Keyboard shortcuts

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