Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AnonymizerRule ¶
type AnonymizerRule struct {
// Type of PII to detect (e.g. "PERSON", "PHONE_NUMBER", etc.)
Type string `json:"type" yaml:"type"`
// Operator defines the anonymization operation ("mask", "replace", "hash", "encrypt")
Operator string `json:"operator" yaml:"operator"`
// NewValue is used with "replace" operator
NewValue string `json:"new_value,omitempty" yaml:"new_value,omitempty"`
// MaskingChar is used with "mask" operator
MaskingChar string `json:"masking_char,omitempty" yaml:"masking_char,omitempty"`
// CharsToMask is used with "mask" operator
CharsToMask int `json:"chars_to_mask,omitempty" yaml:"chars_to_mask,omitempty"`
}
AnonymizerRule defines how to anonymize a specific type of PII
type Config ¶
type Config struct {
// AnonymizeURL is the URL of the Presidio Anonymizer API
AnonymizeURL string `json:"anonymize_url" yaml:"anonymize_url"`
// AnalyzerURL is the URL of the Presidio Analyzer API
AnalyzerURL string `json:"analyzer_url" yaml:"analyzer_url"`
// Language is the language used for analysis (default: "en")
Language string `json:"language" yaml:"language"`
// HashType is the hash algorithm used for hash operator (e.g., "md5", "sha256")
HashType string `json:"hash_type" yaml:"hash_type"`
// EncryptKey is the key used for encrypt operator
EncryptKey string `json:"encrypt_key" yaml:"encrypt_key"`
// AnonymizerRules defines the anonymization rules that apply to detected entities
AnonymizerRules []AnonymizerRule `json:"anonymizer_rules" yaml:"anonymizer_rules"`
}
Config represents the configuration for the Presidio Anonymizer plugin
type PresidioAnonymizer ¶
type PresidioAnonymizer struct {
Type string `json:"type"`
NewValue string `json:"new_value,omitempty"`
MaskingChar string `json:"masking_char,omitempty"`
CharsToMask int `json:"chars_to_mask,omitempty"`
HashType string `json:"hash_type,omitempty"`
CryptoKey string `json:"key,omitempty"`
FromEnd bool `json:"from_end"`
}
PresidioAnonymizer represents configuration for anonymization
type PresidioClient ¶
type PresidioClient struct {
// contains filtered or unexported fields
}
PresidioClient handles communication with Presidio API endpoints
func NewPresidioClient ¶
func NewPresidioClient(analyzerURL, anonymizerURL string) *PresidioClient
NewPresidioClient creates a new instance of PresidioClient
func (*PresidioClient) Analyze ¶
func (c *PresidioClient) Analyze(text string, templates []analyzeTemplate, language string) ([]analyzeResult, error)
Analyze sends request to Presidio Analyzer API
func (*PresidioClient) Anonymize ¶
func (c *PresidioClient) Anonymize(text string, anonymizers map[string]PresidioAnonymizer, analyzerResults []analyzeResult) (string, error)
Anonymize sends request to Presidio Anonymizer API
Click to show internal directories.
Click to hide internal directories.
