whatsapp: fix crypto.subtle polyfill for Node 18, bump to v2.0.1

This commit is contained in:
2026-07-19 10:16:37 +01:00
parent 4e428073df
commit dd88363d98
3 changed files with 10 additions and 3 deletions
+7
View File
@@ -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');