| 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 | |
| 322 | function 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 | |