Skip to main content

Intelligent Data Tokenization for Enhanced Privacy and Security

Project description

Protecto.AI Python API Library

Intelligent Data Tokenization for Enhanced Privacy and Security

Protecto.AI employs a sophisticated approach to data tokenization, ensuring the intelligent handling of sensitive information. By leveraging this smart solution, you can unlock the full potential of your data while seamlessly upholding data privacy and security - all through the convenience of an API.

Installation:

To install Protecto.AI library, use the following command:

pip install protecto_ai

Usage Example:

ProtectoVault

Our tokenization process encompasses four distinct and customer-friendly methods for masking data:

To unmask data:

Asynchronous methods:

To mask large volumes of data, asynchronous masking method can be used:

To unmask large volumes of data, asynchronous unmasking method can be used:

The asynchronous status method enables us to monitor the status of both masking and unmasking processes.

For more comprehensive information about our product, kindly visit our website.

Code Example:

Import the ProtectoVault class from the protecto_ai module

from protecto_ai import ProtectoVault

# Create an instance of ProtectoVault with your authentication token
obj = ProtectoVault("<auth_token>")

To obtain the auth token, please refer to the Step-by-Step Guide to Obtain Your Auth Token.

Mask with AutoDetect:

This method automatically identifies and masks personal/sensitive data within specific sentences, leaving the rest of the data intact.

# Pass a list of sensitive information as input for the mask method
result = obj.mask(["George Washington is happy", "Mark lives in the U.S.A"])
# Print the masked result
print(result)

This will give you the masked result:

{ 
  "data": [ 
    { 
      "value": "George Washington is happy", 
      "token_value": "<PER>wRePE302Qx vUc7DruuWm</PER> is happy", 
      "individual_tokens": [ 
        { 
          "value": "George Washington", 
          "pii_type": "PERSON", 
          "token": "wRePE302Qx vUc7DruuWm", 
          "prefix": "<PER>", 
          "suffix": "</PER>" 
        } 
    ] 
    }, 
    { 
      "value": "Mark lives in the U.S.A", 
      "token_value": "<PER>7FHnu7Uo2O</PER> lives in the <ADDRESS>oQLxg3gisk.G2jPUYZHcv.bHIrJ0Mb7k</ADDRESS>", 
      "individual_tokens": [ 
        { 
          "value": "Mark", 
          "pii_type": "PERSON", 
          "token": "7FHnu7Uo2O", 
          "prefix": "<PER>", 
          "suffix": "</PER>" 
        }, 
        { 
          "value": "U.S.A", 
          "pii_type": "GPE", 
          "token": "oQLxg3gisk.G2jPUYZHcv.bHIrJ0Mb7k", 
          "prefix": "<ADDRESS>", 
          "suffix": "</ADDRESS>" 
        } 
      ] 
    } 
  ], 
  "success": true, 
  "error": { 
    "message": "" 
  } 
} 

For more details, check the link.

Mask with a Specific Token:

This method allows you to mask input data according to default token types (Text token, Special Token, Numeric Token) specified.

# pass list of values as an input for the mask method.Provide default token type.
result = obj.mask(["Mark","Australia"], "Text Token")
# Print the masked result
print(result)

You can get list of default token types in this link.

Result:

{ 
  "data": [ 
    { 
      "value": "Australia", 
      "token_value": "1AN9X4Doab", 
      "token_name": "Text Token" 
    }, 
    { 
      "value": "Mark", 
      "token_value": "7FHnu7Uo2O", 
      "token_name": "Text Token" 
    } 
  ], 
  "success": true, 
  "error": { 
    "message": "" 
  } 

For more details, check the link.

Mask with a Specific Token and Format:

This method allows you to mask input data according to default token types (Text token, Special Token, Numeric Token) and formats specified.

# pass list of sensitive information as an input for the mask method. Provide default token type and format
result = obj.mask(["(555) 123-4567"], "Numeric Token", "Phone Number")
# Print the masked result
print(result)

You can get the list of default token types and formats in this link.

Result:

{ 
  "data": [ 
    { 
      "value": "(555) 123-4567", 
      "token_value": "(191004182137) 354826618175-127882693655", 
      "token_name": "Numeric Token", 
      "format": "Phone Number" 
    } 
  ], 
  "success": true, 
  "error": { 
    "message": "" 
  } 
} 

For more details, check the link.

Mask JSON Format:

# pass list of sensitive information as an input in the provided JSON Format for the mask method
result = obj.mask({"mask": [{"value": "Ross", "token_name": "Text Token", "format": "Person Name"}]})
# Print the masked result
print(result)

Result:

{ 
  "data": [ 
    { 
      "value": "Ross", 
      "token_value": "EZN792djTe", 
      "token_name": "Text Token", 
      "format": "Person Name" 
    } 
  ], 
  "success": true, 
  "error": { 
    "message": "" 
  } 
} 

For more details, check the link.

Unmask a Token:

This method allows you to retrieve the original data .

Let's take an example. If "George Williams" is masked as "wRePE302Qx vUc7DruuWm," and the user provides the second masked input, "vUc7DruuWm," the unmasked output would be "Williams."

result = obj.unmask(["<PER>wRePE302Qx vUc7DruuWm</PER> is happy","wRePE302Qx vUc7DruuWm","vUc7DruuWm"])
# Print the unmasked result
print(result)

Result:

{
  "data": [
    {
      "token_value": "<PER>wRePE302Qx vUc7DruuWm</PER> is happy",
      "value": "George Washington is happy"
    },
    {
      "token_value": "wRePE302Qx vUc7DruuWm",
      "value": "George Washington"
    },
    {
      "token_value": "vUc7DruuWm",
      "value": "Washington"
    }
  ],
  "success": true,
  "error": {
    "message": ""
  }
}

For more details, check the link.

Asynchronous Methods:

Mask Bulk Data using Async method:

This method allows you to submit mask request and returns a tracking id .The tracking_id can be used to get the status of the request.

# pass list of sensitive information as an input in the provided JSON Format for the async mask method
tracking_id = obj.async_mask({"mask": [{"value": "He lives in the U.S.A"},{"value": "Ram lives in the U.S.A"}]})
# Print the tracking_id
print(tracking_id)

Result:

{
   "data":[
      {
         "tracking_id":"37a6de65-56d7-4da5-97d8-e1ba26b8208102012024045015",
         "status":"PENDING"
      }
   ],
   "success":true,
   "error":{
      "message":""
   }
}

For more details, check the link.

Unmask Bulk Data using Async method:

This method allows you to submit an unmask request and returns a tracking id. The tracking_id can be used to get the status of the request.

# data to be unmasked is passed as a list.
payload = ["mTiygJz7Tf","<PER>mTiygJz7Tf</PER> lives in the <ADDRESS>oQLxg3gisk.G2jPUYZHcv.bHIrJ0Mb7k</ADDRESS>","<PER>9g5Rfz77xv</PER> lives in the <ADDRESS>vzincci4VX.wPMAp7N015.EX52Xgft5m</ADDRESS>"])
tracking_id = obj.async_unmask(payload)
# Print the tracking_id
print(tracking_id)

Result:

{
   "data":[
      {
         "tracking_id":"5fb1f730-9fa2-4dbc-90ae-d839ef5d725e02012024045532",
         "status":"PENDING"
      }
   ],
   "success":true,
   "error":{
      "message":""
   }
}

For more details, check the link.

Get status of Async method:

This method allows you to monitor the status of the async request submitted. The different statuses are : "PENDING", "SUCCESS", "FAILED", "PURGED". If the request's status is "SUCCESS," the result will include the mask/unmask response. Successful mask/unmask requests are automatically purged after 1 hour.

# pass the tracking id as a list to the async method
payload = ["9f178448-fe87-44c1-b2b3-80d6277ca6b028122023141605","5fb1f730-9fa2-4dbc-90ae-d839ef5d725e02012024045532"]
status = obj.async_status(payload)
print(status)

Result:

{
   "data":[
      {
         "tracking_id":"5fb1f730-9fa2-4dbc-90ae-d839ef5d725e02012024045532",
         "call_type":"unmask",
         "input_payload":{
            "unmask":[
               {
                  "token_value":"mTiygJz7Tf"
               },
               {
                  "token_value":"<PER>mTiygJz7Tf</PER> lives in the <ADDRESS>oQLxg3gisk.G2jPUYZHcv.bHIrJ0Mb7k</ADDRESS>"
               },
               {
                  "token_value":"<PER>9g5Rfz77xv</PER> lives in the <ADDRESS>vzincci4VX.wPMAp7N015.EX52Xgft5m</ADDRESS>"
               }
            ]
         },
         "result":[
            {
               "token_value":"mTiygJz7Tf",
               "value":"mTiygJz7Tf"
            },
            {
               "token_value":"<PER>mTiygJz7Tf</PER> lives in the <ADDRESS>oQLxg3gisk.G2jPUYZHcv.bHIrJ0Mb7k</ADDRESS>",
               "value":"mTiygJz7Tf lives in the oQLxg3gisk.G2jPUYZHcv.bHIrJ0Mb7k"
            },
            {
               "token_value":"<PER>9g5Rfz77xv</PER> lives in the <ADDRESS>vzincci4VX.wPMAp7N015.EX52Xgft5m</ADDRESS>",
               "value":"Ram lives in the U.S.A"
            }
         ],
         "error_msg":"None",
         "submitted_time":"2024-01-02 04:55:32",
         "completed_time":"2024-01-02 04:55:34",
         "status":"SUCCESS"
      },
      {
         "tracking_id":"9f178448-fe87-44c1-b2b3-80d6277ca6b028122023141605",
         "call_type":"mask",
         "input_payload":"None",
         "result":"None",
         "error_msg":"None",
         "submitted_time":"2023-12-28 14:16:05",
         "completed_time":"2023-12-28 14:16:13",
         "status":"PURGED"
      }
   ],
   "success":true,
   "error":{
      "message":""
   }
}

For more details, check the link.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

protecto_ai-1.0.2.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

protecto_ai-1.0.2-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file protecto_ai-1.0.2.tar.gz.

File metadata

  • Download URL: protecto_ai-1.0.2.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for protecto_ai-1.0.2.tar.gz
Algorithm Hash digest
SHA256 171d19ae953c87ba00f45c0c9a5269a533511612cb73bdb4df4e5fb688f967e1
MD5 4a0f448ef39727bc60b2aa949a48e95c
BLAKE2b-256 9b68ac2776edddce6e819313568a6af484d31dd8eb02e6d8540ac6c4b1116140

See more details on using hashes here.

File details

Details for the file protecto_ai-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: protecto_ai-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for protecto_ai-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ea47cde9569436f516ab3fcb842eeaaf1744d48175b346da6e231db4b257390b
MD5 f79638c7537cc9a24160063f0a9bbff9
BLAKE2b-256 facd5b7acf737162e461125a53f5f2c402f8f92211b9937d8366025a766cb289

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page