Parses the JSON response from the node handshake and builds the WireGuard interface + peer configuration.
Replaces the old binary buffer parsing (58-byte format) with the new JSON format introduced in hub v12 / sentinel-dvpnx.
Parsed result.data from the handshake response
result.addrs from the handshake response (public IPs of the node)
const data: WireGuardHandshakeData = JSON.parse(
Buffer.from(result.data, 'base64').toString('utf8')
);
await wg.parseConfig(data, result.addrs);
Prints the WireGuard configuration as a QR code to the terminal. Useful for importing the config directly into a mobile WireGuard app.
Requires qrcode package: npm install qrcode @types/qrcode
If the config is not yet initialized or QR generation fails.
await wg.printQRCode();
// Prints a scannable QR code to stdout
Returns the current status of the WireGuard tunnel by running wg show.
Optional configFile: stringOptional path to the .conf file (used to derive
the interface name). Defaults to wgsent0.
Array of peer objects with handshake, transfer, and keepalive info.
Serializes the current interface + peer configuration to a WireGuard
.conf file format and writes it to disk.
Optional output: stringOptional file path. If omitted, a temp file is created
in the system temp directory under a sentinel-js-sdk prefix.
The path of the written config file, or null if the config
is not yet initialized (call parseConfig first).
Generated using TypeDoc
Builds the WireGuard config string without writing it to disk. Useful for displaying or generating a QR code.