-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@W-15248536@ - [v2] Google Search Console fix createCodeVerifier #1765
Changes from all commits
b20b9e8
88a6642
18952c7
54c53eb
9851511
291df35
5dd7280
01ff1ac
e495bc5
1e9f4ed
451203c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright (c) 2024, Salesforce, Inc. | ||
* All rights reserved. | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause | ||
*/ | ||
import {createCodeVerifier, generateCodeChallenge} from './pkce' | ||
import seedrandom from 'seedrandom' | ||
|
||
describe('PKCE Utility Functions', () => { | ||
describe('createCodeVerifier', () => { | ||
test('should generate unique code verifiers', () => { | ||
const verifiers = new Set() | ||
const numVerifiers = 100 | ||
|
||
for (let i = 0; i < numVerifiers; i++) { | ||
const verifier = createCodeVerifier() | ||
verifiers.add(verifier) | ||
} | ||
expect(verifiers.size).toBe(numVerifiers) | ||
}) | ||
|
||
test('should provide sufficient entropy', () => { | ||
const seed1 = 123456789 | ||
const seed2 = 987654321 | ||
seedrandom(seed1, {global: true}) | ||
const verifier1 = createCodeVerifier() | ||
seedrandom(seed2, {global: true}) | ||
const verifier2 = createCodeVerifier() | ||
// the generated verifiers should be different because we're using different seeds | ||
expect(verifier1).not.toBe(verifier2) | ||
}) | ||
}) | ||
|
||
describe('generateCodeChallenge', () => { | ||
test('should generate a code challenge based on the provided code verifier', async () => { | ||
const codeVerifier = createCodeVerifier() | ||
const codeChallenge = await generateCodeChallenge(codeVerifier) | ||
|
||
expect(codeChallenge).toBeDefined() | ||
}) | ||
}) | ||
}) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,7 +52,8 @@ | |
"react-helmet": "^6.1.0", | ||
"react-hook-form": "^6.15.8", | ||
"react-intl": "^5.25.1", | ||
"react-router-dom": "^5.3.4" | ||
"react-router-dom": "^5.3.4", | ||
"seedrandom": "^3.0.5" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't forget to file 3pp There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
}, | ||
"peerDependencies": { | ||
"@chakra-ui/system": "^1.12.1" | ||
|
@@ -80,7 +81,7 @@ | |
"bundlesize": [ | ||
{ | ||
"path": "build/main.js", | ||
"maxSize": "55 kB" | ||
"maxSize": "56 kB" | ||
}, | ||
{ | ||
"path": "build/vendor.js", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change doesn't look related.. what and why did we make this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to mention this in a change log anywhere fixing a bug I suspect?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct. It's an unrelated change. I added details to the PR description.
After the latest v2 release, the Windows GA builds were failing on v2, and it seems like we decided not to fix it at that time. So I included the fix in this PR.
https://github.com/SalesforceCommerceCloud/pwa-kit/tree/release-2.8.x
https://github.com/SalesforceCommerceCloud/pwa-kit/actions/runs/8731228868/job/23956306359
Good call on adding the change to the change log.