- Calculate this epoch's new_nonce = hash(DH-pub-key) (20 bytes)
- Set your advertisement to be new_nonce
- Detect / scan for advertisements. For each advertisement, store a new entry in the encounters table (to be updated during confirmation with the actual shared secrets for this nonce). Note that the nonce must be posted for linking. (Note: non-ebc devices can be read as EbC devices if the advert happens to match the correct format)
- Every epoch, generate a new DH-pub-key and repeat.
Note: The system keeps track of currently ongoing encounters in a dynamic set. This includes the encounter’s PKID and start time.
Confirming encounters (every epoch):
- Post ES topic with title = new_nonce and topic text = DH-pub-key
- Query for all detected new_nonces and retrieve their topic texts (DH-pub-keys) if the new_nonce topics exist
- Compute all shared secrets with the retrieved values
- Create your ES topic for the encounter
- Update the Shared Secrets table with the confirmed values (shared secret, topic handle)
Processing Link Messages:
- Poll notifications until the last point where you last polled to (this is separate from getting unread notifications during messaging).
- For all notifications that are link messages:
- Get NewPKID = the encounter pkid of entries with received nonce = detected new_nonce. This may be null if we actually didn’t ever see this new nonce, but the other person thought the encounter was still ongoing.
- Get OldPKID = the encounter pkid of entries with received nonce = detected old_nonce (included in the link message).
- Update the PKID of entries with PKID = OldPKID to be NewPKID
- Update the start time of NewPKID entries to be the start time of OldPKID entries. Likewise, update the end time of OldPKID entries to be the end time of NewPKID entries
Posting Link Messages:
- For all adverts that need to be posted (DoNotNeedPosting=False):
- Find the firstentry with same received advert (“oldEntry”). If oldEntry is confirmed:
- Post (encrypted with the oldEntry.SS) the new advert on the encounter topic oldEntry.EID. Also include the old advert that corresponds to this encounter topic (just for convenience)
- Mark advert as posted