whatsapp: fix crypto.subtle polyfill for Node 18, bump to v2.0.1
This commit is contained in:
@@ -24,6 +24,13 @@
|
||||
* token — so there is nothing to paste back, only a QR to scan.
|
||||
*/
|
||||
|
||||
// Baileys uses the Web Crypto global (`crypto.subtle`), which Node only exposes as
|
||||
// `globalThis.crypto` from v20+. The container ships Node 18 (Debian bookworm), so
|
||||
// polyfill it from `node:crypto` — without this, the socket dies on connect with
|
||||
// "crypto is not defined" and never reaches the QR.
|
||||
const nodeCrypto = require('crypto');
|
||||
if (!globalThis.crypto) globalThis.crypto = nodeCrypto.webcrypto;
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const readline = require('readline');
|
||||
|
||||
Reference in New Issue
Block a user