Documentation
¶
Index ¶
- func ApplyOptions(config *Config, options []Option) error
- type Argon2Params
- type Config
- type KeyManagementService
- type MetricsCollector
- type ObservabilityHook
- type Option
- func WithArgon2Params(params *Argon2Params) Option
- func WithDBFilename(filename string) Option
- func WithDBPath(path string) Option
- func WithKEKAlias(alias string) Option
- func WithKMSService(kms KeyManagementService) Option
- func WithKeyMetadataDB(db *sql.DB) Option
- func WithKeyMetadataDBFilename(filename string) Option
- func WithKeyMetadataDBPath(path string) Option
- func WithMetricsCollector(collector MetricsCollector) Option
- func WithObservabilityHook(hook ObservabilityHook) Option
- func WithPepper(pepper []byte) Option
- func WithPepperSecretPath(secretPath string) Option
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyOptions ¶
ApplyOptions applies all configuration options to a config
Types ¶
type Argon2Params ¶
type Argon2Params struct {
Memory uint32
Iterations uint32
Parallelism uint8
SaltLength uint32
KeyLength uint32
}
Argon2Params holds parameters for Argon2 hashing (internal config version)
func (*Argon2Params) GetIterations ¶
func (a *Argon2Params) GetIterations() uint32
func (*Argon2Params) GetKeyLength ¶
func (a *Argon2Params) GetKeyLength() uint32
func (*Argon2Params) GetMemory ¶
func (a *Argon2Params) GetMemory() uint32
Interface methods for crypto package compatibility
func (*Argon2Params) GetParallelism ¶
func (a *Argon2Params) GetParallelism() uint8
func (*Argon2Params) GetSaltLength ¶
func (a *Argon2Params) GetSaltLength() uint32
func (*Argon2Params) Validate ¶
func (a *Argon2Params) Validate() error
Validate checks if the Argon2 parameters are within acceptable ranges
type Config ¶
type Config struct {
KMSService KeyManagementService
KEKAlias string
Pepper []byte
PepperSecretPath string
Argon2Params *Argon2Params
KeyMetadataDB *sql.DB
DBPath string
DBFilename string
MetricsCollector MetricsCollector
ObservabilityHook ObservabilityHook
}
Config holds the complete configuration for a Crypto instance
type KeyManagementService ¶
type KeyManagementService interface {
GetKeyID(ctx context.Context, alias string) (string, error)
CreateKey(ctx context.Context, description string) (string, error)
EncryptDEK(ctx context.Context, keyID string, plaintext []byte) ([]byte, error)
DecryptDEK(ctx context.Context, keyID string, ciphertext []byte) ([]byte, error)
}
KeyManagementService defines the interface for KMS operations
type MetricsCollector ¶
type MetricsCollector = monitoring.MetricsCollector
Type aliases for interfaces from monitoring package
type ObservabilityHook ¶
type ObservabilityHook = monitoring.ObservabilityHook
Type aliases for interfaces from monitoring package
type Option ¶
Option represents a configuration option for creating a Crypto instance
func WithArgon2Params ¶
func WithArgon2Params(params *Argon2Params) Option
WithArgon2Params sets the Argon2 hashing parameters
func WithDBFilename ¶
WithDBFilename sets the database filename
func WithKEKAlias ¶
WithKEKAlias sets the Key Encryption Key alias
func WithKMSService ¶
func WithKMSService(kms KeyManagementService) Option
WithKMSService sets the Key Management Service provider
func WithKeyMetadataDB ¶
WithKeyMetadataDB sets the database connection directly
func WithKeyMetadataDBFilename ¶
WithKeyMetadataDBFilename sets the filename for the key metadata database within the default directory
func WithKeyMetadataDBPath ¶
WithKeyMetadataDBPath sets the full path to the key metadata database
func WithMetricsCollector ¶
func WithMetricsCollector(collector MetricsCollector) Option
WithMetricsCollector sets the metrics collector
func WithObservabilityHook ¶
func WithObservabilityHook(hook ObservabilityHook) Option
WithObservabilityHook sets the observability hook
func WithPepper ¶
WithPepper sets the pepper directly as bytes
func WithPepperSecretPath ¶
WithPepperSecretPath sets the path to retrieve pepper from KMS
type Validator ¶
type Validator struct{}
Validator handles configuration validation
func NewValidator ¶
func NewValidator() *Validator
NewValidator creates a new configuration validator
func (*Validator) ValidateConfig ¶
ValidateConfig validates the complete configuration