# Consent String Examples

This page contains samples of different consent strings that can be generated as part of the binary Didomi Consent String format under different scenarios.

```
Didomi Consent String := Sections~Signature |												 Sections.DID~Signature |
                         Sections.DID.OUID~Signature |
                         Sections..OUID~Signature
```

### Example #1: Consent String with DID, OUID, and Signature <a href="#pdf-page-fbiptzopaojxsxuserld-example-1-consent-string-with-did-ouid-and-signature" id="pdf-page-fbiptzopaojxsxuserld-example-1-consent-string-with-did-ouid-and-signature"></a>

Given `Header, Purpose Consent, Purpose Legitimate Interest, Vendors Consent` and `Vendors Legitimate Interest` sections bit encoded in the first segment:

```
BGHWv4UYba5-dZnABdKu__D6iWHsD6iWHsCABFKVEACKUqgAAERY4AABEWMA
```

After the first `.` there is a Device ID (DID):

```
AQAACAFkVONkgUIavQPm
```

and after the second `.` there is an Organization User ID (OUID):

```
XF229L4wQrauAgOe/AGP0SP7fa7bclNhB0
```

and finally, the last segment after the `~` is the signature:

```
CAISHAgCEhJnd3NfMjAyMzA0MDYtMF9SQzEaAmVuIAEaBgiAo82hBg
```

Putting this all together, the final consent string would look like:

```
BGHWv4UYba5-dZnABdKu__D6iWHsD6iWHsCABFKVEACKUqgAAERY4AABEWMA.AQAACAFkVONkgUIavQPm.XF229L4wQrauAgOe/AGP0SP7fa7bclNhB0~CAISHAgCEhJnd3NfMjAyMzA0MDYtMF9SQzEaAmVuIAEaBgiAo82hBg
```

### Example #2: Consent String with only DID and Signature <a href="#pdf-page-fbiptzopaojxsxuserld-example-2-consent-string-with-only-did-and-signature" id="pdf-page-fbiptzopaojxsxuserld-example-2-consent-string-with-only-did-and-signature"></a>

Given `Header, Purpose Consent, Purpose Legitimat Interest, Vendors Consent` and `Vendors Legitimate Interest` sections bit encoded in the first segment:

```
BGHWv4UYba5-dZnABdKu__D6iWHsD6iWHsCABFKVEACKUqgAAERY4AABEWMA
```

After the first `.` there is a Device ID (DID):

```
AQAACAFkVONkgUIavQPm
```

and finally, having no OUID, the last segment after the `~` is the signature:

```
CAISHAgCEhJnd3NfMjAyMzA0MDYtMF9SQzEaAmVuIAEaBgiAo82hBg
```

Putting this all together, the final consent string would look like:

```
BGHWv4UYba5-dZnABdKu__D6iWHsD6iWHsCABFKVEACKUqgAAERY4AABEWMA.AQAACAFkVONkgUIavQPm~CAISHAgCEhJnd3NfMjAyMzA0MDYtMF9SQzEaAmVuIAEaBgiAo82hBg
```

### Example #3: Consent String with only OUID and Signature <a href="#pdf-page-fbiptzopaojxsxuserld-example-3-consent-string-with-only-ouid-and-signature" id="pdf-page-fbiptzopaojxsxuserld-example-3-consent-string-with-only-ouid-and-signature"></a>

Given `Header, Purpose Consent, Purpose Legitimat Interest, Vendors Consent` and `Vendors Legitimate Interest` sections bit encoded in the first segment:

```
BGHWv4UYba5-dZnABdKu__D6iWHsD6iWHsCABFKVEACKUqgAAERY4AABEWMA
```

Even though we don’t have a DID, we still store a first `.` as a placeholder to represent a nullable optional DID here, which will contain no information. We will then add a second `.` characterm indicating that there is an Organization User ID (OUID):

```
XF229L4wQrauAgOe/AGP0SP7fa7bclNhB0
```

and finally, the last segment after the `~` is the signature:

```
CAISHAgCEhJnd3NfMjAyMzA0MDYtMF9SQzEaAmVuIAEaBgiAo82hBg
```

Putting this all together, the final consent string would look like:

```
BGHWv4UYba5-dZnABdKu__D6iWHsD6iWHsCABFKVEACKUqgAAERY4AABEWMA..XF229L4wQrauAgOe/AGP0SP7fa7bclNhB0~CAISHAgCEhJnd3NfMjAyMzA0MDYtMF9SQzEaAmVuIAEaBgiAo82hBg
```

### Example #4: Consent String with no IDs, only Signature <a href="#pdf-page-fbiptzopaojxsxuserld-example-4-consent-string-with-no-ids-only-signature" id="pdf-page-fbiptzopaojxsxuserld-example-4-consent-string-with-no-ids-only-signature"></a>

Given `Header, Purpose Consent, Purpose Legitimat Interest, Vendors Consent` and `Vendors Legitimate Interest` sections bit encoded in the first segment:

```
BGHWv4UYba5-dZnABdKu__D6iWHsD6iWHsCABFKVEACKUqgAAERY4AABEWMA
```

Since we have neither a DID nor an OUID, we will not store any `.` placeholders. We will directly add the final segment after the `~` which is the signature:

```
CAISHAgCEhJnd3NfMjAyMzA0MDYtMF9SQzEaAmVuIAEaBgiAo82hBg
```

Putting this all together, the final consent string would look like:

```
BGHWv4UYba5-dZnABdKu__D6iWHsD6iWHsCABFKVEACKUqgAAERY4AABEWMA~CAISHAgCEhJnd3NfMjAyMzA0MDYtMF9SQzEaAmVuIAEaBgiAo82hBg
```

### Example #5 - Decoded Consent String <a href="#pdf-page-fbiptzopaojxsxuserld-example-5-decoded-consent-string" id="pdf-page-fbiptzopaojxsxuserld-example-5-decoded-consent-string"></a>

```
const expectedUserStatus = {
   user_id: '1875afe1-461b-6b9f-9d66-700174abbffc',
   created: new Date('2023-04-12T18:10:00.000Z'),
   updated: new Date('2023-04-12T18:10:00.000Z'),
   sync: new Date('2023-05-24T18:10:00.000Z'),
   vendors: {
     enabled: [128, 129, 130, 131, 132],
     disabled: [],
   },
   purposes: {
     enabled: [1, 2, 6, 7, 8],
     disabled: [3, 4],
   },
   vendors_li: {
     enabled: [128, 129, 130, 131, 132],
     disabled: [],
   },
   purposes_li: {
     enabled: [1, 2, 6, 7, 8],
     disabled: [3, 4],
   },
};
```

### Final Encoding Example <a href="#pdf-page-fbiptzopaojxsxuserld-final-encoding-example" id="pdf-page-fbiptzopaojxsxuserld-final-encoding-example"></a>

When stored or transmitted, the Consent String binary format is encoded as web-safe base64 with the following character set:

```
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_
```
