From 39dcfc75a69545795d8273928fec7576e774e6fd Mon Sep 17 00:00:00 2001 From: Alberto Ricart Date: Thu, 14 Jul 2022 14:14:51 -0500 Subject: [PATCH] retracted shim, jwt lib also requires crypto.subtle, shim has to come from client that wants to use esm on node. --- bin/tweetnacl-esm.ts | 17 +---------------- modules/esm/nacl.js | 15 --------------- 2 files changed, 1 insertion(+), 31 deletions(-) diff --git a/bin/tweetnacl-esm.ts b/bin/tweetnacl-esm.ts index 77a4a9a..6c025fc 100644 --- a/bin/tweetnacl-esm.ts +++ b/bin/tweetnacl-esm.ts @@ -34,22 +34,7 @@ async function copyFromModulesDir( await copyFromModulesDir( "nacl.js", - ` -// added by nkeys.js -// shim for crypto.randomBytes on nodejs when using the -// esm module of the nkeys.js library -if (!globalThis.crypto) { - if (typeof module === "undefined") { - globalThis.crypto = { - randomBytes: (a) => { - for (let i = 0; i < a.length; i++) { - a[i] = Math.floor(256 * Math.random()); - } - }, - }; - } -} -`, + "", ` //added by nkeys.js export it export const nacl = globalThis.nacl; diff --git a/modules/esm/nacl.js b/modules/esm/nacl.js index 2379605..279b0a9 100644 --- a/modules/esm/nacl.js +++ b/modules/esm/nacl.js @@ -3,21 +3,6 @@ // deno-lint-ignore-file // deno-fmt-ignore-file - -// added by nkeys.js -// shim for crypto.randomBytes on nodejs when using the -// esm module of the nkeys.js library -if (!globalThis.crypto) { - if (typeof module === "undefined") { - globalThis.crypto = { - randomBytes: (a) => { - for (let i = 0; i < a.length; i++) { - a[i] = Math.floor(256 * Math.random()); - } - }, - }; - } -} (function(nacl) { 'use strict';