-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add nodejs v14 compat, copied from hashes
- Loading branch information
Showing
3 changed files
with
15 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,8 @@ jobs: | |
strategy: | ||
matrix: | ||
node: | ||
- 14 | ||
- 16 | ||
- 18 | ||
- 20 | ||
steps: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+. | ||
// We prefer WebCrypto aka globalThis.crypto, which exists in node.js 16+. | ||
// Falls back to Node.js built-in crypto for Node.js <=v14 | ||
// See utils.ts for details. | ||
// The file will throw on node.js 14 and earlier. | ||
// @ts-ignore | ||
import * as nc from 'node:crypto'; | ||
export const crypto = | ||
nc && typeof nc === 'object' && 'webcrypto' in nc ? (nc.webcrypto as any) : undefined; | ||
nc && typeof nc === 'object' && 'webcrypto' in nc | ||
? (nc.webcrypto as any) | ||
: nc && typeof nc === 'object' && 'randomBytes' in nc | ||
? nc | ||
: undefined; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters