A Node.js client library for interacting with USB tokens via WebSocket, version 1.3.0. Developed by LCS, it provides methods to connect to a WebSocket server, check health, verify PIN, list connected USB tokens, and sign documents. The library exposes a CommonJS API with callbacks, and appears to be focused on LCS-CA hardware tokens commonly used in Vietnamese digital signing. The package has no recent updates and minimal documentation, limited to a single README with example usage.
npm install lcs-usbtokenNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates connecting via WebSocket, health check, PIN verification, token listing, and document signing using the lcs-usbtoken library.
Always pass the WebSocket URL as the first argument to each function.
Wrap calls in a Promise or use util.promisify for modern JavaScript.
Always provide an empty array '[]' if no UIDs are needed.
Retrieve token serial from getUsbToken response and use it exactly.
Base64-encode the file content before passing to signDoc.
Ensure the package is installed: 'npm install lcs-usbtoken' and require with correct casing.
Use a valid WebSocket URL without 'ws://' in the hostname part; e.g., 'ws://localhost:8080/ws'.
Call getUsbToken first to list available tokens and use the exact serial.
Verify the PIN and try again; note that the library does not expose a way to unblock PIN.