Documentation ¶
Index ¶
Constants ¶
const MaskSymbol = "*"
Variables ¶
This section is empty.
Functions ¶
func ReplaceGlobals ¶
func ReplaceGlobals(masker *Masker)
Types ¶
type Config ¶
type Config struct { MaxDepth int Triggers map[string]TriggerOpts }
type MaskResult ¶
type MaskResult struct { // Key masked key. (Maybe useful in future) Key string // Value masked value. Value interface{} }
MaskResult represents the result of masking.
type Masker ¶
type Masker struct {
// contains filtered or unexported fields
}
Masker struct allows you to use a single Masker object to manipulate json masking. cfg stores the config that is applied for all masking operations executed via Mask method.
func GlobalMasker ¶
func GlobalMasker() *Masker
func (*Masker) Mask ¶
Mask masks data given in parameters using specified config.
Example:
Data = `{"password": "qwerty123", "email": "example@example.com"}`
Using PASSWORD label for "password" and EMAIL for "email" we will reach the next result:
Output = `{"password": "*********", "email": "e******@example.com"}` TODO(Gorkovets Roman): Definitely needs rework due to multiple serialization and deserialization. Inefficient af.
type MaskerFunc ¶
type MaskerFunc func(key string, value interface{}) (MaskResult, error)
MaskerFunc masks given key-value pair and returns MaskResult structure which defines further behavior of masking algorithm.
type MaskerLabel ¶
type MaskerLabel string
MaskerLabel defines the way we mask the data in config.
const MaskerLabelCVV MaskerLabel = "CVV"
const MaskerLabelCardNumber MaskerLabel = "CARD_NUMBER"
const MaskerLabelEmail MaskerLabel = "EMAIL"
const MaskerLabelName MaskerLabel = "NAME"
const MaskerLabelPassword MaskerLabel = "PASSWORD"
const MaskerLabelPhoneNumber MaskerLabel = "PHONE_NUMBER"
type TriggerOpts ¶
type TriggerOpts struct { CaseSensitive bool MaskMethod MaskerLabel ShouldAppear bool // contains filtered or unexported fields }