Documentation
¶
Index ¶
- type KeyManager
- func (km *KeyManager) DeriveKey(password, salt []byte, iterations, keyLen int) []byte
- func (km *KeyManager) GenerateKey(id, description string, size int) (*KeyPair, error)
- func (km *KeyManager) GenerateSalt(size int) ([]byte, error)
- func (km *KeyManager) GetActiveKey(id string) (*KeyPair, bool)
- func (km *KeyManager) GetKeyInfo() map[string]map[string]interface{}
- func (km *KeyManager) RotateKey(id, description string, size int) error
- type KeyPair
- type SecurityMiddleware
- func (sm *SecurityMiddleware) AuthMiddleware(next http.HandlerFunc) http.HandlerFunc
- func (sm *SecurityMiddleware) CORSMiddleware(next http.HandlerFunc) http.HandlerFunc
- func (sm *SecurityMiddleware) CombinedMiddleware(next http.HandlerFunc) http.HandlerFunc
- func (sm *SecurityMiddleware) GenerateServiceToken(serviceName string, permissions []string, duration time.Duration) (string, error)
- func (sm *SecurityMiddleware) GetActiveKey(id string) (*KeyPair, bool)
- func (sm *SecurityMiddleware) GetKeyManager() *KeyManager
- func (sm *SecurityMiddleware) RateLimitMiddleware(next http.HandlerFunc) http.HandlerFunc
- func (sm *SecurityMiddleware) RotateKey(id, description string, size int) error
- func (sm *SecurityMiddleware) SecurityHeadersMiddleware(next http.HandlerFunc) http.HandlerFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KeyManager ¶
type KeyManager struct {
// contains filtered or unexported fields
}
KeyManager handles secure storage and rotation of cryptographic keys
func NewKeyManager ¶
func NewKeyManager() *KeyManager
NewKeyManager creates a new key manager instance
func (*KeyManager) DeriveKey ¶
func (km *KeyManager) DeriveKey(password, salt []byte, iterations, keyLen int) []byte
DeriveKey derives a key using PBKDF2
func (*KeyManager) GenerateKey ¶
func (km *KeyManager) GenerateKey(id, description string, size int) (*KeyPair, error)
GenerateKey generates a new cryptographic key
func (*KeyManager) GenerateSalt ¶
func (km *KeyManager) GenerateSalt(size int) ([]byte, error)
GenerateSalt generates a random salt
func (*KeyManager) GetActiveKey ¶
func (km *KeyManager) GetActiveKey(id string) (*KeyPair, bool)
GetActiveKey returns the active key for a given ID
func (*KeyManager) GetKeyInfo ¶
func (km *KeyManager) GetKeyInfo() map[string]map[string]interface{}
GetKeyInfo returns information about all keys
type KeyPair ¶
type KeyPair struct {
ID string
PublicKey []byte
PrivateKey []byte
CreatedAt time.Time
ExpiresAt time.Time
Active bool
Description string
}
KeyPair represents a cryptographic key with metadata
type SecurityMiddleware ¶
type SecurityMiddleware struct {
// contains filtered or unexported fields
}
SecurityMiddleware provides comprehensive security middleware
func NewSecurityMiddleware ¶
func NewSecurityMiddleware(jwtSecret []byte, issuer string) *SecurityMiddleware
NewSecurityMiddleware creates a new security middleware instance
func (*SecurityMiddleware) AuthMiddleware ¶
func (sm *SecurityMiddleware) AuthMiddleware(next http.HandlerFunc) http.HandlerFunc
AuthMiddleware provides JWT authentication middleware
func (*SecurityMiddleware) CORSMiddleware ¶
func (sm *SecurityMiddleware) CORSMiddleware(next http.HandlerFunc) http.HandlerFunc
CORSMiddleware handles CORS headers
func (*SecurityMiddleware) CombinedMiddleware ¶
func (sm *SecurityMiddleware) CombinedMiddleware(next http.HandlerFunc) http.HandlerFunc
CombinedMiddleware combines all security middleware
func (*SecurityMiddleware) GenerateServiceToken ¶
func (sm *SecurityMiddleware) GenerateServiceToken(serviceName string, permissions []string, duration time.Duration) (string, error)
GenerateServiceToken generates a JWT token for a service
func (*SecurityMiddleware) GetActiveKey ¶
func (sm *SecurityMiddleware) GetActiveKey(id string) (*KeyPair, bool)
GetActiveKey returns the active key from the key manager
func (*SecurityMiddleware) GetKeyManager ¶
func (sm *SecurityMiddleware) GetKeyManager() *KeyManager
GetKeyManager returns the key manager instance
func (*SecurityMiddleware) RateLimitMiddleware ¶
func (sm *SecurityMiddleware) RateLimitMiddleware(next http.HandlerFunc) http.HandlerFunc
RateLimitMiddleware provides rate limiting middleware
func (*SecurityMiddleware) RotateKey ¶
func (sm *SecurityMiddleware) RotateKey(id, description string, size int) error
RotateKey rotates a key in the key manager
func (*SecurityMiddleware) SecurityHeadersMiddleware ¶
func (sm *SecurityMiddleware) SecurityHeadersMiddleware(next http.HandlerFunc) http.HandlerFunc
SecurityHeadersMiddleware adds security headers to responses