mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-09 21:10:59 +00:00
- Remove record-mutating affordances from Guardian channel payloads\n- Reject managed Telegram callbacks and verify channel attribution
17 lines
588 B
TypeScript
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
|
|
);
|
|
}
|