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.
type MockConfig ¶
type MockConfig struct {
Key *rsa.PrivateKey
}
MockConfig creates a mock signer with a static key for testing.
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.
Click to show internal directories.
Click to hide internal directories.