*add webcrypto polyfill fork
This commit is contained in:
parent
4dd54a4f8b
commit
6cc15997f8
2
build.js
2
build.js
|
@ -10,5 +10,5 @@ esbuild.buildSync({
|
||||||
define: {
|
define: {
|
||||||
global: "self",
|
global: "self",
|
||||||
},
|
},
|
||||||
inject:['timers.js']
|
inject: ["timers.js", "polyfill.js"],
|
||||||
});
|
});
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
"@libp2p/utils": "^3.0.6",
|
"@libp2p/utils": "^3.0.6",
|
||||||
"@lumeweb/kernel-swarm-client": "git+https://git.lumeweb.com/LumeWeb/kernel-swarm-client.git",
|
"@lumeweb/kernel-swarm-client": "git+https://git.lumeweb.com/LumeWeb/kernel-swarm-client.git",
|
||||||
"@multiformats/mafmt": "^11.1.2",
|
"@multiformats/mafmt": "^11.1.2",
|
||||||
|
"@peculiar/webcrypto": "git+https://git.lumeweb.com/LumeWeb/webcrypto.git",
|
||||||
"b4a": "^1.6.3",
|
"b4a": "^1.6.3",
|
||||||
"blockstore-idb": "^1.1.0",
|
"blockstore-idb": "^1.1.0",
|
||||||
"buffer": "^6.0.3",
|
"buffer": "^6.0.3",
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
import { Crypto } from "@peculiar/webcrypto";
|
||||||
|
import { Buffer } from "buffer";
|
||||||
|
|
||||||
|
let globalCrypto = self.crypto;
|
||||||
|
if (!globalCrypto.subtle) {
|
||||||
|
let subtleCrypto = new Crypto().subtle;
|
||||||
|
Object.defineProperty(globalCrypto, "subtle", {
|
||||||
|
get() {
|
||||||
|
return subtleCrypto;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
export { Buffer };
|
Loading…
Reference in New Issue