this repo has no description sites.wisp.place/zzstoatzz.io/pds-message-poc
pds messaging
Svelte 55.3%
JavaScript 39.9%
CSS 3.4%
HTML 1.5%
6 1 0

Clone this repository

https://tangled.org/zzstoatzz.io/pds-message-poc https://tangled.org/did:plc:xbtmt2zjwlrfegqvch7fboei/pds-message-poc
git@tangled.org:zzstoatzz.io/pds-message-poc git@tangled.org:did:plc:xbtmt2zjwlrfegqvch7fboei/pds-message-poc

For self-hosted knots, clone URLs may differ based on your setup.

Download tar.gz
README.md

pds-message-poc#

interactive browser demo of PDS-to-PDS message passing.

demonstrates jacob.gold's proposal: PDSes have incoming message queues for DMs, like email servers.

run#

git submodule update --init
bun install
bun dev

usage#

  • type a message, select sender โ†’ recipient
  • send - initiates message (first message creates a request)
  • accept - recipient accepts pending request, messages flow freely
  • reject - recipient rejects request and blocks sender
  • spam - labeler marks sender as spam (rejected by all PDSes)

what's happening#

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Bob's PDS     โ”‚                              โ”‚   Alice's PDS   โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค                              โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                 โ”‚  1. getServiceAuth(aud=alice)โ”‚                 โ”‚
โ”‚  send_message() โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€>โ”‚                 โ”‚
โ”‚                 โ”‚  2. JWT: iss=bob aud=alice   โ”‚  inbox queue    โ”‚
โ”‚                 โ”‚ <โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚                 โ”‚
โ”‚                 โ”‚                              โ”‚                 โ”‚
โ”‚                 โ”‚  3. POST /inbox + JWT        โ”‚                 โ”‚
โ”‚                 โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€>โ”‚  evaluate():    โ”‚
โ”‚                 โ”‚                              โ”‚  - token valid? โ”‚
โ”‚                 โ”‚                              โ”‚  - spam label?  โ”‚
โ”‚                 โ”‚                              โ”‚  - blocked?     โ”‚
โ”‚                 โ”‚                              โ”‚  - accepted?    โ”‚
โ”‚                 โ”‚                              โ”‚  - rate limit?  โ”‚
โ”‚                 โ”‚  4. {status: ...}            โ”‚                 โ”‚
โ”‚                 โ”‚ <โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚  โ†’ deliver/queueโ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                           โ”‚
                           โ–ผ
                   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                   โ”‚   Labeler     โ”‚
                   โ”‚  (reputation) โ”‚
                   โ”‚  spam labels  โ”‚
                   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

invitation flow#

first contact requires acceptance (like DM requests):

  1. bob sends message to alice โ†’ creates request (message held)
  2. alice sees request in her "requests" section
  3. alice clicks accept โ†’ original message delivered, bob now accepted
  4. subsequent messages from bob deliver immediately (subject to rate limits)

alternatively:

  • alice clicks reject โ†’ request deleted, bob blocked permanently

what's demonstrated#

feature implementation ATProto pattern
service auth JWT with iss/aud/exp/lxm com.atproto.server.getServiceAuth
invitation flow pending/accepted sets similar to chat.bsky.convo request status
reputation labeler with spam labels com.atproto.label
block list per-user set existing pattern
rate limiting per-sender, time-windowed existing pattern

what's real#

uses pds.js crypto primitives via git submodule:

  • P-256 key pairs - each simulated PDS generates real keys on startup
  • ES256 JWT signatures - service auth tokens are cryptographically signed
  • signature verification - recipient verifies JWT against sender's public key via WebCrypto
  • proper JWT structure - iss, aud, lxm, exp, iat, jti fields

what's mocked#

component current path to real
DID resolution public key passed directly resolve sender DID doc to get public key
DIDs fake strings PLC resolution
labeler in-memory map ozone
network in-memory objects actual HTTP between PDSes

prior art#

references#