Documentation ¶
Overview ¶
Package masker provides Go types which makes it easy to protect sensitive data from exposure by masking the data in situations that would result in exposure such as string formatting, logging and marshalling to JSON or YAML.
Index ¶
Constants ¶
const CensoredText = "###CENSORED###"
CensoredText is the text displayed instead of protected values when they are masked.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CensoredString ¶
type CensoredString string
CensoredString masks a string value by censoring it when it printed or marshalled to JSON, YAML or Text. The protected value can be revealed by calling the UnmaskString() method on the CensoredString value.
func (CensoredString) GoString ¶
func (s CensoredString) GoString() string
GoString returns the Go syntax for a CensoredString value, which will invariably be the Go syntax for the CensoredString constant.
func (CensoredString) MarshalText ¶
func (s CensoredString) MarshalText() ([]byte, error)
MarshalText marshals the CensoredString value into a textual form, which will invariably be the value of the CensoredText constant.
func (CensoredString) String ¶
func (s CensoredString) String() string
String returns the native format for a CensoredString value, which will invariably be the CensoredString constant.
func (CensoredString) UnmaskString ¶
func (s CensoredString) UnmaskString() string
UnmaskString returns the underlying protected string of a CensoredString value.
type StringUnmasker ¶
type StringUnmasker interface {
UnmaskString() string
}
StringUnmasker is an interface that provides a method for revealing masked strings.