MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / encrypt

Function encrypt

speedlink/speedlink.ts:320–325  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

318 `CREATE TABLE IF NOT EXISTS servers (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL UNIQUE, host TEXT NOT NULL, port INTEGER NOT NULL, username TEXT NOT NULL, auth_method TEXT NOT NULL, credentials TEXT NOT NULL)`
319 );
320}
321
322function encrypt(text: string): string {
323 const iv = crypto.randomBytes(IV_LENGTH);
324 const cipher = crypto.createCipheriv("aes-256-cbc", Buffer.from(ENCRYPTION_KEY), iv);
325 const encrypted = Buffer.concat([cipher.update(text), cipher.final()]);
326 return iv.toString("hex") + ":" + encrypted.toString("hex");
327}
328

Callers 1

speedtestFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected