v3.0
Privacy SDK

Code Quickstart

Identities and Identifiers

The ADARA Privacy SDK accepts PII for an individual and transforms it into a privacy-safe set of tokens. Tokens, by themselves, are intentionally useless; they are useful only when maintained as a set of tokens pointing to an individual user. The classes within the this reflect this by using a set of Identifiers that belong to an Identity:

Python
Copy

An identity can have any number of identifiers; one or more tokens will be produced for each identifier you pass (based on your common salt configurations). Each identifier is associated with an identifier type, which can correspond to a specific tokenization algorithm used for that type.

The ADARA Privacy SDK supports the following identifiers out of the box:

Type ValueDescriptionArgument Keywords
cookiePersistent cookie identifiersingle: cookie
customer_idInternal customer IDsingle: customer_id
drivers_licenseState-issued driver's license numbersingle: drivers_license
emailClear text email addresssingle: email
hashed_emailHashed email addresssingle: hashed_email
membership_idMembership / loyalty IDsingle: single: membership_id
passportPassport numbersingle: passport
social_securitySocial security numbersingle: social_security
state_idOther state IDsingle: state_id
streetname_zipcodeStreet name and zip codecomposite: street_name, zip_code

You may also extend the ADARA Privacy SDK with identifier types of your own.

Tokens

Each Identifier can be turned into tokens. The tokens are generated using the private salt and one or more common salts defined in your local configuration. Using these salts and some standard hashing algorithms, the ADARA Privacy SDK turns the raw PII from the identifier into a private token and one or more common tokens. The type of identifier (example: email or driver license number) is also returned with the token, as well as an optional label.

You can see the tokens for an Identity by invoking the to_tokens() method:

Python
Copy

For the first example above, this yields the following output (or something similar, based on your client salt):

Python
Copy

Package Tokens

The ADARA Privacy SDK returns tokens for each identifier and salt combination. For a given Identity instance, this can result in a large number of individual tokens, which is not necessarily convenient for storing alongside your data. To solve this issue, each tokenization result contains a package token. This is a private token derived from all the identifiers within an identity.

The package token is at least as good as the best identifier token within the result. To store a single token to reference the identity, use the package token.

Labels

Labeling your identifiers helps minimize confusion when managing large numbers of identifiers, especially if you have more than one identifier of the same type.

To label an identifier, simply use the label option when invoking the call:

Python
Copy

This yields the following output:

Python
Copy

Labels can be any string, so you can use something like a UUID to track tokens programmatically.

Cherry Picking Common Tokens

Generally, ADARA recommends including all the salts you may want to use for token creation in the configuration file. Alternately, in cases where you want to submit identity data to some identity graphs, while omitting it from others, you can cherry-pick a subset of common tokens for a subset of consortiums.

To limit token results for any identifier to only a subset of your defined common salts, use the common_tokens keyword argument in the Identifier instantiation:

Python
Copy

This yields the following output:

Python
Copy

Sending Data to ADARA

To send your tokens to the ADARA Privacy API, use the AdaraPrivacyApiStreamer class.

You'll need to specify several of the optional settings in the configuration file for this.

Contact ADARA's provisioning team to set up a configuration file to send your privacy tokens to the ADARA Privacy API. ADARA will provide the client secrets, pipeline IDs, API endpoints, etc. to match your use case.

The following sample code loops over the tokens stored in a file and sends them to the ADARA Privacy API:

Python
Copy