Skip to content

Commit

Permalink
Add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
adamraya committed May 2, 2024
1 parent bafe163 commit 654320c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/static/helpers/slasHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ export const getCodeAndUsidFromUrl = (
};
};

/**
* Adds entropy to nanoid() using seedrandom to ensure that the code_challenge sent to SCAPI by Google's crawler browser is unique.
* Solves the issue with Google's crawler getting the same result from nanoid() in two different runs, which results in the same PKCE code_challenge being used twice.
*/
const nanoid = (): string => {
const rng: PRNG = seedrandom(String(+new Date()), {entropy: true});
return customRandom(urlAlphabet, 128, size =>
Expand Down

0 comments on commit 654320c

Please sign in to comment.