Documentation
¶
Index ¶
- Variables
- type TokenizationMode
- type TokenizationService
- func (s *TokenizationService) Detokenize(token string) (string, error)
- func (s *TokenizationService) DetokenizeWithMode(token string, mode TokenizationMode) (string, error)
- func (s *TokenizationService) Tokenize(value string) (string, error)
- func (s *TokenizationService) TokenizeWithMode(value string, mode TokenizationMode) (string, error)
Constants ¶
This section is empty.
Variables ¶
var TokenizableFields = []string{
"FirstName",
"LastName",
"OtherNames",
"EmailAddress",
"PhoneNumber",
"Street",
"PostCode",
}
TokenizableFields defines which fields can be tokenized in the Identity model
Functions ¶
This section is empty.
Types ¶
type TokenizationMode ¶
type TokenizationMode int
TokenizationMode defines the type of tokenization to use
const ( // StandardMode uses regular AES-GCM encryption with base64 encoding StandardMode TokenizationMode = iota // FormatPreservingMode maintains the format of the original data FormatPreservingMode )
type TokenizationService ¶
type TokenizationService struct {
// contains filtered or unexported fields
}
TokenizationService handles converting PII to tokens and back
func NewTokenizationService ¶
func NewTokenizationService(encryptionKey []byte) *TokenizationService
NewTokenizationService creates a new tokenization service.
Parameters: - encryptionKey []byte: The encryption key used for tokenization.
Returns: - *TokenizationService: A new instance of TokenizationService.
func (*TokenizationService) Detokenize ¶
func (s *TokenizationService) Detokenize(token string) (string, error)
Detokenize converts a token back to the original PII value using automatic mode detection.
Parameters: - token string: The token to be converted back to PII.
Returns: - string: The original PII value. - error: An error if detokenization fails.
func (*TokenizationService) DetokenizeWithMode ¶
func (s *TokenizationService) DetokenizeWithMode(token string, mode TokenizationMode) (string, error)
DetokenizeWithMode converts a token back to the original PII value using the specified mode.
Parameters: - token string: The token to be converted back to PII. - mode TokenizationMode: The tokenization mode to use.
Returns: - string: The original PII value. - error: An error if detokenization fails.
func (*TokenizationService) Tokenize ¶
func (s *TokenizationService) Tokenize(value string) (string, error)
Tokenize converts a PII value to a token using the default standard mode.
Parameters: - value string: The original PII value to be tokenized.
Returns: - string: The tokenized value. - error: An error if tokenization fails.
func (*TokenizationService) TokenizeWithMode ¶
func (s *TokenizationService) TokenizeWithMode(value string, mode TokenizationMode) (string, error)
TokenizeWithMode converts a PII value to a token using the specified mode.
Parameters: - value string: The original PII value to be tokenized. - mode TokenizationMode: The tokenization mode to use.
Returns: - string: The tokenized value. - error: An error if tokenization fails.