Skip to main content

Redact | Node.js SDK

The Pangea Redact API helps developers limit the sprawl of sensitive information by performing redaction using defined rules.

Redact

constructor(token: PangeaToken, config: PangeaConfig, options: RedactOptions): RedactService

Creates a new RedactService with the given Pangea API token and configuration.

required parameters

PangeaToken

Pangea API token.

Configuration.

Response Object

RedactService
const config = new PangeaConfig({ domain: "pangea_domain" });
const redact = new RedactService("pangea_token", config);

Redact

redact(text: string, options: TextOptions): Promise<PangeaResponse<TextResult>>

Redact sensitive information from provided text.

required parameters

string

The text data to redact

Supported options:

  • debug {Boolean} - Setting this value to true will provide a detailed analysis of the redacted data and the rules that caused redaction
  • rules {String[]} - An array of redact rule short names
  • rulesets {String[]} - An array of redact ruleset short names
  • return_result {Boolean} - Setting this value to false will omit the redacted result only returning count
  • redaction_method_overrides {RedactionMethodOverrides} - A set of redaction method overrides for any enabled rule. These methods override the config declared methods

Response Object

Promise<PangeaResponse<TextResult>>
const response = await redact.redact(
  "Jenny Jenny... 555-867-5309"
);

Redact structured

redactStructured(data: object, options: StructuredOptions): Promise<PangeaResponse<StructuredResult>>

Redact sensitive information from structured data (e.g., JSON).

required parameters

object

Structured data to redact

Supported options:

  • debug {Boolean} - Setting this value to true will provide a detailed analysis of the redacted data and the rules that caused redaction
  • rules {String[]} - An array of redact rule short names
  • rulesets {String[]} - An array of redact ruleset short names
  • jsonp {String[]} - JSON path(s) used to identify the specific JSON fields to redact in the structured data. Note: If jsonp parameter is used, the data parameter must be in JSON format.
  • format {String} - The format of the structured data to redact. Default: "json"
  • return_result {Boolean} - Setting this value to false will omit the redacted result only returning count
  • redaction_method_overrides {RedactionMethodOverrides} - A set of redaction method overrides for any enabled rule. These methods override the config declared methods

Response Object

Promise<PangeaResponse<StructuredResult>>
const response = await redact.redactStructured({
  "phone": "555-867-5309"
});

Unredact

unredact(request: UnredactRequest): Promise<PangeaResponse<UnredactResult<O>>>

Decrypt or unredact fpe redactions.

required parameters

UnredactRequest

Unredact request data

  • redacted_data - Data to unredact
  • fpe_context {string} - FPE context used to decrypt and unredact data

Response Object

Promise<PangeaResponse<UnredactResult<O>>>

Enum FPEAlphabet

FPEAlphabet

ALPHANUMERIC = "alphanumeric"

ALPHANUMERICLOWER = "alphanumericlower"

NUMERIC = "numeric"

Enum MaskingType

MaskingType

MASK = "mask"

UNMASK = "unmask"

Enum RedactType

RedactType

DETECT_ONLY = "detect_only"

FPE = "fpe"

HASH = "hash"

MASK = "mask"

PARTIAL_MASKING = "partial_masking"

REPLACEMENT = "replacement"

Interface Options

Options

optional parameters

boolean
boolean

Is this redact call going to be used in an LLM request?

RedactionMethodOverrides
boolean
Array<string>
Array<string>
VaultParameters

Interface PartialMasking

PartialMasking

optional parameters

Array<string>
number
number
Array<string>
MaskingType
number
number

Interface RedactionMethodOverrides

RedactionMethodOverrides

required parameters

RedactType

optional parameters

FPEAlphabet
object
PartialMasking
string

Interface StructuredOptions

StructuredOptions

optional parameters

boolean
string
Array<string>
boolean

Is this redact call going to be used in an LLM request?

RedactionMethodOverrides
boolean
Array<string>
Array<string>
VaultParameters

Interface StructuredParams

StructuredParams

required parameters

Object

optional parameters

boolean
string
Array<string>
boolean

Is this redact call going to be used in an LLM request?

RedactionMethodOverrides
boolean
Array<string>
Array<string>
VaultParameters

Interface StructuredResult

StructuredResult

required parameters

number

optional parameters

object

Interface TextOptions

TextOptions

optional parameters

boolean
boolean

Is this redact call going to be used in an LLM request?

RedactionMethodOverrides
boolean
Array<string>
Array<string>
VaultParameters

Interface TextParams

TextParams

required parameters

string

optional parameters

boolean
boolean

Is this redact call going to be used in an LLM request?

RedactionMethodOverrides
boolean
Array<string>
Array<string>
VaultParameters

Interface TextResult

TextResult

required parameters

number

optional parameters

string

Interface UnredactRequest

UnredactRequest

required parameters

O

optional parameters

string

Interface UnredactResult

UnredactResult

required parameters

O

Interface VaultParameters

VaultParameters

optional parameters

string

A vault key ID of an exportable key used to redact with FPE instead of using the service config default.

string

A vault secret ID of a secret used to salt a hash instead of using the service config default.