Skip to content

Commit 8a835ab

Browse files
committed
Add unstable prefix for report plaintext field
1 parent b99e6ee commit 8a835ab

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

proposals/4382-peppered-hash-verification.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,20 +67,31 @@ receiving encrypted events.
6767
When a user reports encrypted content, the server verifies:
6868

6969
```python
70-
plaintext_event = canonical_json(report['plaintext'])
70+
# Server receives report with event_id and claimed plaintext
71+
report = receive_report(room_id, event_id)
72+
73+
# Fetch stored encrypted event from database (local operation)
74+
event = database.get_event(event_id)
75+
76+
# Extract verification data (all already stored locally)
7177
ciphertext = event['content']['ciphertext']
78+
verification_hash = event['content']['verification_hash']
7279

80+
# Compute hash of reported plaintext with stored ciphertext
81+
plaintext_event = canonical_json(report['plaintext'])
7382
computed = base64(sha256(plaintext_event + ciphertext))
7483

75-
if computed == event['content']['verification_hash']:
84+
# Single comparison - no decryption, no network requests
85+
if computed == verification_hash:
7686
# Report verified - plaintext is authentic
7787
else:
7888
# Report is false - reporter is lying
7989
```
8090

8191
The server never needs decryption keys or access to the encryption
82-
session. It only verifies that the reported plaintext matches the
83-
verification hash.
92+
session. All verification data (ciphertext and verification_hash) is
93+
already stored in the database. Verification requires only a local
94+
database fetch and a single SHA-256 computation.
8495

8596
### Security Properties
8697

@@ -147,6 +158,7 @@ capabilities.
147158

148159
During development, implementations should use:
149160
- Field name: `org.matrix.msc4382.verification_hash`
161+
- Report field: `org.matrix.msc4382.plaintext`
150162
- Client capability: `org.matrix.msc4382.peppered_hash_verification`
151163

152164
## Dependencies

0 commit comments

Comments
 (0)