[Fix] Harden MTP codec, transport, and SDK security

This commit is contained in:
Alex Emmet 2026-08-18 20:57:45 +02:00
commit a7e804c603
No known key found for this signature in database
73 changed files with 11892 additions and 5756 deletions

20
test/wasm-init.mjs Normal file
View file

@ -0,0 +1,20 @@
import assert from "node:assert/strict";
import { test } from "node:test";
import { createWasmInitializer } from "../dist/sdk/wasm-init.js";
test("WASM initialization can retry after a rejected attempt", async () => {
let attempts = 0;
const expected = { initialized: true };
const init = createWasmInitializer(async () => {
attempts += 1;
if (attempts === 1) {
throw new Error("initialization failed");
}
return expected;
});
await assert.rejects(init(), /initialization failed/);
assert.equal(await init(), expected);
assert.equal(await init(), expected);
assert.equal(attempts, 2);
});