npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ibm-verify/privacy

v1.0.2

Published

Data Privacy and Consent Management SDK

Downloads

2

Readme

IBM Security Verify Privacy SDK for Javascript

Fast, opinionated, simple privacy SDK for Node that leverages the data privacy & consent engine on IBM Security Verify.


const Privacy = require('@ibm-verify/privacy');

// tenant information and other global config
const config = { tenantUrl: "https://abc.verify.ibm.com" };
// access token generated using any OAuth client library
const auth = { accessToken: getToken() };
// optional context
const context = { "ipAddress": "1.2.3.4" };

const privacy = new Privacy(config, auth, context);

// determine items that need assessment
let items = [
    {
        "purposeId": "marketing",
        "attributeId": "mobile_number",
        "accessTypeId": "default"
    }
];

doAssess = async (req, res) => {
  // assess if the item can be used
  let decision = await privacy.assess(items);
  if (decision.status == "consent") {
    // metadata used to render a user consent page
    let r = await privacy.getConsentMetadata(items);
    res.render('consent', { metadata: r.metadata });
  }
  // handle other cases
}

storeConsents = async (req, res) => {
  // assuming the request.body is a JSON array of 
  // consent records that need to be stored
  let r = await privacy.storeConsents(req.body);
  if (r.status == "success") {
    // done. Respond accordingly
  } else if (r.status == "fail") {
    // something didn't save. For example - an attempt was made to store a consent
    // for an attribute that isn't linked to a purpose on Verify.
    // Render an appropriate error code to the user.
  }
}

Prerequisites

  • Sign up for your IBM Security Verify Tenant.
  • If you are not using an OAuth/OIDC application to get a user/delegated token, obtain a privileged access token by configuring an API client with the following entitlements.
    • Check for data usage approval to assess the usage of requested data items
    • Retrieve privacy purposes and associated user's consent to present a complete user consent experience
    • Create privacy consent records to record consents
    • Read privacy consents to get the user's consents
  • Identify attributes you intend to use in your application that require assessment
  • Identify purpose-of-use for those attributes

Installation

Use npm to install the SDK:

$ npm install @ibm-verify/privacy

Features

  • Integrate with the Verify data privacy engine using APIs
  • Insert privacy assessment and consent at any point in your application flow. Privacy & compliance regulations are configured centrally on the Verify tenant
  • Build pleasing experiences for user consent and preferences using the simplified object returned by the getConsentMetadata function

Documentation

Tests

Before running the tests, the Verify tenant must be configured with the following:

  • Purpose with ID marketing
  • Purpose marketing must be configured with two attributes - mobile_number and email
  • Purpose marketing must be configured with the default access type

The test environment must be setup as below:

  1. In the directory where this Git repository is cloned, run:
$ npm install
  1. Copy ./test/dotenv to ./test/.env
  2. Use any OIDC application configured on the Verify tenant to generate an OAuth token. This would be associated with the user account used to login to the application.

Now you can run the test by executing:

$ npm test

If you want to see debug logs, run:

$ npm run testdebug