-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
23 additions
and
7 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
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
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,4 +1,4 @@ | ||
const { Web5 } = require('@web5/api'); | ||
const checkWeb5 = require('../util/web5-test.js'); | ||
const { Web5 } = require("@web5/api"); | ||
const checkWeb5 = require("../util/web5-test.js"); | ||
|
||
checkWeb5(Web5).then(() => process.exit()); |
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
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,3 +1,5 @@ | ||
require("./webcrypto-polyfill.js"); | ||
|
||
const checkDwn = async ( | ||
Dwn, | ||
DataStream, | ||
|
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
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** According to Web5 readme we need to inject webcrypto in node versions <= 18 */ | ||
const isNode = typeof process !== "undefined" && process.versions != null; | ||
if (isNode) { | ||
const majorVersion = parseInt( | ||
process.version.slice(1).split(".")[0].replace("v", "") | ||
); | ||
if (majorVersion <= 18) { | ||
console.info(">>> Injecting webcrypto polyfill"); | ||
const { webcrypto } = require("node:crypto"); | ||
if (!globalThis.crypto) globalThis.crypto = webcrypto; | ||
} | ||
} |