JSON obfuscation functions
- Source:
Methods
(static) creditCards(obj, replacementopt)
Obfuscates credit card values in a JSON object by replacing them with a given string (e.g. '4012-8888-8888-1881' --> '***')
Supports Visa, Master and Amex card numbers with seprarated by dashes, dots, whitespaces or without any delimiter.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
obj |
Object | the object to obfuscate the credit card values | ||
replacement |
string |
<optional> |
*** | the replacement string |
- Source:
(static) ipAddresses(obj, replacementopt)
Obfuscates IP address values (v4 and v6) in a JSON object by replacing them with a given string (e.g. '10.0.1.17' --> '***')
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
obj |
Object | the object to obfuscate the IP address values | ||
replacement |
string |
<optional> |
*** | the replacement string |
- Source:
(static) keyRegex(obj, pattern, replacementopt)
Obfuscates all values of a JSON object where the key matches a given RegEx. RegEx check is case-insensitive.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
obj |
Object | the object to obfuscate | ||
pattern |
string | the RegEx pattern to use | ||
replacement |
string |
<optional> |
*** | the replacement string in case if a RegEx match |
- Source:
(static) numbers(obj, replacementopt)
Obfuscates all number values in a JSON object by replacing them with a given string (e.g. 28 --> '***')
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
obj |
Object | the object to obfuscate the numbers | ||
replacement |
string |
<optional> |
*** | the replacement string |
- Source:
(static) strings(obj, replacementopt, retainopt, minreplaceopt)
Obfuscates all string values in a JSON object by replacing characters (e.g. 'New York' --> 'Ne******')
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
obj |
Object | the object to obfuscate the strings | ||
replacement |
string |
<optional> |
* | the replacement character |
retain |
number |
<optional> |
3 | the left-most number of original characters to retain |
minreplace |
number |
<optional> |
3 | the minimal number of replacement characters to use, also if original string was shorter |
- Source:
(static) valueRegex(obj, pattern, replacementopt)
Obfuscates all values of a JSON object where the value matches a given RegEx. RegEx check is case-insensitive.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
obj |
Object | the object to obfuscate | ||
pattern |
string | the RegEx pattern to use | ||
replacement |
string |
<optional> |
*** | the replacement string in case if a RegEx match |
- Source: