← All procedures

privacyScan.text

Find private data in a text: terms of a list, email addresses, phone numbers, coordinates

CLI
Package
@procedures/privacy-scan · README
Path
["privacyScan","text"]
CLI
mark privacyScan text --text <string>
As data
{"$proc":["privacyScan","text"],"input":{}}

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/privacy-scan/register"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["privacyScan","text"], { text: "<text>" });
console.log(JSON.stringify(result));

From the command line

$ mark privacyScan text --text <string>

As data, in a program

{ "$proc": ["privacyScan", "text"], "input": { "text": "<text>" } }

Input

FieldTypeRequiredDefaultDescription
textstringyesThe text to scan
termsstring[]noThe private terms (names, places, accounts). The match ignores case and finds only whole words.
allowstring[]noThe values that are not private. The match ignores case.
kinds"term" | "email" | "phone" | "coordinate"[]noThe kinds to find: term, email, phone, coordinate (default: all)
maskbooleannoShow only the first character of each match (default: false)

Output

FieldTypeRequiredDefaultDescription
findingsobject[]yes
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "text": {
        "type": "string",
        "description": "The text to scan"
      },
      "terms": {
        "description": "The private terms (names, places, accounts). The match ignores case and finds only whole words.",
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "allow": {
        "description": "The values that are not private. The match ignores case.",
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "kinds": {
        "description": "The kinds to find: term, email, phone, coordinate (default: all)",
        "type": "array",
        "items": {
          "type": "string",
          "enum": [
            "term",
            "email",
            "phone",
            "coordinate"
          ]
        }
      },
      "mask": {
        "description": "Show only the first character of each match (default: false)",
        "type": "boolean"
      }
    },
    "required": [
      "text"
    ]
  },
  "output": {
    "type": "object",
    "properties": {
      "findings": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "enum": [
                "term",
                "email",
                "phone",
                "coordinate"
              ]
            },
            "line": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            "column": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            "match": {
              "type": "string"
            }
          },
          "required": [
            "kind",
            "line",
            "column",
            "match"
          ],
          "additionalProperties": false
        }
      }
    },
    "required": [
      "findings"
    ],
    "additionalProperties": false
  }
}