mirror of
https://github.com/zadam/trilium.git
synced 2025-10-28 00:36:33 +01:00
DB dump tool feature complete
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import crypto from "crypto";
|
||||
const crypto = require("crypto");
|
||||
|
||||
function decryptString(dataKey, cipherText) {
|
||||
const buffer = decrypt(dataKey, cipherText);
|
||||
@@ -59,6 +59,19 @@ function decrypt(key, cipherText, ivLength = 13) {
|
||||
}
|
||||
}
|
||||
|
||||
function pad(data) {
|
||||
if (data.length > 16) {
|
||||
data = data.slice(0, 16);
|
||||
}
|
||||
else if (data.length < 16) {
|
||||
const zeros = Array(16 - data.length).fill(0);
|
||||
|
||||
data = Buffer.concat([data, Buffer.from(zeros)]);
|
||||
}
|
||||
|
||||
return Buffer.from(data);
|
||||
}
|
||||
|
||||
function arraysIdentical(a, b) {
|
||||
let i = a.length;
|
||||
if (i !== b.length) return false;
|
||||
|
||||
Reference in New Issue
Block a user