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 ¶
- func ParseAlgorithm(alg string) (cryptoDomain.Algorithm, error)
- func ParseFormatType(formatType string) (tokenizationDomain.FormatType, error)
- type CreateTokenizationKeyRequest
- type DetokenizeRequest
- type DetokenizeResponse
- type RevokeTokenRequest
- type RotateTokenizationKeyRequest
- type TokenizationKeyResponse
- type TokenizeRequest
- type TokenizeResponse
- type ValidateTokenRequest
- type ValidateTokenResponse
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.
func ParseFormatType ¶
func ParseFormatType(formatType string) (tokenizationDomain.FormatType, error)
ParseFormatType converts a string to a tokenizationDomain.FormatType. Returns an error if the format type is not supported.
Types ¶
type CreateTokenizationKeyRequest ¶
type CreateTokenizationKeyRequest struct {
Name string `json:"name"`
FormatType string `json:"format_type"` // "uuid", "numeric", "luhn-preserving", "alphanumeric"
IsDeterministic bool `json:"is_deterministic"` // If true, same value produces same token
Algorithm string `json:"algorithm"` // "aes-gcm" or "chacha20-poly1305"
}
CreateTokenizationKeyRequest contains the parameters for creating a new tokenization key.
func (*CreateTokenizationKeyRequest) Validate ¶
func (r *CreateTokenizationKeyRequest) Validate() error
Validate checks if the create tokenization key request is valid.
type DetokenizeRequest ¶
type DetokenizeRequest struct {
Token string `json:"token"`
}
DetokenizeRequest contains the parameters for detokenizing a value.
func (*DetokenizeRequest) Validate ¶
func (r *DetokenizeRequest) Validate() error
Validate checks if the detokenize request is valid.
type DetokenizeResponse ¶
type DetokenizeResponse struct {
Plaintext string `json:"plaintext"` // Base64-encoded plaintext
Metadata map[string]any `json:"metadata,omitempty"`
}
DetokenizeResponse represents the result of detokenizing a token.
type RevokeTokenRequest ¶
type RevokeTokenRequest struct {
Token string `json:"token"`
}
RevokeTokenRequest contains the parameters for revoking a token.
func (*RevokeTokenRequest) Validate ¶
func (r *RevokeTokenRequest) Validate() error
Validate checks if the revoke token request is valid.
type RotateTokenizationKeyRequest ¶
type RotateTokenizationKeyRequest struct {
FormatType string `json:"format_type"` // "uuid", "numeric", "luhn-preserving", "alphanumeric"
IsDeterministic bool `json:"is_deterministic"` // If true, same value produces same token
Algorithm string `json:"algorithm"` // "aes-gcm" or "chacha20-poly1305"
}
RotateTokenizationKeyRequest contains the parameters for rotating a tokenization key.
func (*RotateTokenizationKeyRequest) Validate ¶
func (r *RotateTokenizationKeyRequest) Validate() error
Validate checks if the rotate tokenization key request is valid.
type TokenizationKeyResponse ¶
type TokenizationKeyResponse struct {
ID string `json:"id"`
Name string `json:"name"`
Version uint `json:"version"`
FormatType string `json:"format_type"`
IsDeterministic bool `json:"is_deterministic"`
CreatedAt time.Time `json:"created_at"`
}
TokenizationKeyResponse represents a tokenization key in API responses.
func MapTokenizationKeyToResponse ¶
func MapTokenizationKeyToResponse(key *tokenizationDomain.TokenizationKey) TokenizationKeyResponse
MapTokenizationKeyToResponse converts a domain tokenization key to an API response.
type TokenizeRequest ¶
type TokenizeRequest struct {
Plaintext string `json:"plaintext"` // Base64-encoded plaintext
Metadata map[string]any `json:"metadata,omitempty"`
TTL *int `json:"ttl,omitempty"` // Time-to-live in seconds (optional)
}
TokenizeRequest contains the parameters for tokenizing a value.
func (*TokenizeRequest) Validate ¶
func (r *TokenizeRequest) Validate() error
Validate checks if the tokenize request is valid.
type TokenizeResponse ¶
type TokenizeResponse struct {
Token string `json:"token"`
Metadata map[string]any `json:"metadata,omitempty"`
CreatedAt time.Time `json:"created_at"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
}
TokenizeResponse represents the result of tokenizing a value.
func MapTokenToTokenizeResponse ¶
func MapTokenToTokenizeResponse(token *tokenizationDomain.Token) TokenizeResponse
MapTokenToTokenizeResponse converts a domain token to a tokenize API response.
type ValidateTokenRequest ¶
type ValidateTokenRequest struct {
Token string `json:"token"`
}
ValidateTokenRequest contains the parameters for validating a token.
func (*ValidateTokenRequest) Validate ¶
func (r *ValidateTokenRequest) Validate() error
Validate checks if the validate token request is valid.
type ValidateTokenResponse ¶
type ValidateTokenResponse struct {
Valid bool `json:"valid"`
}
ValidateTokenResponse represents the result of validating a token.