diff --git a/package.json b/package.json index 3667365..e1cf6cb 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ "homepage": "https://github.com/Eppo-exp/js-client-sdk-common#readme", "devDependencies": { "@types/jest": "^29.5.11", + "@types/js-base64": "^3.3.1", "@types/md5": "^2.3.2", "@types/semver": "^7.5.6", "@typescript-eslint/eslint-plugin": "^5.13.0", @@ -63,9 +64,9 @@ "webpack-cli": "^4.10.0" }, "dependencies": { + "js-base64": "^3.7.7", "md5": "^2.3.0", "pino": "^8.19.0", - "semver": "^7.5.4", - "universal-base64": "^2.1.0" + "semver": "^7.5.4" } } diff --git a/src/obfuscation.ts b/src/obfuscation.ts index 42c2e5f..9cff6ec 100644 --- a/src/obfuscation.ts +++ b/src/obfuscation.ts @@ -1,14 +1,14 @@ +import base64 = require('js-base64'); import * as md5 from 'md5'; -import { decode, encode } from 'universal-base64'; export function getMD5Hash(input: string): string { return md5(input); } export function encodeBase64(input: string) { - return encode(input); + return base64.btoaPolyfill(input); } export function decodeBase64(input: string) { - return decode(input); + return base64.atobPolyfill(input); } diff --git a/yarn.lock b/yarn.lock index 9801bf3..c1d7b62 100644 --- a/yarn.lock +++ b/yarn.lock @@ -747,6 +747,13 @@ expect "^29.0.0" pretty-format "^29.0.0" +"@types/js-base64@^3.3.1": + version "3.3.1" + resolved "https://registry.yarnpkg.com/@types/js-base64/-/js-base64-3.3.1.tgz#36c2d6dc126277ea28a4d0599d0cafbf547b51e6" + integrity sha512-Zw33oQNAvDdAN9b0IE5stH0y2MylYvtU7VVTKEJPxhyM2q57CVaNJhtJW258ah24NRtaiA23tptUmVn3dmTKpw== + dependencies: + js-base64 "*" + "@types/jsdom@^20.0.0": version "20.0.1" resolved "https://registry.npmjs.org/@types/jsdom/-/jsdom-20.0.1.tgz" @@ -2934,6 +2941,11 @@ jest@^29.7.0: import-local "^3.0.2" jest-cli "^29.7.0" +js-base64@*, js-base64@^3.7.7: + version "3.7.7" + resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-3.7.7.tgz#e51b84bf78fbf5702b9541e2cb7bfcb893b43e79" + integrity sha512-7rCnleh0z2CkXhH67J8K1Ytz0b2Y+yxTPL+/KOJoa20hfnVQ/3/T6W/KflYI4bRHRagNeXeU2bkNGI3v1oS/lw== + js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz" @@ -4105,11 +4117,6 @@ undici-types@~5.26.4: resolved "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz" integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== -universal-base64@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/universal-base64/-/universal-base64-2.1.0.tgz#511af92b3a07340fc2647036045aadb3bedcc320" - integrity sha512-WeOkACVnIXJZr/qlv7++Rl1zuZOHN96v2yS5oleUuv8eJOs5j9M5U3xQEIoWqn1OzIuIcgw0fswxWnUVGDfW6g== - universalify@^0.2.0: version "0.2.0" resolved "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz"