Skip to content

Commit 8ad3e19

Browse files
committed
add sharer usage to readme
1 parent 7b4a005 commit 8ad3e19

File tree

1 file changed

+51
-12
lines changed

1 file changed

+51
-12
lines changed

README.md

Lines changed: 51 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,36 @@
22

33
The UID 2 Project is subject to Tech Lab IPR’s Policy and is managed by the IAB Tech Lab Addressability Working Group and Privacy & Rearc Commit Group. Please review [the governance rules](https://github.com/IABTechLab/uid2-core/blob/master/Software%20Development%20and%20Release%20Procedures.md).
44

5-
This SDK simplifies integration with UID2 for those using Python.
5+
This document includes:
6+
* [Who Is this SDK for?](#who-is-this-sdk-for)
7+
* [Requirements](#requirements)
8+
* [Install](#install)
9+
* [Usage for DSPs](#usage-for-dsps)
10+
* [Usage for UID2 Sharers](#usage-for-uid2-sharers)
11+
* [Development](#development)
12+
* [Example Usage](#example-usage)
613

7-
## Dependencies
14+
## Who Is this SDK for?
15+
16+
This SDK simplifies integration with UID2 for DSPs and UID Sharers, as described in [UID2 Integration Guides](https://unifiedid.com/docs/category/integration-guides).
17+
18+
## Requirements
819

920
This SDK supports Python 3.6 and above.
1021

11-
## Quick Start
22+
## Install
1223

13-
Connect to the UID2 service, refresh the encryption keys, and then use the keys to decrypt an advertising token, to arrive at the corresponding advertising ID:
24+
The SDK can be installed using pip.
25+
```
26+
pip install uid2-client
27+
```
28+
29+
## Usage for DSPs
1430

31+
Connect to the UID2 service, refresh the encryption keys, and then use the keys to decrypt an advertising token, to arrive at the corresponding advertising ID:
32+
For examples of usage for DSPs, see [sample_client.py](examples/sample_client.py) and [sample_auto_refresh.py](examples/sample_auto_refresh.py)
1533
```
16-
from uid2_client import Uid2Client, decrypt
34+
from uid2_client import Uid2ClientFactory
1735
1836
# for UID2 (for EUID use EuidClientFactory)
1937
client = Uid2ClientFactory.create('https://prod.uidapi.com', 'my-auth-token', 'my-secret-key')
@@ -23,12 +41,33 @@ decrypted_token = client.decrypt(advertising_token)
2341
print(decrypted_token.uid2)
2442
```
2543

26-
Additional examples are in the [examples] directory:
27-
* [sample_auto_refresh.py](examples/sample_auto_refresh.py)
28-
* [sample_client.py](examples/sample_client.py)
29-
* Example for DSPs (decryption of tokens)
30-
* [sample_sharing.py](examples/sample_sharing.py)
31-
* Example for Sharers (decryption/encryption of tokens/uids)
44+
## Usage for Sharers
45+
46+
A UID2 sharer is a participant that wants to share UID2s or EUIDs with another participant. Raw UID2s must be encrypted into UID2 tokens before sending them to another participant.
47+
For examples of usage, see [sample_sharing.py](examples/sample_sharing.py) and [sample_auto_refresh.py](examples/sample_auto_refresh.py)
48+
49+
```
50+
from uid2_client import Uid2ClientFactory
51+
52+
# for UID2 (for EUID use EuidClientFactory)
53+
client = Uid2ClientFactory.create('https://prod.uidapi.com', 'my-auth-token', 'my-secret-key')
54+
client.refresh_keys()
55+
```
56+
Senders:
57+
58+
1. Call the following:
59+
```
60+
encrypted = client.encrypt(raw_uid)
61+
```
62+
2. If encryption was successful, send the token `encrypted.uid2` to the receiver.
63+
64+
Receivers:
65+
66+
1. Call the following:
67+
```
68+
decrypted = client.decrypt(uid_token)
69+
```
70+
2. If decryption was successful, use the token `decrypted.uid2`.
3271

3372
## Development
3473

@@ -56,7 +95,7 @@ Get access to an interactive shell within the Python 3.6 Docker image:
5695
make shell
5796
```
5897

59-
## Example Usage
98+
### Example Usage
6099

61100
To run all the example applications:
62101

0 commit comments

Comments
 (0)