From db07dbaf90db460a20995beb84dfb6a350602c44 Mon Sep 17 00:00:00 2001 From: Jaguar <36719905+jsvanilla@users.noreply.github.com> Date: Sun, 28 Nov 2021 15:23:59 -0600 Subject: [PATCH] FIXES node retrocompatibility bug Cannot read property subtle of undefined MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In node 12 to 15, the library doesn´t work because this error. I love the project! And if I see new issues, I try to fix them 👍 --- src/utils/crypto.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/utils/crypto.ts b/src/utils/crypto.ts index 3ed97b6..9c296a4 100644 --- a/src/utils/crypto.ts +++ b/src/utils/crypto.ts @@ -15,6 +15,9 @@ export default class CryptoDriver implements CryptoInterface { } if (!this.driver) { + if (typeof webcrypto === 'undefined') { + webcrypto = { configurable: false, enumerable: true, get() { return lazyRequire('internal/crypto/webcrypto').crypto; } }; + } // @ts-ignore this.driver = webcrypto.subtle; }