Skip to content

Commit 862b98d

Browse files
committed
Merge branch 'main' into fix/ja-calendar-gregorian
2 parents bee5715 + f3fc69a commit 862b98d

File tree

5 files changed

+1870
-1140
lines changed

5 files changed

+1870
-1140
lines changed

docs/getting-started/gs-normalization-encoding.md

Lines changed: 69 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,21 @@ For examples of various scenarios, see [Normalization Examples for Email](#norma
5858

5959
An email hash is a Base64-encoded <Link href="../ref-info/glossary-uid#gl-sha-256">SHA-256</Link> hash of a normalized email address. The email address is first normalized, then hashed using the SHA-256 hashing algorithm, and then the resulting bytes of the hash value are encoded using Base64 encoding. Note that the Base64 encoding is applied to the bytes of the hash value, not the hex-encoded string representation.
6060

61+
The following table shows an example of a simple input email address, and the result as each step is applied to arrive at a secure, opaque value.
62+
63+
The final value, the hex to Base64 encoded representation of the SHA-256 hash, is the value to provide to the UID2 Operator endpoint.
64+
65+
:::warning
66+
When applying Base64 encoding, be sure to Base64-encode the raw bytes of the hash or use a Base64 encoder that takes a hex-encoded value as input. If you use a function that takes text as input, the result is a longer string which is invalid for the purposes of UID2.
67+
:::
68+
6169
| Type | Example | Comments and Usage |
6270
| :--- | :--- | :--- |
6371
| Raw email address | `[email protected]` | N/A |
6472
| Normalized email address | `[email protected]` | Normalization is always the first step. |
6573
| SHA-256 hash of normalized email address | `b4c9a289323b21a01c3e940f150eb9b8c542587f1abfd8f0e1cc1ffc5e475514` | This 64-character string is a hex-encoded representation of the 32-byte SHA-256. |
6674
| Hex to Base64 encoding of SHA-256 hash | `tMmiiTI7IaAcPpQPFQ65uMVCWH8av9jw4cwf/F5HVRQ=` | This 44-character string is a Base64-encoded representation of the 32-byte SHA-256.<br/>WARNING: The SHA-256 hash string in the example above is a hex-encoded representation of the hash value. You must Base64-encode the raw bytes of the hash or use a Base64 encoder that takes a hex-encoded value as input.<br/>Use this encoding for `email_hash` values sent in the request body. |
6775

68-
:::important
69-
When applying Base64 encoding, be sure to Base64-encode the raw bytes of the hash or use a Base64 encoder that takes a hex-encoded value as input.
70-
:::
71-
7276
For additional examples, see [Normalization Examples for Email](#normalization-examples-for-email).
7377

7478
## Normalization Examples for Email
@@ -77,14 +81,44 @@ The following table shows examples of original email addresses and the normalize
7781

7882
Some of the examples show email addresses that include the plus sign (+), with different domains. For `gmail` addresses, the plus sign and following characters, up to the `@` sign, are ignored in normalization. For other domains, these characters are included in the normalized value.
7983

80-
| Original Value | Normalized | Hashed and Base64-Encoded |
81-
| :--- | :--- | :--- |
82-
| `[email protected]`<br/>`[email protected]` | `[email protected]` | Hashed: `16c18d336f0b250f0e2d907452ceb9658a74ecdae8bc94864c23122a72cc27a5`<br/>Base64-Encoded: `FsGNM28LJQ8OLZB0Us65ZYp07NrovJSGTCMSKnLMJ6U=` |
83-
| `[email protected]` | `[email protected]` | Hashed: `e22b53bc6f871274f3a62ab37a3caed7214fc14d676215a96a242fcfada1c81f`<br/>Base64-Encoded: `4itTvG+HEnTzpiqzejyu1yFPwU1nYhWpaiQvz62hyB8=` |
84-
| `[email protected]`<br/>`[email protected]` | `[email protected]` | Hashed: `d6670e7a92007f1b5ff785f1fc81e53aa6d3d7bd06bdf5c473cdc7286c284b6d`<br/>Base64-Encoded: `1mcOepIAfxtf94Xx/IHlOqbT170GvfXEc83HKGwoS20=` |
85-
| `[email protected]`<br/>`[email protected]` | `[email protected]` | Hashed: ` b196432c7b989a2ca91c83799957c515da53e6c13abf20b78fea94f117e90bf8`<br/>Base64-Encoded: `sZZDLHuYmiypHIN5mVfFFdpT5sE6vyC3j+qU8RfpC/g=` |
86-
| `[email protected]` | `[email protected]` | Hashed: `28aaee4815230cd3b4ebd88c515226550666e91ac019929e3adac3f66c288180`<br/>Base64-Encoded: `KKruSBUjDNO069iMUVImVQZm6RrAGZKeOtrD9mwogYA=` |
87-
| `[email protected]`<br/>`[email protected]`<br/>`[email protected]` | `[email protected]` | Hashed: `92ee26057ed9dea2535d6c8b141d48373932476599196e00352254896db5888f`<br/>Base64-Encoded: `ku4mBX7Z3qJTXWyLFB1INzkyR2WZGW4ANSJUiW21iI8=` |
84+
:::important
85+
In working with your own UID2s, always provide the final value, the Base64-encoded value, to the UID2 Operator endpoint.
86+
:::
87+
88+
<table>
89+
<thead>
90+
<tr>
91+
<th>Original Value</th>
92+
<th>Processing Steps and Resulting Values</th>
93+
</tr>
94+
</thead>
95+
<tbody>
96+
<tr>
97+
98+
<td>1. Normalize: `[email protected]`<br/>2. Hash: `16c18d336f0b250f0e2d907452ceb9658a74ecdae8bc94864c23122a72cc27a5`<br/>3. Base64-Encode: `FsGNM28LJQ8OLZB0Us65ZYp07NrovJSGTCMSKnLMJ6U=`</td>
99+
</tr>
100+
<tr>
101+
<td>`[email protected]`</td>
102+
<td>1. Normalize: `[email protected]`<br/>2. Hash: `e22b53bc6f871274f3a62ab37a3caed7214fc14d676215a96a242fcfada1c81f`<br/>3. Base64-Encode: `4itTvG+HEnTzpiqzejyu1yFPwU1nYhWpaiQvz62hyB8=`</td>
103+
</tr>
104+
<tr>
105+
106+
<td>1. Normalize: `[email protected]`<br/>2. Hash: `d6670e7a92007f1b5ff785f1fc81e53aa6d3d7bd06bdf5c473cdc7286c284b6d`<br/>3. Base64-Encode: `1mcOepIAfxtf94Xx/IHlOqbT170GvfXEc83HKGwoS20=`</td>
107+
</tr>
108+
<tr>
109+
110+
<td>1. Normalize: `[email protected]`<br/>2. Hash: `b196432c7b989a2ca91c83799957c515da53e6c13abf20b78fea94f117e90bf8`<br/>3. Base64-Encode: `sZZDLHuYmiypHIN5mVfFFdpT5sE6vyC3j+qU8RfpC/g=`</td>
111+
</tr>
112+
<tr>
113+
<td>`[email protected]`</td>
114+
<td>1. Normalize: `[email protected]`<br/>2. Hash: `28aaee4815230cd3b4ebd88c515226550666e91ac019929e3adac3f66c288180`<br/>3. Base64-Encode: `KKruSBUjDNO069iMUVImVQZm6RrAGZKeOtrD9mwogYA=`</td>
115+
</tr>
116+
<tr>
117+
118+
<td>1. Normalize: `[email protected]`<br/>2. Hash: `92ee26057ed9dea2535d6c8b141d48373932476599196e00352254896db5888f`<br/>3. Base64-Encode: `ku4mBX7Z3qJTXWyLFB1INzkyR2WZGW4ANSJUiW21iI8=`</td>
119+
</tr>
120+
</tbody>
121+
</table>
88122

89123
## Phone Number Normalization
90124

@@ -111,7 +145,13 @@ Make sure that the normalized phone number is UTF-8, not another encoding system
111145

112146
A phone number hash is a Base64-encoded SHA-256 hash of a normalized phone number. The phone number is first normalized, then hashed using the SHA-256 hashing algorithm, and then the resulting bytes of the hash value are encoded using Base64 encoding. Note that the Base64 encoding is applied to the bytes of the hash value, not the hex-encoded string representation.
113147

114-
The following table shows an example of a simple input phone number, and the result as each step is applied to arrive at a secure, opaque, URL-safe value.
148+
The following table shows an example of a simple input phone number, and the result as each step is applied to arrive at a secure, opaque value.
149+
150+
The final value, the hex to Base64 encoded representation of the SHA-256 hash, is the value to provide to the UID2 Operator endpoint.
151+
152+
:::warning
153+
When applying Base64 encoding, be sure to use a function that takes a hex value as input. If you use a function that takes text as input, the result is a longer string which is invalid for the purposes of UID2.
154+
:::
115155

116156
| Type | Example | Comments and Usage |
117157
| :--- | :--- | :--- |
@@ -120,10 +160,6 @@ The following table shows an example of a simple input phone number, and the res
120160
| SHA-256 hash of normalized phone number | `10e6f0b47054a83359477dcb35231db6de5c69fb1816e1a6b98e192de9e5b9ee` |This 64-character string is a hex-encoded representation of the 32-byte SHA-256. |
121161
| Hex to Base64 encoding of SHA-256 hash | `EObwtHBUqDNZR33LNSMdtt5cafsYFuGmuY4ZLenlue4=` | This 44-character string is a Base64-encoded representation of the 32-byte SHA-256.<br/>NOTE: The SHA-256 hash is a hexadecimal value. You must use a Base64 encoder that takes a hex value as input. Use this encoding for `phone_hash` values sent in the request body. |
122162

123-
:::warning
124-
When applying Base64 encoding, be sure to use a function that takes a hex value as input. If you use a function that takes text as input, the result is a longer string which is invalid for the purposes of UID2.
125-
:::
126-
127163
## Example Code
128164

129165
For an example of how to generate email and phone hashes in JavaScript, see [Example Code: Hashing and Base-64 Encoding](../guides/integration-javascript-client-side#example-code-hashing-and-base-64-encoding).
@@ -151,3 +187,19 @@ The tool does the following:
151187
If the input data doesn't have a valid email or phone number format, or if the phone number is not normalized, the tool gives an error.
152188

153189
You can use this tool to verify that your internal processes are set up to correctly create normalized, hashed, and encoded values for UID2.
190+
191+
## Troubleshooting
192+
193+
In all scenarios, follow the steps on your side to prepare your DII for processing, and then check your resulting values by using the [UID2 Hashing Tool](#uid2-hashing-tool). If the results don't match, check each step to find the error.
194+
195+
If you're having trouble or getting errors, or even if you just want to be sure you're following the steps correctly, here are some things you can check:
196+
197+
- **Phone numbers**: Make sure you're normalizing&#8212;and normalizing correctly&#8212;as the first step.
198+
199+
The service normalizes emails, but it can't normalize phone numbers. For example, it can't determine the value for a missing country code. Use these resources:
200+
- Instructions: [Phone Number Normalization](#phone-number-normalization).
201+
- Tool for cross-checking: [UID2 Hashing Tool](#uid2-hashing-tool).
202+
203+
- **Use the Base64-encoded value**: The process includes normalizing, then hashing, then Base64-encoding the bytes of the hash value. When generating UID2s, the input is the Base64-encoded value. Make sure you're using this 44-character string value.
204+
205+
- You might see the following error message: "The hashing value must be 44 characters." In this scenario, there is an error with the hashing function you're using. Use the hex to Base64 encoding of the SHA-256 hash. For details, see [Email Address Hash Encoding](#email-address-hash-encoding) or [Phone Number Hash Encoding](#phone-number-hash-encoding). To cross-check, test using the [UID2 Hashing Tool](#uid2-hashing-tool).

docs/guides/integration-javascript-client-side.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@ To configure the SDK, call one of the following methods, with an object containi
175175
* `__uid2.setIdentityFromPhone`
176176
* `__uid2.setIdentityFromPhoneHash`
177177

178+
:::important
179+
For `__uid2.setIdentityFromEmailHash` or `__uid2.setIdentityFromPhoneHash`, the `emailHash` or `PhoneHash` argument must be the Base64-encoded value. For details, see [Email Address Hash Encoding](../getting-started/gs-normalization-encoding.md/#email-address-hash-encoding) and [Phone Number Hash Encoding](../getting-started/gs-normalization-encoding.md#phone-number-hash-encoding).
180+
:::
181+
178182
The following sections include coding examples for each scenario.
179183

180184
Once it's configured, the UID2 SDK takes care of the following:

0 commit comments

Comments
 (0)