Documentation
¶
Index ¶
- Variables
- func DecryptAddress(encryptedAddress models.EncryptedAddress, key []byte) (models.RawAddress, error)
- func DecryptField(encryptedField models.EncryptedField, key []byte) (string, error)
- func EncryptAddress(address models.RawAddress, key []byte) (models.EncryptedAddress, error)
- func EncryptField(plaintext string, key []byte) (models.EncryptedField, error)
- func GenerateHMAC(message, secret string) string
- func GenerateJWT(userID string) (string, error)
- func GenerateRandomString(length int) string
- func GetClientIDFromContext(c *gin.Context) (string, error)
- func HashAPIKey(apiKey string) string
- func HashPassword(password string) string
- type Claims
- type KMSUploader
- type S3Uploader
Constants ¶
This section is empty.
Variables ¶
View Source
var JwtKey = []byte("secret_key")
Functions ¶
func DecryptAddress ¶
func DecryptAddress(encryptedAddress models.EncryptedAddress, key []byte) (models.RawAddress, error)
DecryptAddress decrypts the address fields
func DecryptField ¶
func DecryptField(encryptedField models.EncryptedField, key []byte) (string, error)
DecryptField decrypts a given ciphertext using AES-GCM
func EncryptAddress ¶
func EncryptAddress(address models.RawAddress, key []byte) (models.EncryptedAddress, error)
EncryptAddress encrypts the address fields
func EncryptField ¶
func EncryptField(plaintext string, key []byte) (models.EncryptedField, error)
EncryptField encrypts a given plaintext using AES-GCM
func GenerateHMAC ¶
GenerateHMAC generates an HMAC-SHA256 hash for the given message and secret
func GenerateJWT ¶
func GenerateRandomString ¶
GenerateRandomString generates a secure random string of the specified length
func HashAPIKey ¶
HashAPIKey hashes the given API key using SHA-256
func HashPassword ¶
HashPassword hashes the given password using SHA-256
Types ¶
type Claims ¶
type Claims struct { UserID string `json:"cockpit_user_id"` jwt.StandardClaims }
type KMSUploader ¶
type KMSUploader struct { Client interfaces.KMSClient KeyID string // KMS Key ID (ARN or alias) used for generating data keys }
func NewKMSUploader ¶
func NewKMSUploader(region, accessKey, secretAccessKey, keyID string) (*KMSUploader, error)
func (*KMSUploader) DecryptData ¶
func (*KMSUploader) EncryptData ¶
func (*KMSUploader) GenerateDataKey ¶
type S3Uploader ¶
func NewS3Uploader ¶
func (*S3Uploader) DownloadFile ¶
func (u *S3Uploader) DownloadFile(ctx context.Context, objectKey string) (*s3.GetObjectOutput, error)
This function is for testing purposes only
func (*S3Uploader) UploadFile ¶
func (u *S3Uploader) UploadFile(ctx context.Context, file multipart.File, fileName string, mimeType string, kmsUploader interfaces.KMSUploader) (string, error)
Click to show internal directories.
Click to hide internal directories.