metatroncubeswdev 1d2d943d54 feat(security): encrypt customer personal data at rest
- Prisma extension seals booking name/email/phone/address and waitlist contacts with
  AES-256-GCM on write and opens them on read (incl. nested reads)
- keyed-hash columns for exact email/phone lookups (privacy webhooks, booking search,
  waitlist de-duplication); migration 0002
- tests prove only ciphertext is stored; privacy/terms/SECURITY.md updated to match

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 18:56:05 -04:00

9 lines
517 B
SQL

-- Customer contact details are now encrypted at rest by the app (app/lib/pii.server.ts).
-- Keyed hashes allow exact-match lookups (privacy webhooks, booking search) without decrypting.
ALTER TABLE "Booking" ADD COLUMN "customerEmailHash" TEXT;
ALTER TABLE "Booking" ADD COLUMN "customerPhoneHash" TEXT;
CREATE INDEX "Booking_shopId_customerEmailHash_idx" ON "Booking"("shopId", "customerEmailHash");
ALTER TABLE "WaitlistEntry" ADD COLUMN "emailHash" TEXT;
ALTER TABLE "WaitlistEntry" ADD COLUMN "phoneHash" TEXT;