Commit Graph

9 Commits

Author SHA1 Message Date
Jamie
8bfbd12323 Update all Uint8Array/Buffer to use ArrayBuffer
Co-authored-by: Jordan Rose <jrose@signal.org>
2026-03-16 18:55:17 -07:00
Jordan Rose
85686caa01 node: Combine Native.js and .d.ts into Native.ts
This allows the file to be checked by tsc, which would have caught
some of the missing type aliases sooner (now added to Native.ts.in).
Strictly speaking the behavior is slightly different: we have returned
to exporting many items individually instead of collecting them on a
single object.

Co-authored-by: Alex Bakon <akonradi@signal.org>
2025-10-15 17:50:37 -07:00
Alex Bakon
1f01c19e5f Convert libsignal-client node package to ESM 2025-09-22 14:20:16 -04:00
Jordan Rose
97a2ded3f6 node: Replace Buffer with Uint8Array nearly everywhere
Exceptions:
- Buffers decoding from strings (usually for tests)
- Buffer.concat, if immediately fed into libsignal, which we know
  won't rely on the diverging behavior of slice()
- Encoding GroupIdentifier to base64

Everywhere else, Uint8Array was nearly a drop-in replacement. Places
where it wasn't:
- For tests, use assertArrayEquals more, which converts to hex first
  (better diffs anyway)
- Use TextEncoder and TextDecoder for going back and forth between
  strings and UTF-8 buffers *not* in the tests
2025-06-12 16:49:20 -07:00
Alex Konradi
bddca7da60 Throw JS deserialization errors of correct type
Bind the `this` value for the deserialization check callbacks when invoking 
them so that the Rust code can access properties on the Native JS module. 
Without this, the Rust code is called with a "global object" as the context, 
which means it fails to construct a LibSignalErrorBase and has to fall back to 
an untyped error message.
2024-03-28 15:51:41 -04:00
Jordan Rose
3c236356d6 Node: Add GroupSendEndorsement 2024-03-12 17:03:45 -07:00
Jordan Rose
019e60498d Node: Update TypeScript, eslint, and prettier to match Desktop 2023-02-01 16:11:08 -08:00
Jordan Rose
970677795a Node: Rename SignalClientError to LibSignalError 2022-03-23 10:49:09 -07:00
Jordan Rose
734c0e02a3 node: Move TypeScript source files into ts/ directory
This way, files that reference the non-compiled Native.js/.d.ts can
consistently refer to it as '../Native' without having to copy
anything around.
2021-11-08 16:40:50 -08:00