Files
BetterDesk/web-nodejs/lib/tokenHash.js
UNITRONIX 647a3221f9 Harden console security and wire fixes into the update flow.
Hash RustDesk access tokens at rest (phase 1), add SSRF guards for admin network tools with LAN monitoring support, run dedicated console service user on Linux, and hook post-update verification plus service patching into both betterdesk.sh and the in-app updater.
2026-06-06 14:40:51 +02:00

15 lines
451 B
JavaScript

'use strict';
const crypto = require('crypto');
/**
* SHA-256 hash of a RustDesk client access token for at-rest storage.
* Plaintext token is returned to the client once at issuance; DB stores hash only
* (Phase 1: dual-write with legacy `token` column for backward compatibility).
*/
function hashAccessToken(token) {
return crypto.createHash('sha256').update(String(token), 'utf8').digest('hex');
}
module.exports = { hashAccessToken };