Skip to content

Commit

Permalink
Patch js-sha256 bug on some Chrome versions
Browse files Browse the repository at this point in the history
  • Loading branch information
marcos-statsig authored and tore-statsig committed Aug 28, 2023
1 parent 6f74c4d commit 0f608fb
Show file tree
Hide file tree
Showing 5 changed files with 721 additions and 14 deletions.
11 changes: 0 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
"webpack-cli": "^4.10.0"
},
"dependencies": {
"js-sha256": "^0.9.0",
"uuid": "^8.3.2"
},
"importSort": {
Expand Down
4 changes: 2 additions & 2 deletions src/utils/Hashing.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { sha256 } from 'js-sha256';
import { StatsigUser } from '../StatsigUser';
import { Base64 } from './Base64';
import { sha256create } from './js-sha256';

const hashLookupTable: Record<string, string> = {};

Expand Down Expand Up @@ -30,7 +30,7 @@ export function sha256Hash(value: string): string {
return seen;
}

const buffer = sha256.create().update(value).arrayBuffer();
const buffer = sha256create().update(value).arrayBuffer();
const hash = Base64.encodeArrayBuffer(buffer);
hashLookupTable[value] = hash;
return hash;
Expand Down
Loading

0 comments on commit 0f608fb

Please sign in to comment.