*Add crypto subtle polyfill
This commit is contained in:
parent
c31eedd40d
commit
21feb9fa17
2
build.js
2
build.js
|
@ -10,5 +10,5 @@ esbuild.buildSync({
|
|||
define: {
|
||||
global: "self",
|
||||
},
|
||||
inject: ["process.js"],
|
||||
inject: ["process.js", "polyfill.js"],
|
||||
});
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
"dependencies": {
|
||||
"@lumeweb/hyperswarm-web": "git+https://git.lumeweb.com/LumeWeb/hyperswarm-web.git",
|
||||
"@noble/ed25519": "^1.7.3",
|
||||
"@peculiar/webcrypto": "^1.4.3",
|
||||
"b4a": "^1.6.3",
|
||||
"eventemitter2": "^6.4.9",
|
||||
"hyperswarm": "^4.4.0",
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
import { Crypto } from "@peculiar/webcrypto";
|
||||
|
||||
let globalCrypto = self.crypto;
|
||||
if (!globalCrypto.subtle) {
|
||||
let subtleCrypto = new Crypto().subtle;
|
||||
Object.defineProperty(globalCrypto, "subtle", {
|
||||
get() {
|
||||
return subtleCrypto;
|
||||
},
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue