Skip to content

Commit 3a071ef

Browse files
authored
FF-2139 Fix base64 encoding/decoding for React Native 0.72.x (#75)
* FF-2139 Fix base64 encoding/decoding for React Native 0.72.X * FF-2139 remove unused library
1 parent c3795e3 commit 3a071ef

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"homepage": "https://github.com/Eppo-exp/js-client-sdk-common#readme",
4141
"devDependencies": {
4242
"@types/jest": "^29.5.11",
43+
"@types/js-base64": "^3.3.1",
4344
"@types/md5": "^2.3.2",
4445
"@types/semver": "^7.5.6",
4546
"@typescript-eslint/eslint-plugin": "^5.13.0",
@@ -63,9 +64,9 @@
6364
"webpack-cli": "^4.10.0"
6465
},
6566
"dependencies": {
67+
"js-base64": "^3.7.7",
6668
"md5": "^2.3.0",
6769
"pino": "^8.19.0",
68-
"semver": "^7.5.4",
69-
"universal-base64": "^2.1.0"
70+
"semver": "^7.5.4"
7071
}
7172
}

src/obfuscation.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1+
import base64 = require('js-base64');
12
import * as md5 from 'md5';
2-
import { decode, encode } from 'universal-base64';
33

44
export function getMD5Hash(input: string): string {
55
return md5(input);
66
}
77

88
export function encodeBase64(input: string) {
9-
return encode(input);
9+
return base64.btoaPolyfill(input);
1010
}
1111

1212
export function decodeBase64(input: string) {
13-
return decode(input);
13+
return base64.atobPolyfill(input);
1414
}

yarn.lock

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,13 @@
747747
expect "^29.0.0"
748748
pretty-format "^29.0.0"
749749

750+
"@types/js-base64@^3.3.1":
751+
version "3.3.1"
752+
resolved "https://registry.yarnpkg.com/@types/js-base64/-/js-base64-3.3.1.tgz#36c2d6dc126277ea28a4d0599d0cafbf547b51e6"
753+
integrity sha512-Zw33oQNAvDdAN9b0IE5stH0y2MylYvtU7VVTKEJPxhyM2q57CVaNJhtJW258ah24NRtaiA23tptUmVn3dmTKpw==
754+
dependencies:
755+
js-base64 "*"
756+
750757
"@types/jsdom@^20.0.0":
751758
version "20.0.1"
752759
resolved "https://registry.npmjs.org/@types/jsdom/-/jsdom-20.0.1.tgz"
@@ -2934,6 +2941,11 @@ jest@^29.7.0:
29342941
import-local "^3.0.2"
29352942
jest-cli "^29.7.0"
29362943

2944+
js-base64@*, js-base64@^3.7.7:
2945+
version "3.7.7"
2946+
resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-3.7.7.tgz#e51b84bf78fbf5702b9541e2cb7bfcb893b43e79"
2947+
integrity sha512-7rCnleh0z2CkXhH67J8K1Ytz0b2Y+yxTPL+/KOJoa20hfnVQ/3/T6W/KflYI4bRHRagNeXeU2bkNGI3v1oS/lw==
2948+
29372949
js-tokens@^4.0.0:
29382950
version "4.0.0"
29392951
resolved "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz"
@@ -4105,11 +4117,6 @@ undici-types@~5.26.4:
41054117
resolved "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz"
41064118
integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==
41074119

4108-
universal-base64@^2.1.0:
4109-
version "2.1.0"
4110-
resolved "https://registry.yarnpkg.com/universal-base64/-/universal-base64-2.1.0.tgz#511af92b3a07340fc2647036045aadb3bedcc320"
4111-
integrity sha512-WeOkACVnIXJZr/qlv7++Rl1zuZOHN96v2yS5oleUuv8eJOs5j9M5U3xQEIoWqn1OzIuIcgw0fswxWnUVGDfW6g==
4112-
41134120
universalify@^0.2.0:
41144121
version "0.2.0"
41154122
resolved "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz"

0 commit comments

Comments
 (0)