dto

package
v0.5.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: 5 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

This section is empty.

Types

type CreateOrUpdateSecretRequest

type CreateOrUpdateSecretRequest struct {
	Value string `json:"value" binding:"required"` // base64-encoded plaintext
}

CreateOrUpdateSecretRequest contains the parameters for creating or updating a secret. The path is extracted from the URL parameter, not the request body.

func (*CreateOrUpdateSecretRequest) Validate

func (r *CreateOrUpdateSecretRequest) Validate() error

Validate checks if the create or update secret request is valid.

type SecretResponse

type SecretResponse struct {
	ID        string    `json:"id"`
	Path      string    `json:"path"`
	Version   uint      `json:"version"`
	Value     string    `json:"value,omitempty"` // base64-encoded plaintext, only included in GET responses
	CreatedAt time.Time `json:"created_at"`
}

SecretResponse represents a secret in API responses. SECURITY: The Value field contains base64-encoded plaintext and is only included in GET responses. Must be transmitted over HTTPS in production.

func MapSecretToCreateResponse

func MapSecretToCreateResponse(secret *secretsDomain.Secret) SecretResponse

MapSecretToCreateResponse converts a domain secret to an API response for POST operations. The plaintext value is excluded for security (only metadata is returned on creation).

func MapSecretToGetResponse

func MapSecretToGetResponse(secret *secretsDomain.Secret) SecretResponse

MapSecretToGetResponse converts a domain secret to an API response for GET operations. The plaintext value is base64-encoded before inclusion. SECURITY: Caller must zero plaintext from the domain object after mapping using cryptoDomain.Zero(secret.Plaintext).

Jump to

Keyboard shortcuts

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