Privacy

Privacy~ Privacy

Class representing the Privacy SDK for IBM Security Verify. Used to perform privacy assessment for attributes being requested and metadata required to build consent experiences.

Constructor

new Privacy(config, auth, context)

Create a new Privacy object.

Parameters:
Name Type Description
config Object

Global configuration for the SDK

Properties
Name Type Description
tenantUrl string

The Verify tenant hostname, including the protocol.

auth Object

Auth object contains property values to authorize requests to Verify

Properties
Name Type Description
accessToken string

The OAuth 2.0 token used to authorize requests. If the access token is generated using a privileged API client (as opposed to one generated on a user authentication flow), the context.subjectId is required.

context Object

Context object contains Privacy SDK specific context

Properties
Name Type Description
subjectId string

The user/subject identifier that may be a Verify user identifier.

isExternalSubject boolean

Indicates if the subject is known to Verify.

ipAddress string

The IP address of the user agent. If this library is used in a backend system, this IP should be obtained from the request headers that contain the actual user agent IP address.

Author:
  • Vivek Shankar
Source:
Example
const Privacy = require('verify-privacy-sdk-js');
const client = new Privacy({
  "tenantUrl": "https://abc.verify.ibm.com"
}, {
  "accessToken": "lasfjsdlfjsldjfglsdjfglsjl"
}, {
  "ipAddress": "1.2.3.4"
});

Members

ConsentDisplayTypes

Enumeration of different possible consent display types

Properties:
Name Type Description
DO_NOT_SHOW ConsentDisplayTypesEnum
TRANSPARENT ConsentDisplayTypesEnum
OPTIN_OR_OUT ConsentDisplayTypesEnum
ALLOW_OR_DENY ConsentDisplayTypesEnum
Source:

ConsentTypes

Enumeration of different possible consent types

Properties:
Name Type Description
ALLOW ConsentTypesEnum
DENY ConsentTypesEnum
OPTIN ConsentTypesEnum
OPTOUT ConsentTypesEnum
TRANSPARENT ConsentTypesEnum
Source:

Methods

(async) assess(items) → {Promise.<WrappedAssessment>}

Evaluate the attributes requested for approval.

Request the consent management system to approve the use of attributes for the specified purpose, access type and an optional value. If the access type is not specified, it is set to a system default.

Parameters:
Name Type Description
items Array

The data items that require approval for use

Properties
Name Type Description
purposeId string

The purpose ID representing the privacy purpose configured on Verify. If you are checking for the consent status of EULA, use the EULA identifier here.

profileId string

The Privacy profile ID configured on Verify. If provided, other fields are ignored and assessment is performed using this identifier.

accessTypeId string

The access type ID representing the available access types on Verify. This must be one of the access types selected for the purpose.

attributeId string

The attribute ID on Verify. This must be configured as one of the attributes for the purpose. This may be optional if no attributes are configured for the purpose. If this is empty and the purpose has associated attributes, all attributes are assessed and the decision is included in the result array.

attributeValue string

The attribute value for the attribute. This is typically used when the user has more than one value for the attribute. This is optional.

Returns:
Type Description
Promise.<WrappedAssessment>

The status of the assessment and additional details

Source:
Example
let r = await client.assess([
  {
    // allow mobile number for marketing
    "purposeId": "marketing",
    "attributeId": "mobile_number",
    "accessTypeId": "default"
  },
  {
    // default end user license agreement
    "purposeId": "defaultEULA",
  },
  {
    // Privacy profile identifier
    "profileId": "gdprprofile",
  }
])

if (r.status == "consent") {
  // redirect for consent or build the page here
  // and render. consider filtering out items
  // in the assessment that are not approved because
  // of a rule violation
} else if (r.status == "approved") {
  // the world is your oyster. go forth and conquer
} else {
  // examine the assessment and show an appropriate error
}

(async) getConsentMetadata(items, headers) → {Promise.<WrappedMetadata>}

Get consent metadata that can be used to build the consent page presented to the data subject/user, including the current state of consent.

Parameters:
Name Type Description
items Array

The data items that require approval for use

Properties
Name Type Description
purposeId string

The purpose ID representing the privacy purpose configured on Verify. If you are checking for the consent status of EULA, use the EULA identifier here.

accessTypeId string

The access type ID representing the available access types on Verify. This must be one of the access types selected for the purpose. If this is not provided in the input, it is defaulted to 'default'. Wildcards are not allowed.

attributeId string

The attribute ID on Verify. This must be configured as one of the attributes for the purpose. This may be optional if no attributes are configured for the purpose. Wildcards are not allowed.

attributeValue string

The attribute value for the attribute. This is typically used when the user has more than one value for the attribute. This is optional.

headers Object

Optional headers that can be sent

Properties
Name Type Description
Accept-Language string

The locale of content to receive in the response.

Returns:
Type Description
Promise.<WrappedMetadata>

The status of the request and any consent metadata

Source:
Example
let r = await client.getConsentMetadata([
  {
    // allow mobile number for marketing
    "purposeId": "marketing",
    "attributeId": "mobile_number",
    "accessTypeId": "default"
  },
  {
    // default end user license agreement
    "purposeId": "defaultEULA",
  }
])

if (r.status == "done") {
  // render the page based on the r.metadata
}

(async) getUserConsents(options) → {Promise.<WrappedGetUserConsents>}

Fetches user consents.

Parameters:
Name Type Description
options Object

An optional parameter object

Properties
Name Type Description
filterByCurrentApplication boolean

If set to true, filters consentsby the application id present in the authentication token

Returns:
Type Description
Promise.<WrappedGetUserConsents>
Source:
Example
let r = await client.getUserConsents()
if (r.status == "done") {
  // render the page based on the r.consents
}

(async) storeConsents(consents) → {Promise.<WrappedStoreUserConsents>}

Store consents for the user.

Consents may only be created typically, except if the consent end time needs to be updated. Only 10 consent operations are allowed at a time.

Parameters:
Name Type Description
consents Array.<Consent>

The full consent records that need to be created or updated

Returns:
Type Description
Promise.<WrappedStoreUserConsents>

Consent operation response

Source:
Example
let r = await client.storeConsents([
  {
    "purposeId": "marketing",
    "attributeId": "mobile_number",
    "state": 3 // opt-in
  }
])

if (r.status == "success") {
  // Warp 11... engage
} else {
  // loop through the r.results to determine what failed and why
}