Files
HealthLog/src/lib/notifications/managed-delivery.ts
T
Marc-André Bombeck 60b4845fea feat(02-11): secure guardian notification delivery
- Remove record-mutating affordances from Guardian channel payloads\n- Reject managed Telegram callbacks and verify channel attribution
2026-08-06 05:44:41 +02:00

17 lines
588 B
TypeScript

import type { NotificationPayload } from "@/lib/notifications/types";
/**
* A cross-account notification can only reach a Guardian after the
* dispatcher has revalidated the marked record and its active MANAGE grant.
* Senders use this narrow invariant to remove record-mutating affordances.
*/
export function isManagedGuardianDelivery(
payload: Pick<NotificationPayload, "recordUserId" | "recipientUserId">,
): boolean {
return (
payload.recordUserId !== undefined &&
payload.recipientUserId !== undefined &&
payload.recordUserId !== payload.recipientUserId
);
}