Data Security
What protects a HATS record, what doesn't, how every access is accounted for, and the open question of encrypting records end to end. Most of this is the spec's design; where something runs today, the page says so.
1.1 Who is trusted
Running the storage and being trusted with the records are different jobs, held by different parties:
- Operators run storage. The PDS host, institution nodes' infrastructure, and cloud providers keep records available and intact. Being an operator earns no trust to read
- Readers are trusted, and only three kinds:
- The patient, who owns the record
- Their circle, the people the patient chooses to act for them or with them (Identity & Circles)
- Medical and legal, as HIPAA permits: licensed clinicians and institutions whose standing has been checked (an NPI and role code, an institution that vouches for its own staff, accreditation), with the patient's grant or in an emergency (ER flow); and legal authorities under a court order, warrant, or subpoena (Legal Process)
- Today the two overlap. Spaces store plaintext, so an operator can read what it holds, and law (a BAA, the FTC rule) is what keeps it from doing so. Keeping them apart in practice is what end-to-end encryption is for
1.2 Access, not encryption
Spaces decide who may read a record, not who can. A space's policy decides which DIDs get a credential to it; the records themselves are stored and synced as plaintext (Upstream).
Every host and institution that can read is regulated for it, which is why they appear in who is regulated; the patient and their circle aren't. A HATS record is protected the way an EHR's is, by access control and by law.
1.3 Encryption at rest
The requirement: every HATS node encrypts its disk under a key its operator holds (Architecture). That protects a lost, stolen, or retired disk and its backups. It doesn't protect the data from the operator, who decrypts it to serve it. Personal mode, the patient's phone, stores no records.
Today: no HATS node runs yet, since institution nodes aren't built. What does run is on Cloudflare:
- The
@hats.healthPDS holds no health records: the account posts. It stores in Durable Objects and R2, and Cloudflare encrypts both at rest with AES-256 under keys it manages (Durable Objects, R2). Cloudflare is the operator here, so the same limit applies: it protects the disk, not the data from Cloudflare - The demo's sandboxes run in Cloudflare Containers, whose temporary disks Cloudflare's documentation doesn't say are encrypted. That's acceptable only because they hold synthetic data and reset after every visit
1.4 Keys sign; they never decrypt
The HATS card and passkeys sign grants, approvals, and key changes (Threshold Authority). Losing one exposes no records, and holding one opens none. The working theory below would add the card's one exception: an emergency key that decrypts restricted records.
1.6 End-to-end encryption
Encrypting each space under its own key, wrapped for each grantee, would shut out hosts, so records could sit anywhere. It costs three things: break-glass needs someone other than the patient to hold a key; institution nodes still decrypt to serve their EHR; and revoking can't take back what a grantee already decrypted. Spaces don't offer it, so it's a protocol question for the spaces team, not one HATS can settle alone. What it would change:
- Regulation shrinks but doesn't vanish. HHS's cloud guidance still treats a host of encrypted data as a business associate, even without the key.[1]HHS, Guidance on HIPAA & Cloud Computing (2016): a cloud provider that maintains encrypted health information for a covered entity is its business associate even when it has no decryption key The gain is the breach safe harbor: encrypted data whose key wasn't exposed isn't "unsecured"[2]45 CFR 164.402, Definitions: “Unsecured protected health information means protected health information that is not rendered unusable, unreadable, or indecipherable to unauthorized persons through the use of a technology or methodology specified by the Secretary…”, so a breached host owes no notification under HIPAA or the FTC rule
- Metadata still leaks. Hosts still see which DIDs have spaces, their sizes, when they change, and who asks for credentials
- Key management becomes paramount. Lost keys mean lost records, not locked ones, so the quorum and the recovery path stop being optional
1.7 Working theory: encrypt by sensitivity
The tension is break-glass. An unresponsive patient can't unlock anything, so plaintext lets the ER in but lets every host read it all, and encryption shuts out the host but needs someone else holding a key. The theory splits the record by protection level rather than choosing one:
- Routine (
n) spaces stay plaintext, under a host bound by a BAA or the FTC rule. They hold what an emergency needs first (problems, allergies, medications), protected by law, not by key, as every EHR's host is today - Restricted spaces (
r,v,42cfrpart2) are encrypted end to end, each under its own key, wrapped for the patient's devices and for each grantee when a grant is made. Their hosts store ciphertext, so the records that do the most harm when leaked are never readable by a host - In an emergency, the card unlocks them. The HATS card carries a separate decryption key that needs no PIN, so an ER can use the card in an unresponsive patient's wallet. It unwraps only the restricted spaces the patient has allowed in an emergency, and only once the patient's managing app has admitted a break-glass claim: the managing app says who may read, the card makes it readable, and neither works alone
- Without the card, the quorum is the backstop. It holds those keys in shares and re-encrypts them to the emergency clinician without any shareholder seeing a key. It's slower than a card tap, and it makes the quorum a decryption authority for those spaces only
- The coordinator never holds a key, so it stays purely functional: it decides, and never reads
1.8 An institution holds the key to its own copy
End-to-end encryption shields a patient's records from hosts. It can't shield an institution's records from the institution, and isn't meant to. The institution reads its copy as the covered entity responsible for it, not as an operator (Who is trusted):
- Its copy is its legal record. What its node syncs and what its staff write are its designated record set[3]45 CFR 164.501, Definitions: “Designated record set means: (1) A group of records maintained by or for a covered entity that is: (i) The medical records and billing records about individuals maintained by or for a covered health care provider…”, which it must produce when the patient asks[4]45 CFR 164.524(a)(1), Access of individuals to protected health information: “…an individual has a right of access to inspect and obtain a copy of protected health information about the individual in a designated record set, for as long as the protected health information is maintained in the designated record set…” and keep for years: a hospital at least five under Medicare's conditions[5]42 CFR 482.24(b)(1), Condition of participation: Medical record services: “Medical records must be retained in their original or legally reproduced form for a period of at least 5 years.”, often longer under state law. So it holds the keys to that copy, however the patient's spaces are encrypted
collectis where a record crosses over. Once an institution's node syncs a copy, the copy is held under the institution's keys and rules. Revoking the grant stops new reads, but can't recall the copy. The consent screen says so in those terms: "Haberdasher General keeps a copy under its own rules"- A clinician the institution hosts reads for it. When a clinician's account lives on their employer's PDS, the employer controls their DID, and so which keys a grant to them is wrapped for (Threshold Authority). A grant to that clinician is one the employer can read under. HIPAA already treats it that way: a clinician is the covered entity's workforce, under its direct control[6]45 CFR 160.103, Definitions: “Workforce means employees, volunteers, trainees, and other persons whose conduct, in the performance of work for a covered entity or business associate, is under the direct control of such covered entity or business associate, whether or not they are paid by the covered entity or business associate.”
- What staff write can sit on the employer's host. Each writer's records stay in their own repo, on their own host (Upstream), so when a hospital hosts a clinician's account, a note they write into a patient's space lives on the hospital's PDS. The hospital can read it, whatever encrypts the patient's own repo
- People answer for access; institutions keep the record. Every audit entry names the person who acted (People act, institutions don't), and the institution is the custodian of its copy, as it is of any chart today
1.9 Audit
Every access leaves a record of who, whom, what, why, and when, and never what the records said. That's what lets the legal side see that Dr. X broke the glass on patient Y in four sections at 3 a.m. under BTG, without reading any of them. The demo writes these entries for real, break-glass claims included, though its reads don't yet name an NPI, role, institution, or the yes used, and it still keeps the doctor's words in the claim and the reads; legal process isn't built.
- Standard pieces. Each entry is an R4
AuditEventusing the codes of IHE's Basic Audit Log Patterns (DCM110110, actionR, a PurposeOfUse), signed by the person who made the access (Record Integrity). Conformance to BALP's profiles, which cover reads authorized by an OAuth token as space credentials are, comes later. A space holds many records, so an entry names it by identifier, itsat://address, not as a reference to one resource. Legal process uses the same record as its disclosure record, and break-glass writes its own - Levels. An entry lives in the ledger at exactly the highest level of the spaces it names, so an access across
nandrsections is two entries, one in each, and a delegate who readsnstill sees what was opened there; the demo still writes one entry, at the higher level. Anything abovencounts asr, which holds only while nothing abovercan be opened:vand Part 2 records, and care a minor consented to alone, each need a ledger home that no delegate's reach atrcovers, which their modules settle. An answer, and a yes's new version, goes in the ledger of the record it cites. Its labels follow its spaces' addresses:nisN,risR, and42cfrpart2isRwith HL7's42CFRPart2privacy-law code beside it, since that code names the law a confidentiality code complies with. The same labels go in itsmeta.security, and a label that disagrees with its address makes the entry malformed. A record may cite one at its own level or below, never above, so nothing atnpoints intor - Where entries live. In the patient's
health.hats.audit.logspace, written into the accessing person's own repo there, so the patient sees every access to their record. Every action is recorded, so a clinician reading their own record or their family's shows up there, as any read does. The institution also keeps its own, as HIPAA's audit controls require of it[7]45 CFR 164.312(b), Technical safeguards: “Standard: Audit controls. Implement hardware, software, and/or procedural mechanisms that record and examine activity in information systems that contain or use electronic protected health information.” - Who reads audit, and only audit. Access to the audit space opens no record space:
- The patient, everything about them, and the circle members who act for them, each as far as their relationship reaches. A relationship the law defines carries what the law gives it,
rincluded: a parent is a minor's personal representative by default[8]45 CFR 164.502(g)(3), Uses and disclosures of protected health information: General rules: “Implementation specification: Unemancipated minors. If under applicable law a parent, guardian, or other person acting in loco parentis has authority to act on behalf of an individual who is an unemancipated minor in making decisions related to health care, a covered entity must treat such person as a personal representative…except that such person may not be a personal representative…(A) The minor consents to such health care service”, and the care the law leaves to the minor alone stays under the minor's own account. Any other delegate reachesronly if the patient says so for that relationship. This goes past HIPAA's accounting of disclosures[9]45 CFR 164.528(a)(1), Accounting of disclosures of protected health information: “An individual has a right to receive an accounting of disclosures of protected health information made by a covered entity in the six years prior to the date on which the accounting is requested, except for disclosures: (i) To carry out treatment, payment and health care operations as provided in § 164.506…”, which leaves out treatment, payment, and operations; HATS accounts for every access - An institution's privacy officer, its own workforce's entries, to review break-glass under its sanctions policy
- Oversight with authority — a licensing board, HHS's Office for Civil Rights, a court — entries across patients for one clinician or institution, through the legal process, which records its own instrument
- The patient, everything about them, and the circle members who act for them, each as far as their relationship reaches. A relationship the law defines carries what the law gives it,
- Entries can't be quietly dropped. Each is signed, so it can't be forged or altered. A writer can still delete their own, so the trail is what others hold: the institution's own copy, the patient's own record of each break-glass claim, and the record of each pass the patient's managing app writes before approving it
1.10 Open Questions
- End-to-end encryption in spaces — whether the spaces protocol takes per-space keys wrapped for grantees, which the working theory needs (Upstream)
- A PIN-less emergency key on a card that can be stolen. Break-glass still gates it: only a clinician whose role counts, on a recorded claim, gets in. Is that enough?
- Quorum speed — how fast a quorum can re-encrypt a key at 3 a.m., when the card isn't there
- Oversight across patients — a board reviewing one clinician needs entries from many patients' audit spaces. Through legal process one patient at a time, or a metadata-only index of entries, and who would run it?
- Part 2 and break-glass — whether a patient may keep Part 2 records out of an emergency, which the roadmap lists as a legal call
1.11 Notes
- HHS, Guidance on HIPAA & Cloud Computing (2016): a cloud provider that maintains encrypted health information for a covered entity is its business associate even when it has no decryption key
- 45 CFR 164.402, Definitions: “Unsecured protected health information means protected health information that is not rendered unusable, unreadable, or indecipherable to unauthorized persons through the use of a technology or methodology specified by the Secretary…”
- 45 CFR 164.501, Definitions: “Designated record set means: (1) A group of records maintained by or for a covered entity that is: (i) The medical records and billing records about individuals maintained by or for a covered health care provider…”
- 45 CFR 164.524(a)(1), Access of individuals to protected health information: “…an individual has a right of access to inspect and obtain a copy of protected health information about the individual in a designated record set, for as long as the protected health information is maintained in the designated record set…”
- 42 CFR 482.24(b)(1), Condition of participation: Medical record services: “Medical records must be retained in their original or legally reproduced form for a period of at least 5 years.”
- 45 CFR 160.103, Definitions: “Workforce means employees, volunteers, trainees, and other persons whose conduct, in the performance of work for a covered entity or business associate, is under the direct control of such covered entity or business associate, whether or not they are paid by the covered entity or business associate.”
- 45 CFR 164.312(b), Technical safeguards: “Standard: Audit controls. Implement hardware, software, and/or procedural mechanisms that record and examine activity in information systems that contain or use electronic protected health information.”
- 45 CFR 164.502(g)(3), Uses and disclosures of protected health information: General rules: “Implementation specification: Unemancipated minors. If under applicable law a parent, guardian, or other person acting in loco parentis has authority to act on behalf of an individual who is an unemancipated minor in making decisions related to health care, a covered entity must treat such person as a personal representative…except that such person may not be a personal representative…(A) The minor consents to such health care service”
- 45 CFR 164.528(a)(1), Accounting of disclosures of protected health information: “An individual has a right to receive an accounting of disclosures of protected health information made by a covered entity in the six years prior to the date on which the accounting is requested, except for disclosures: (i) To carry out treatment, payment and health care operations as provided in § 164.506…”
Provider-to-Provider Exchange
Most records move from clinic to clinic, not through the patient: a referral, a C-CDA over Direct, a query across a network under TEFCA. HIPAA lets a covered entity make those disclosures for treatment without asking the patient[1]45 CFR 164.506(c)(2), Uses and disclosures to carry out treatment, payment, or health care operations: “A covered entity may disclose protected health information for treatment activities of a health care provider.”, and doesn't tell them afterwards either: a patient's accounting of disclosures leaves treatment out[2]45 CFR 164.528(a)(1)(i), Accounting of disclosures of protected health information: “An individual has a right to receive an accounting of disclosures of protected health information made by a covered entity in the six years prior to the date on which the accounting is requested, except for disclosures: (i) To carry out treatment, payment and health care operations as provided in § 164.506”. HATS doesn't try to stop that exchange. It makes every step of it visible to the patient and to both institutions, so no copy of a record exists that nobody can account for. This is design; nothing on this page runs yet.
2.1 Accountable, not blocked
- Exchange stays open — institutions share as the law already lets them, whether a record is their own or came through HATS. HATS adds no gate: blocking that exchange can be information blocking[3]45 CFR 171.103(a)(1), Information blocking: “Information blocking means a practice that except as required by law or covered by an exception set forth in subparts B, C, or D of this part, is likely to interfere with access, exchange, or use of electronic health information”, and under TEFCA a provider's node must answer a treatment query from a vetted provider[4]The Sequoia Project (TEFCA RCE), SOP: Exchange Purpose Implementation: Treatment, v2.0 (effective August 3, 2026), §5.3: for the
T-TRTMNTcode, which only a vetted covered-entity health care provider or its delegate may use, “All Responding Nodes that are operated by or associated with a Health Care Provider or its Delegate MUST Respond”, subject to the Exchange Purposes SOP's exceptions. For the broaderT-TREATcode, no one must - What HATS adds is accountability — every copy an institution holds says where it came from, and every move is logged by both institutions and shown to the patient. A patient who thinks a move was wrong has the same levers as for any read: dispute it, or file a complaint
- Labels travel with the record — a record keeps its confidentiality key when it moves, so the receiving institution knows which rules the law attaches to it. HATS adds no rule of its own on top
Logging is a condition of joining HATS. It can't make an unlogged move impossible, since a record in an EHR can always be printed or faxed; it makes one a breach of terms, which the logs below are built to catch.
2.2 Every move, logged on both ends
Each exchange between institutions writes two entries, one by each side, as FHIR AuditEvents using the codes of IHE's Basic Audit Log Patterns, like every other access in Data Security:
Each entry goes to the institution's own log and into the patient's health.hats.audit.log space, so the patient and both institutions see the same step. In the patient's app, a move reads like any other access: "Clinic A sent your problems to Clinic B, for treatment."
No shadow documents
Every copy an institution holds carries a FHIR Provenance: where it came from, and under what (a HATS grant, a treatment disclosure, or break-glass). The patient's Locations become every place a copy of their record is, and how it got there.
The two sides check each other. An Export with no matching Import, or a copy whose Provenance points at no logged move, is a shadow document and gets flagged. This is one answer to who witnesses an access: each institution witnesses the other, and the coordinator still never writes.
2.3 Open Questions
- Who reconciles — the patient's app, the institutions' privacy officers, an accrediting body, or all three?
- Exchange outside HATS — a HATS clinic sending to one outside HATS logs its Export, and no Import ever comes. The entry needs to mark the recipient as outside HATS, so the gap isn't flagged as a shadow document
- Records coming in — TEFCA's Individual Access Services let a patient pull their records through an IAS provider. Could a HATS app be one, filling the patient's spaces from every network? Most of what arrives is C-CDA, which would need converting to FHIR
- Stricter than HIPAA — HATS asks institutions to log, and show the patient, disclosures the law doesn't require them to account for. Is that a selling point to their compliance teams or a barrier to joining?
2.4 Notes
- 45 CFR 164.506(c)(2), Uses and disclosures to carry out treatment, payment, or health care operations: “A covered entity may disclose protected health information for treatment activities of a health care provider.”
- 45 CFR 164.528(a)(1)(i), Accounting of disclosures of protected health information: “An individual has a right to receive an accounting of disclosures of protected health information made by a covered entity in the six years prior to the date on which the accounting is requested, except for disclosures: (i) To carry out treatment, payment and health care operations as provided in § 164.506”
- 45 CFR 171.103(a)(1), Information blocking: “Information blocking means a practice that except as required by law or covered by an exception set forth in subparts B, C, or D of this part, is likely to interfere with access, exchange, or use of electronic health information”
- The Sequoia Project (TEFCA RCE), SOP: Exchange Purpose Implementation: Treatment, v2.0 (effective August 3, 2026), §5.3: for the
T-TRTMNTcode, which only a vetted covered-entity health care provider or its delegate may use, “All Responding Nodes that are operated by or associated with a Health Care Provider or its Delegate MUST Respond”, subject to the Exchange Purposes SOP's exceptions. For the broaderT-TREATcode, no one must