Documentation
¶
Overview ¶
Package http provides HTTP handlers for tokenization key management and token operations.
Package http provides HTTP handlers for tokenization key management and token operations.
Package http provides HTTP handlers for tokenization key management and token operations.
Index ¶
- type TokenizationHandler
- func (h *TokenizationHandler) DetokenizeBatchHandler(c *gin.Context)
- func (h *TokenizationHandler) DetokenizeHandler(c *gin.Context)
- func (h *TokenizationHandler) RevokeHandler(c *gin.Context)
- func (h *TokenizationHandler) TokenizeBatchHandler(c *gin.Context)
- func (h *TokenizationHandler) TokenizeHandler(c *gin.Context)
- func (h *TokenizationHandler) ValidateHandler(c *gin.Context)
- type TokenizationKeyHandler
- func (h *TokenizationKeyHandler) CreateHandler(c *gin.Context)
- func (h *TokenizationKeyHandler) DeleteHandler(c *gin.Context)
- func (h *TokenizationKeyHandler) GetByNameHandler(c *gin.Context)
- func (h *TokenizationKeyHandler) ListHandler(c *gin.Context)
- func (h *TokenizationKeyHandler) RotateHandler(c *gin.Context)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TokenizationHandler ¶
type TokenizationHandler struct {
// contains filtered or unexported fields
}
TokenizationHandler handles HTTP requests for tokenization operations. Coordinates tokenize, detokenize, validate, and revoke operations with TokenizationUseCase.
func NewTokenizationHandler ¶
func NewTokenizationHandler( tokenizationUseCase tokenizationUseCase.TokenizationUseCase, batchLimit int, logger *slog.Logger, ) *TokenizationHandler
NewTokenizationHandler creates a new tokenization handler with required dependencies.
func (*TokenizationHandler) DetokenizeBatchHandler ¶ added in v0.28.0
func (h *TokenizationHandler) DetokenizeBatchHandler(c *gin.Context)
DetokenizeBatchHandler retrieves original plaintext values for multiple tokens. POST /v1/tokenization/detokenize-batch - Requires DecryptCapability. Wrapped in a transaction for atomicity. Returns 200 OK with a batch of base64-encoded plaintexts and metadata.
func (*TokenizationHandler) DetokenizeHandler ¶
func (h *TokenizationHandler) DetokenizeHandler(c *gin.Context)
DetokenizeHandler retrieves the original plaintext value for a given token. POST /v1/tokenization/detokenize - Requires DecryptCapability. Returns 200 OK with base64-encoded plaintext and metadata.
func (*TokenizationHandler) RevokeHandler ¶
func (h *TokenizationHandler) RevokeHandler(c *gin.Context)
RevokeHandler marks a token as revoked, preventing further detokenization. POST /v1/tokenization/revoke - Requires DeleteCapability. Returns 204 No Content on success.
func (*TokenizationHandler) TokenizeBatchHandler ¶ added in v0.28.0
func (h *TokenizationHandler) TokenizeBatchHandler(c *gin.Context)
TokenizeBatchHandler generates tokens for multiple plaintext values using the named key. POST /v1/tokenization/keys/:name/tokenize-batch - Requires EncryptCapability. Wrapped in a transaction for atomicity. Returns 201 Created with a batch of tokens and metadata.
func (*TokenizationHandler) TokenizeHandler ¶
func (h *TokenizationHandler) TokenizeHandler(c *gin.Context)
TokenizeHandler generates a token for the given plaintext value using the named key. POST /v1/tokenization/keys/:name/tokenize - Requires EncryptCapability. In deterministic mode, returns existing token if the value has been tokenized before. Returns 201 Created with token and metadata.
func (*TokenizationHandler) ValidateHandler ¶
func (h *TokenizationHandler) ValidateHandler(c *gin.Context)
ValidateHandler checks if a token exists and is valid (not expired or revoked). POST /v1/tokenization/validate - Requires ReadCapability. Returns 200 OK with validation result.
type TokenizationKeyHandler ¶
type TokenizationKeyHandler struct {
// contains filtered or unexported fields
}
TokenizationKeyHandler handles HTTP requests for tokenization key management operations. Coordinates key creation, rotation, and deletion with TokenizationKeyUseCase.
func NewTokenizationKeyHandler ¶
func NewTokenizationKeyHandler( keyUseCase tokenizationUseCase.TokenizationKeyUseCase, logger *slog.Logger, ) *TokenizationKeyHandler
NewTokenizationKeyHandler creates a new tokenization key handler with required dependencies.
func (*TokenizationKeyHandler) CreateHandler ¶
func (h *TokenizationKeyHandler) CreateHandler(c *gin.Context)
CreateHandler creates a new tokenization key with version 1. POST /v1/tokenization/keys - Requires WriteCapability. Returns 201 Created with key details.
func (*TokenizationKeyHandler) DeleteHandler ¶
func (h *TokenizationKeyHandler) DeleteHandler(c *gin.Context)
DeleteHandler soft-deletes a tokenization key by name. DELETE /v1/tokenization/keys/:name - Requires DeleteCapability. Returns 204 No Content on success.
func (*TokenizationKeyHandler) GetByNameHandler ¶ added in v0.28.0
func (h *TokenizationKeyHandler) GetByNameHandler(c *gin.Context)
GetByNameHandler retrieves a single tokenization key by its name. GET /v1/tokenization/keys/:name - Requires ReadCapability. Returns 200 OK with key details.
func (*TokenizationKeyHandler) ListHandler ¶ added in v0.16.0
func (h *TokenizationKeyHandler) ListHandler(c *gin.Context)
ListHandler retrieves tokenization keys with cursor-based pagination support. GET /v1/tokenization/keys?after_name=key-name&limit=50 - Requires ReadCapability. Returns 200 OK with paginated tokenization key list ordered by name ascending. Uses cursor pagination with after_name parameter.
func (*TokenizationKeyHandler) RotateHandler ¶
func (h *TokenizationKeyHandler) RotateHandler(c *gin.Context)
RotateHandler creates a new version of an existing tokenization key. POST /v1/tokenization/keys/:name/rotate - Requires RotateCapability. Returns 201 Created with new key version.