| 1 | import fs from "node:fs" ; |
| 2 | import vm from "node:vm" ; |
| 3 | |
| 4 | const tinySource = fs.readFileSync("tinyclient/tiny.js" , "utf8" ); |
| 5 | const signingSource = tinySource.slice(tinySource.indexOf(" // Event publication is one browser boundary" ), tinySource.indexOf(" // Feature bundles load" )); |
| 6 | |
| 7 | export function sharedSigning(window, tiny) { |
| 8 | const globalThis = {tiny, nostr: window.nostr, NostrSigner: window.NostrSigner}; |
| 9 | vm.runInNewContext(`const tiny = globalThis.tiny;\n${signingSource}` , {globalThis}); |
| 10 | return globalThis.tiny.signing; |
| 11 | } |