Files
BetterDesk/web-nodejs/tests/tokenHash.test.js
T
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

18 lines
533 B
JavaScript

'use strict';
const { hashAccessToken } = require('../lib/tokenHash');
describe('tokenHash', () => {
it('produces stable SHA-256 hex for the same token', () => {
const token = 'a'.repeat(64);
expect(hashAccessToken(token)).toHaveLength(64);
expect(hashAccessToken(token)).toBe(hashAccessToken(token));
});
it('differs for different tokens', () => {
const a = hashAccessToken('a'.repeat(64));
const b = hashAccessToken('b'.repeat(64));
expect(a).not.toBe(b);
});
});