Skip to content

Commit 73af45d

Browse files
remove more comments in server.js
1 parent f5505bd commit 73af45d

File tree

1 file changed

+0
-4
lines changed
  • web-integrations/prebid-integrations/client-server

1 file changed

+0
-4
lines changed

web-integrations/prebid-integrations/client-server/server.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,20 @@ function base64ToBuffer(base64) {
3838
return Buffer.from(base64, 'base64');
3939
}
4040

41-
// Encrypts data using AES-256-GCM
4241
function encryptRequest(message, base64Key) {
4342
const iv = crypto.randomBytes(ivLength);
4443
const cipher = crypto.createCipheriv(encryptionAlgo, base64ToBuffer(base64Key), iv);
4544
const ciphertext = Buffer.concat([cipher.update(message), cipher.final(), cipher.getAuthTag()]);
4645
return { ciphertext, iv };
4746
}
4847

49-
// Compares two byte arrays
5048
function isEqual(array1, array2) {
5149
for (let i = 0; i < array1.byteLength; i++) {
5250
if (array1[i] !== array2[i]) return false;
5351
}
5452
return true;
5553
}
5654

57-
// Decrypts UID2 API response and verifies nonce
5855
function decrypt(base64Response, base64Key, nonceInRequest) {
5956
const responseBytes = base64ToBuffer(base64Response);
6057
const iv = responseBytes.subarray(0, ivLength);
@@ -70,7 +67,6 @@ function decrypt(base64Response, base64Key, nonceInRequest) {
7067
decipher.final()
7168
]);
7269

73-
// Verify nonce matches
7470
const nonceInResponse = decrypted.subarray(timestampLength, timestampLength + nonceLength);
7571
if (!isEqual(nonceInRequest, new Uint8Array(nonceInResponse))) {
7672
throw new Error('Nonce mismatch');

0 commit comments

Comments
 (0)