feat(widgets): consolidate integration metadata + shared response caching (#6691)

This commit is contained in:
Thomas authored and GitHub committed 2026-08-30 18:38:07 +02:00
1 parent 7d1d9062ed
commit 8d8dec5749
206 files changed
+3893 -1946

No files matched your search

+12
View File
@@ -7,6 +7,7 @@ const algorithm = "aes-256-cbc"; //Using AES encryption
// We fallback to a key of 0s if the key was not provided because env validation was skipped
// This should only be the case in CI
const key = Buffer.from(env.SECRET_ENCRYPTION_KEY || "0".repeat(64), "hex");
const fingerprintKey = crypto.createHmac("sha256", key).update("homarr-keyed-fingerprint-v1").digest();
export function encryptSecret(text: string): `${string}.${string}` {
const initializationVector = crypto.randomBytes(16);
@@ -29,3 +30,14 @@ export function decryptSecretWithKey(value: `${string}.${string}`, key: Buffer)
decrypted = Buffer.concat([decrypted, decipher.final()]);
return decrypted.toString();
}
export function createKeyedFingerprint(value: string) {
return crypto.createHmac("sha256", fingerprintKey).update(value).digest("hex");
}
export function verifyKeyedFingerprint(value: string, fingerprint: string) {
const expected = Buffer.from(createKeyedFingerprint(value), "hex");
const actual = Buffer.from(fingerprint, "hex");
if (expected.length !== actual.length) return false;
return crypto.timingSafeEqual(expected, actual);
}