Skip to content

Commit

Permalink
base64 bandit key
Browse files Browse the repository at this point in the history
  • Loading branch information
leoromanovsky committed Jan 16, 2025
1 parent 9e82f49 commit e29c47c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eppo/js-client-sdk-common",
"version": "4.8.3-alpha.1",
"version": "4.8.3-alpha.3",
"description": "Common library for Eppo JavaScript SDKs (web, react native, and node)",
"main": "dist/index.js",
"files": [
Expand Down Expand Up @@ -78,4 +78,4 @@
"uuid": "^11.0.5"
},
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}
}
5 changes: 2 additions & 3 deletions src/obfuscation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,16 @@ export function obfuscatePrecomputedBanditMap(
return Object.fromEntries(
Object.entries(bandits).map(([variationValue, bandit]) => {
const hashedKey = getMD5Hash(variationValue, salt);
return [hashedKey, obfuscatePrecomputedBandit(salt, bandit)];
return [hashedKey, obfuscatePrecomputedBandit(bandit)];
}),
);
}

function obfuscatePrecomputedBandit(
salt: string,
banditResult: IPrecomputedBandit,
): IObfuscatedPrecomputedBandit {
return {
banditKey: getMD5Hash(banditResult.banditKey, salt),
banditKey: encodeBase64(banditResult.banditKey),
action: encodeBase64(banditResult.action),
actionProbability: banditResult.actionProbability,
optimalityGap: banditResult.optimalityGap,
Expand Down

0 comments on commit e29c47c

Please sign in to comment.