@privapi/client-demo v1.0.1
Welcome to the privapi.io Javascript client!
Privapi.io offers GDPR subject rights request management as a service. Easily receive, process internally and respond to subject rights requests in a secure and compliant manner. Do not spend your valuable developer resources to reinvent the wheel, simply implement our solution instead!
This NPM packages offers Javascript based client applications a library to connect to the privapi.io servers, have the client generate requests, check for responses and .
Visit privapi.io to find out more.
Installation and usage
Install the package
Install via NPM:
npm install privapi.io/client
What is happening under the hood
You can rename the current file by clicking the file name in the navigation bar or by clicking the Rename button in the file explorer.
Initialisation
Import the package, create a new object with your api authentication credentials, then fire a new request.
import PrivapiClient from 'privapi.io/client';
const apiKeyId = ""; // Your privapi.io ApiKeyId
const apiKeySecret = ""; // Your privapi.io ApiKeySecret
const pc = new PrivapiClient(apiKeyId, apiKeySecret);
Note: The parameters ApiKeyId and ApiKeySecret can be obtained from your privapi.io account.
Create a new Request
PrivapiClient offers the createEncryptedRequest method:
Promise createEncryptedRequest( endpointReference, requestType, products, origin)
Parameters: endpointReference(string): a reference to the end user, will be used to find the user in your database (e.g. user Id) requestType(string): references the type of the request being generated |string |description | |--|--| |'0'| Information Request | |'1' | Data Portability | |'2' | Restriction of Processing | |'3' | Objection to processing | |'4' | Rectification Request | |'5' | Erasure Request |
products(string): an array of strings with the product Ids as configured for your privapi.io client origin(string): references an origin for a request as set up for your privapi.io client
Fetch result of requests initiated before
Example
pc.createEncryptedRequest(
"11111"
"1",
"60b0e77c09a059001beac1ee",
"Demo App"
)
.then((result) => {
console.log("Request created successfully: ", result);
})
.catch((error) => {
console.log(error);
});
Return value
You can export the current file by clicking Export to disk in the menu. You can choose to export the file as plain Markdown, as HTML using a Handlebars template or as a PDF.
IMPORTANT
- Store the returned object, as this data is required to fetch the request's status and pick up responses.
- Store the returned object returned safely. It must not be accessible by 3rd partiers (e.g. other aps on a user's phone).
- Remember: anyone with access to this returned data will be able to access responses incl. file attachments. This data most likely includes personal identifiable information (PII), that is supposed to be protected under GDPR..