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.

PangeaToken

Pangea API token.

Configuration.

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.

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

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).

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

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.

UnredactRequest

Unredact request data

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

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

boolean
boolean

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

RedactionMethodOverrides
boolean
Array<string>
Array<string>
VaultParameters

Interface PartialMasking

PartialMasking

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

Interface RedactionMethodOverrides

RedactionMethodOverrides

RedactType

FPEAlphabet
object
PartialMasking
string

Interface StructuredOptions

StructuredOptions

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

Object

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

number

object

Interface TextOptions

TextOptions

boolean
boolean

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

RedactionMethodOverrides
boolean
Array<string>
Array<string>
VaultParameters

Interface TextParams

TextParams

string

boolean
boolean

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

RedactionMethodOverrides
boolean
Array<string>
Array<string>
VaultParameters

Interface TextResult

TextResult

number

string

Interface UnredactRequest

UnredactRequest

O

string

Interface UnredactResult

UnredactResult

O

Interface VaultParameters

VaultParameters

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.