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: string, config: PangeaConfig, options: RedactOptions): RedactService

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

required parameters

string

Pangea API token.

Configuration.

Response Object

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

post(endpoint: string, data: object, options: PostOptions): Promise<PangeaResponse<R>>

POST request.

required parameters

string

Endpoint path.

object

Request body.

Additional options.

Response Object

Promise<PangeaResponse<R>>

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

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

Response Object

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

Interface Options

Options

optional parameters

boolean
boolean
Array<string>
Array<string>

Interface StructuredOptions

StructuredOptions

optional parameters

boolean
string
Array<string>
boolean
Array<string>
Array<string>

Interface StructuredParams

StructuredParams

required parameters

Object

optional parameters

boolean
string
Array<string>
boolean
Array<string>
Array<string>

Interface StructuredResult

StructuredResult

required parameters

number

optional parameters

object

Interface TextOptions

TextOptions

optional parameters

boolean
boolean
Array<string>
Array<string>

Interface TextParams

TextParams

required parameters

string

optional parameters

boolean
boolean
Array<string>
Array<string>

Interface TextResult

TextResult

required parameters

number

optional parameters

string