Conversation
…yption
ECDH-based multi-recipient sharing: data is encrypted with a fresh random
session key, which is then wrapped separately for each recipient using the
unique ECDH shared secret derived from the sender's epriv and the
recipient's epub. The resulting capsule { e, s, c } is JSON-safe and can
be stored anywhere (Gun graph, relay, file); only the sender and listed
recipients can ever derive the session key. Non-recipients have no key
slot and tampered capsules fail decryption.
Also syncs sea/index.js with the canonical bundle (certificant membership
check fix: 'indexOf('*' || certificant)' always evaluated to '*', so the
explicit certificant check never ran).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat(sea): add
SEA.share/SEA.unshare— zero-knowledge multi-user encryptionAdds a first-class primitive for sharing encrypted data with multiple specific recipients, built entirely on the existing SEA ECDH machinery (
SEA.secret).How it works
SEA.share(data, sender, recipients)encryptsdatawith a fresh random session key (AES-256-GCM viaSEA.encrypt).sender.epriv+recipient.epub(SEA.secret).SEA.unshare(capsule, recipient)derives the same shared secret fromcapsule.e+recipient.epriv, unwraps the session key, and decrypts the payload.Properties
undefined. Relays/graphs see only ciphertext + public keys.{epub}objects, bareepubstrings, or arrays thereof.c(or a slot) fails AES-GCM authentication →undefined.Example
Tests
7 new tests in
test/sea/sea.js(multi-recipient, objects, bare-epub recipients, non-recipient blocking, tamper blocking, callback style, self-share). Full SEA suite: 42 passing / 1 pending / 0 failing.Also in this PR
sea/index.jssynced with the canonicalsea.jsbundle vianpm run unbuildSea: the existing certificant membership checkdata.c.indexOf('*' || certificant)always evaluated to'*'(JS||short-circuit), so the explicit certificant check never ran. The bundle already contained the fix; the extracted module was stale.