Documentation
¶
Index ¶
- func NewSimpleTestKMS() config.KeyManagementService
- func NewTestCrypto(t interface{}) (*encx.Crypto, error)
- type SimpleTestKMS
- func (s *SimpleTestKMS) CreateKey(ctx context.Context, description string) (string, error)
- func (s *SimpleTestKMS) DecryptDEK(ctx context.Context, keyID string, ciphertext []byte) ([]byte, error)
- func (s *SimpleTestKMS) EncryptDEK(ctx context.Context, keyID string, plaintext []byte) ([]byte, error)
- func (s *SimpleTestKMS) GetKeyID(ctx context.Context, alias string) (string, error)
- type UUIDUser
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSimpleTestKMS ¶
func NewSimpleTestKMS() config.KeyManagementService
NewSimpleTestKMS creates a new simple test KMS with a default key
func NewTestCrypto ¶
NewTestCrypto creates a simple Crypto instance for testing and examples If t is nil, creates a basic test crypto for examples/demos
Types ¶
type SimpleTestKMS ¶
type SimpleTestKMS struct {
// contains filtered or unexported fields
}
SimpleTestKMS implements a basic in-memory KMS for testing and examples
func (*SimpleTestKMS) DecryptDEK ¶
func (s *SimpleTestKMS) DecryptDEK(ctx context.Context, keyID string, ciphertext []byte) ([]byte, error)
DecryptDEK decrypts the DEK using AES-GCM
func (*SimpleTestKMS) EncryptDEK ¶
func (s *SimpleTestKMS) EncryptDEK(ctx context.Context, keyID string, plaintext []byte) ([]byte, error)
EncryptDEK encrypts the DEK using AES-GCM
type UUIDUser ¶ added in v0.8.0
type UUIDUser struct {
// Basic types - should always be encrypted (no condition check)
ID uuid.UUID `json:"id"`
Email string `json:"email" encx:"encrypt"`
Name string `json:"name"`
Age int `json:"age" encx:"encrypt"`
IsActive bool `json:"is_active" encx:"encrypt"`
// Struct types with semantic zero values - should check for zero
CreatedAt time.Time `json:"created_at" encx:"encrypt"`
UserID uuid.UUID `json:"user_id" encx:"encrypt"`
// Pointer types - should check for nil
NickName *string `json:"nickname" encx:"encrypt"`
UpdatedAt *time.Time `json:"updated_at" encx:"encrypt"`
TenantID *uuid.UUID `json:"tenant_id" encx:"encrypt"`
}
UUIDUser represents a user with various field types to test zero-value checking
type User ¶
type User struct {
ID int `json:"id"`
Email string `json:"email" encx:"encrypt,hash_basic"`
Phone string `json:"phone" encx:"encrypt"`
SSN string `json:"ssn" encx:"hash_secure"`
// Added a comment to change the file hash
Name string `json:"name"`
// Companion fields for encryption/hashing
EmailEncrypted []byte `json:"email_encrypted" db:"email_encrypted"`
EmailHash string `json:"email_hash" db:"email_hash"`
PhoneEncrypted []byte `json:"phone_encrypted" db:"phone_encrypted"`
SSNHashSecure string `json:"ssn_hash_secure" db:"ssn_hash_secure"`
}
User represents a user with encrypted fields
Click to show internal directories.
Click to hide internal directories.