-- 019_recipient_key_decrypted.sql
--
-- Adds recipient_key_decrypted to mirror sender_key_decrypted.
-- Allows recipients to re-download within their 5-minute window,
-- same as senders already can — recipient_key_used should only be
-- set when the window actually expires, not on every download.

ALTER TABLE customers
  ADD COLUMN IF NOT EXISTS recipient_key_decrypted BOOLEAN NOT NULL DEFAULT FALSE;

COMMENT ON COLUMN customers.recipient_key_decrypted IS 'Recipient successfully decrypted within their 5-min window. Does not block re-download — only recipient_key_used (set on expiry) does that.';
