Open
Description
Hello,
I'm trying to write a Matrix bot in Node. I've got everything working, except the encryption. I followed the docs, but when I'm trying to call client.initRustCrypto()
, I'm getting the following error in the console:
file:///Users/petercherm/Git/pcherm/matrix-securityspy-bot/node_modules/matrix-js-sdk/lib/rust-crypto/RoomEncryptor.js:20
import { CollectStrategy, EncryptionAlgorithm, EncryptionSettings, HistoryVisibility as RustHistoryVisibility, RoomId, UserId } from "@matrix-org/matrix-sdk-crypto-wasm";
^^^^^^^^^^^^^^^
SyntaxError: The requested module '@matrix-org/matrix-sdk-crypto-wasm' does not provide an export named 'CollectStrategy'
at ModuleJob._instantiate (node:internal/modules/esm/module_job:180:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:263:5)
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:547:26)
I've got type: module
in my package.json and also the following options in my tsconfig.json
:
"target": "es2022"
"module": "NodeNext"
"moduleResolution": "nodenext"
I tried adding --experimental-wasm-modules --conditions=wasm-esm
flags to node
, but to no avail 😕
npm list matrix-js-sdk @matrix-org/matrix-sdk-crypto-wasm
reports the following versions:
└─┬ matrix-js-sdk@36.0.0
└── @matrix-org/matrix-sdk-crypto-wasm@12.1.0
which I think is correct. I'm on Node v22.13.0
Does anyone have any idea why I might be getting that error?
Many thanks in advance.
Peter.