dto

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package dto provides data transfer objects for HTTP request and response handling.

Package dto provides data transfer objects for HTTP request and response handling.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseAlgorithm

func ParseAlgorithm(alg string) (cryptoDomain.Algorithm, error)

ParseAlgorithm converts a string to a cryptoDomain.Algorithm. Returns an error if the algorithm is not supported.

Types

type CreateTransitKeyRequest

type CreateTransitKeyRequest struct {
	Name      string `json:"name"`
	Algorithm string `json:"algorithm"` // "aes-gcm" or "chacha20-poly1305"
}

CreateTransitKeyRequest contains the parameters for creating a new transit key.

func (*CreateTransitKeyRequest) Validate

func (r *CreateTransitKeyRequest) Validate() error

Validate checks if the create transit key request is valid.

type DecryptRequest

type DecryptRequest struct {
	Ciphertext string `json:"ciphertext"` // Format: "version:base64-ciphertext"
}

DecryptRequest contains the parameters for decrypting data.

func (*DecryptRequest) Validate

func (r *DecryptRequest) Validate() error

Validate checks if the decrypt request is valid.

type DecryptResponse

type DecryptResponse struct {
	Plaintext string `json:"plaintext"` // Base64-encoded plaintext
	Version   uint   `json:"version"`
}

DecryptResponse contains the result of a decryption operation. SECURITY: The Plaintext field contains sensitive data and should be transmitted over HTTPS.

func MapDecryptResponse

func MapDecryptResponse(plaintext []byte, version uint) DecryptResponse

MapDecryptResponse converts plaintext bytes and version to an API response.

type EncryptRequest

type EncryptRequest struct {
	Plaintext string `json:"plaintext"` // Base64-encoded plaintext
}

EncryptRequest contains the parameters for encrypting data.

func (*EncryptRequest) Validate

func (r *EncryptRequest) Validate() error

Validate checks if the encrypt request is valid.

type EncryptResponse

type EncryptResponse struct {
	Ciphertext string `json:"ciphertext"` // Format: "version:base64-ciphertext"
	Version    uint   `json:"version"`
}

EncryptResponse contains the result of an encryption operation.

type RotateTransitKeyRequest

type RotateTransitKeyRequest struct {
	Algorithm string `json:"algorithm"` // "aes-gcm" or "chacha20-poly1305"
}

RotateTransitKeyRequest contains the parameters for rotating a transit key.

func (*RotateTransitKeyRequest) Validate

func (r *RotateTransitKeyRequest) Validate() error

Validate checks if the rotate transit key request is valid.

type TransitKeyResponse

type TransitKeyResponse struct {
	ID        string    `json:"id"`
	Name      string    `json:"name"`
	Version   uint      `json:"version"`
	DekID     string    `json:"dek_id"`
	CreatedAt time.Time `json:"created_at"`
}

TransitKeyResponse represents a transit key in API responses.

func MapTransitKeyToResponse

func MapTransitKeyToResponse(transitKey *transitDomain.TransitKey) TransitKeyResponse

MapTransitKeyToResponse converts a domain transit key to an API response.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL