Skip to content
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

feat(core): resolve webcrypto from node:crypto for Node18 #13599

Merged
merged 7 commits into from
Aug 6, 2024

Conversation

HuiSF
Copy link
Member

@HuiSF HuiSF commented Jul 15, 2024

Description of changes

Issue #, if available

Description of how you validated changes

Checklist

  • PR description included
  • yarn test passes
  • Unit Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)

Checklist for repo maintainers

  • Verify E2E tests for existing workflows are working as expected or add E2E tests for newly added workflows
  • New source file paths included in this PR have been added to CODEOWNERS, if appropriate

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link

⚠️ This PR includes changes to the "aws-amplify" package.json file, which can have library-wide implications.

Please ensure that this PR:

  • Does not manually change "@aws-amplify/*" dependency versions, which may misalign core dependencies across the library
  • Remove any export paths without a major version bump

A repository administrator is required to review this change.

@HuiSF HuiSF force-pushed the hui/feat/core/resolve-web-crypto branch 2 times, most recently from ff3bc2a to 4e5250f Compare July 25, 2024 18:27
@HuiSF HuiSF force-pushed the hui/feat/core/resolve-web-crypto branch from 4e5250f to d391fa0 Compare July 25, 2024 21:17
@HuiSF HuiSF marked this pull request as ready for review July 26, 2024 18:07
AllanZhengYP
AllanZhengYP previously approved these changes Jul 26, 2024
Copy link
Contributor

@jimblanc jimblanc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, few comments

.github/actions/load-verdaccio-with-amplify-js/action.yml Outdated Show resolved Hide resolved
@@ -288,6 +288,9 @@
"devDependencies": {
"typescript": "5.0.2"
},
"engines": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sanity check: Any risk of breakage here? What happens in NPM & yarn if someone is using an older version?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As adding the node version restriction is considered as a breaking change, removing it from this PR. When the library is used in a Node.js environment with version < 16, an error will be thrown as unable to resolve the Web crypto API.

@haverchuck
Copy link
Member

@HuiSF Does this impact people who are using SSR? Does crypto change get used during token refresh?

@HuiSF
Copy link
Member Author

HuiSF commented Jul 31, 2024

@HuiSF Does this impact people who are using SSR? Does crypto change get used during token refresh?

Hey @haverchuck ,

The Webcrypto APIs are not used within token refresh flows on the server side.

On the server side of a SSR framework, Webcrypto API will be resolved from Node.js (it's already happening before this change with Node.js v20+). After this change, the Webcrypto API is resolvable with a Node.js version that provides Webcrypto. Currently, there is no Amplify server-side APIs consuming Webcrypto APIs.

@HuiSF HuiSF merged commit 37d2627 into main Aug 6, 2024
30 checks passed
@HuiSF HuiSF deleted the hui/feat/core/resolve-web-crypto branch August 6, 2024 18:26
HuiSF added a commit that referenced this pull request Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants