mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
style: apply Biome formatting to enterprise files
This commit is contained in:
@@ -16,11 +16,7 @@ export function computeHmac(data: Record<string, unknown>, key: Buffer): string
|
||||
return createHmac("sha256", key).update(canonicalize(data)).digest("hex");
|
||||
}
|
||||
|
||||
export function verifyHmac(
|
||||
data: Record<string, unknown>,
|
||||
hmac: string,
|
||||
key: Buffer,
|
||||
): boolean {
|
||||
export function verifyHmac(data: Record<string, unknown>, hmac: string, key: Buffer): boolean {
|
||||
const computed = computeHmac(data, key);
|
||||
return computed === hmac;
|
||||
}
|
||||
|
||||
@@ -100,10 +100,7 @@ export async function auditLog(
|
||||
requestId,
|
||||
};
|
||||
const integrity = computeHmac(rowData, hmacKey);
|
||||
await db
|
||||
.update(schema.auditLog)
|
||||
.set({ integrity })
|
||||
.where(eq(schema.auditLog.id, id));
|
||||
await db.update(schema.auditLog).set({ integrity }).where(eq(schema.auditLog.id, id));
|
||||
}
|
||||
} catch {
|
||||
logger.warn({ event }, "Failed to compute audit HMAC");
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
import {
|
||||
createCipheriv,
|
||||
createDecipheriv,
|
||||
randomBytes,
|
||||
hkdf as hkdfCb,
|
||||
} from "node:crypto";
|
||||
import { createCipheriv, createDecipheriv, hkdf as hkdfCb, randomBytes } from "node:crypto";
|
||||
import { promisify } from "node:util";
|
||||
|
||||
const hkdf = promisify(hkdfCb);
|
||||
|
||||
@@ -50,7 +50,12 @@ export async function deliverWebhook(
|
||||
lastError = `HTTP ${response.status}`;
|
||||
// Don't retry 4xx errors (client errors = won't succeed on retry)
|
||||
if (response.status >= 400 && response.status < 500) {
|
||||
return { success: false, statusCode: response.status, error: lastError, attempts: attempt + 1 };
|
||||
return {
|
||||
success: false,
|
||||
statusCode: response.status,
|
||||
error: lastError,
|
||||
attempts: attempt + 1,
|
||||
};
|
||||
}
|
||||
} catch (err) {
|
||||
lastError = err instanceof Error ? err.message : String(err);
|
||||
|
||||
Reference in New Issue
Block a user