Implement end-to-end encrypted buyer/seller messaging
Wire format (internal/message): sealed boxes to the listing's device key (X25519 + HKDF + ChaCha20-Poly1305), padded, proof-of-work stamped, with signed owner replies and address grants. Relay validation, bounded queues, gossip on per-region message topics and sync (store, p2p). Owner side (internal/inbox, API): inbox with hidden link messages and a per-day new-thread limit, replies, grants, and a private per-listing address. Public POST/GET /api/v1/messages for buyers. Browser: noble-based sealing and reply verification checked against a Go fixture, contact form, conversation view, message list, de/en strings. Docs: PROTOCOL.md messaging section matches the implementation. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
+14
-10
@@ -18,7 +18,10 @@ import (
|
||||
"git.stinnesbeck.com/nils/allmende/internal/store"
|
||||
)
|
||||
|
||||
const difficulty = 6
|
||||
const (
|
||||
difficulty = 6
|
||||
msgDifficulty = 4
|
||||
)
|
||||
|
||||
// testLogger is silent unless P2P_DEBUG is set.
|
||||
func testLogger() *slog.Logger {
|
||||
@@ -49,19 +52,20 @@ func startNodeWith(t *testing.T, root *identity.Identity, tweak func(*Config), r
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
s, err := store.Open(":memory:", store.Options{Difficulty: difficulty})
|
||||
s, err := store.Open(":memory:", store.Options{Difficulty: difficulty, MessageDifficulty: msgDifficulty})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
cfg := Config{
|
||||
Device: dev,
|
||||
Store: s,
|
||||
ListenAddrs: []string{"/ip4/127.0.0.1/tcp/0"},
|
||||
Regions: regions,
|
||||
Difficulty: difficulty,
|
||||
SyncPageSize: 3,
|
||||
RedialInterval: 200 * time.Millisecond,
|
||||
Logger: testLogger(),
|
||||
Device: dev,
|
||||
Store: s,
|
||||
ListenAddrs: []string{"/ip4/127.0.0.1/tcp/0"},
|
||||
Regions: regions,
|
||||
Difficulty: difficulty,
|
||||
MessageDifficulty: msgDifficulty,
|
||||
SyncPageSize: 3,
|
||||
RedialInterval: 200 * time.Millisecond,
|
||||
Logger: testLogger(),
|
||||
}
|
||||
if tweak != nil {
|
||||
tweak(&cfg)
|
||||
|
||||
Reference in New Issue
Block a user