Files
andon/server/utils/isOwner.ts
Julien Calixte 5016c5cd47 feat(push): owner-only gate and subscription body validation (T10)
isOwner compares the session email to the configured owner; the body
matches the browser PushSubscription.toJSON() shape, reporter resolved
server-side.
2026-05-28 01:19:19 +02:00

8 lines
424 B
TypeScript

// Owner-only gate for Web Push (T10). v1 notifies a single configured owner
// (DESIGN G3); the owner email comes from runtime config server-side. If no
// owner is configured, nobody qualifies — push enrolment stays closed.
export function isOwner(email: string | undefined, ownerEmail: string | undefined): boolean {
if (!email || !ownerEmail) return false
return email.toLowerCase() === ownerEmail.toLowerCase()
}