Skip to content

Commit

Permalink
feat(core): resolving web crypto from Node (v20+) globalThis
Browse files Browse the repository at this point in the history
  • Loading branch information
HuiSF committed Jun 27, 2024
1 parent afdd2de commit dee1154
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/core/src/utils/globalHelpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ export const getCrypto = () => {
return window.crypto;
}

// Node.js v20+ See https://nodejs.org/api/webcrypto.html
if (typeof globalThis === 'object') {
return globalThis.crypto;
}

// Next.js global polyfill
if (typeof crypto === 'object') {
return crypto;
Expand Down

0 comments on commit dee1154

Please sign in to comment.