Skip to content

Commit

Permalink
fixing crypto detection
Browse files Browse the repository at this point in the history
  • Loading branch information
Aandreba committed May 1, 2024
1 parent 741e185 commit eb77211
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/wasi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default class WASI {
inst: { exports: { memory: WebAssembly.Memory } };
// eslint-disable-next-line @typescript-eslint/no-explicit-any
wasiImport: { [key: string]: (...args: Array<any>) => unknown };
private hasCrypto: boolean = "crypto" in Function("return this")();

/// Start a WASI command
start(instance: {
Expand Down Expand Up @@ -828,7 +829,7 @@ export default class WASI {
const buffer8 = new Uint8Array(self.inst.exports.memory.buffer);
const end = buf + buf_len;

if ("crypto" in global) {
if (this.hasCrypto) {
let i = buf;
for (; i < buf_len; ) {
const next_i = i + 65_536;
Expand Down

0 comments on commit eb77211

Please sign in to comment.