dignity.js 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -4
- package/docs/openapi-like.json +45 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
[](https://www.npmjs.com/package/dignity.js)
|
|
7
7
|
[](https://www.npmjs.com/package/dignity.js)
|
|
8
8
|
[](https://github.com/jose-compu/dignity.js/actions/workflows/ci.yml)
|
|
9
|
-

|
|
10
10
|

|
|
11
11
|

|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
The Scalable Data Layer of the Decentralized Browser Application Ecosystem.
|
|
14
14
|
|
|
15
15
|
`dignity.js` lets many browsers synchronize shared objects with ownership rules and built-in anti-abuse + privacy controls.
|
|
16
16
|
|
|
@@ -33,6 +33,10 @@ REST-like P2P object API for decentralized JavaScript applications.
|
|
|
33
33
|
- Auto `connectToPeers` on create/update/delete replication (owner + collaborators)
|
|
34
34
|
- Optional IndexedDB persistence for browser reload survival
|
|
35
35
|
- Optional React hooks via `dignity.js/react`
|
|
36
|
+
- **PeerGroup gossip** — scalable PubSub for high-fanout feeds (spectators, timelines); default `maxHops: 64`
|
|
37
|
+
- **CQRS tiers (v0.8+)** — live core (5k cap) + bulk tail per publisher; signed domain events on every write
|
|
38
|
+
- **`DignityQueryReplica`** — read-only materialized views with hash-chain verification
|
|
39
|
+
- Credential-derived keys, identity rotation, and cold-recovery co-sign (v0.7+)
|
|
36
40
|
- Browser-first: published npm package includes IIFE, ESM, and CJS builds
|
|
37
41
|
|
|
38
42
|
## Install
|
|
@@ -133,13 +137,16 @@ For high-fanout object updates (millions of subscribers per published object), u
|
|
|
133
137
|
await node.joinPeerGroup('feed:alice', {
|
|
134
138
|
bootstrapPeerIds: ['publisher-peer-id'],
|
|
135
139
|
fanout: 3,
|
|
136
|
-
maxActivePeers: 8
|
|
140
|
+
maxActivePeers: 8,
|
|
141
|
+
maxHops: 64 // default since v0.8.0
|
|
137
142
|
});
|
|
138
143
|
|
|
139
144
|
await node.publishRecordToPeerGroup('feed:alice', 'posts', 'post-1');
|
|
140
145
|
await node.leavePeerGroup('feed:alice');
|
|
141
146
|
```
|
|
142
147
|
|
|
148
|
+
Inner gossip message types: `operation`, `record:snapshot`, `domain:event`, `domain:checkpoint`, and app-defined payloads (via `peergroupmessage` events).
|
|
149
|
+
|
|
143
150
|
Small collaborations (chess players, document co-editing) should keep using direct `connectToPeers` mesh. Large read-only audiences (chess spectators, public timelines) should use PeerGroup gossip. See the [docs PeerGroup section](https://jose-compu.github.io/dignity.js/#peer-groups).
|
|
144
151
|
|
|
145
152
|
### CQRS tiers, domain events, and query replicas (v0.8+)
|
|
@@ -174,7 +181,11 @@ replica.read('posts', 'p1');
|
|
|
174
181
|
replica.verifyChain(); // hash-chain consistency
|
|
175
182
|
```
|
|
176
183
|
|
|
177
|
-
Default `maxHops` is **64** (was 6), sufficient for epidemic spread at fanout 3 without per-group tuning.
|
|
184
|
+
Default `maxHops` is **64** (was 6 in v0.7.x), sufficient for epidemic spread at fanout 3 without per-group tuning.
|
|
185
|
+
|
|
186
|
+
**Publisher options:** `role: 'publisher'`, `tiered: true`, `liveCap` (default 5000), `domainEvents: true`, `peerGroupId` on CRUD to auto-publish events.
|
|
187
|
+
|
|
188
|
+
**Subscriber / replica options:** `role: 'subscriber'`, `tierMode: 'auto' | 'live' | 'bulk'`, `commandCapable: false` on read-only nodes, `publisherId` to filter events.
|
|
178
189
|
|
|
179
190
|
## Room / Team Discovery
|
|
180
191
|
|
package/docs/openapi-like.json
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dignity.js",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "REST-like object API over peer-to-peer replication",
|
|
5
|
+
"lifecycle": {
|
|
6
|
+
"start": "attach network message handler and begin receiving",
|
|
7
|
+
"stop": "leave discovery scopes and detach handler"
|
|
8
|
+
},
|
|
5
9
|
"resources": {
|
|
6
10
|
"collections/{collection}/{id}": {
|
|
7
11
|
"create": {
|
|
@@ -11,7 +15,8 @@
|
|
|
11
15
|
"id": "optional stable id",
|
|
12
16
|
"collaborators": "optional peer id list",
|
|
13
17
|
"broadcastScope": "scoped broadcast password namespace",
|
|
14
|
-
"connectToPeers": "optional; defaults to collaborators on PeerJS mesh"
|
|
18
|
+
"connectToPeers": "optional; defaults to collaborators on PeerJS mesh",
|
|
19
|
+
"peerGroupId": "optional; auto-publish signed domain event to this PeerGroup (v0.8+, publisher role)"
|
|
15
20
|
}
|
|
16
21
|
},
|
|
17
22
|
"read": {
|
|
@@ -43,7 +48,17 @@
|
|
|
43
48
|
},
|
|
44
49
|
"delete": {
|
|
45
50
|
"method": "remove(collection, id)",
|
|
46
|
-
"authorization": "owner-only"
|
|
51
|
+
"authorization": "owner-only",
|
|
52
|
+
"options": {
|
|
53
|
+
"peerGroupId": "optional; auto-publish domain event when publisher (v0.8+)"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"transferOwnership": {
|
|
57
|
+
"method": "transferOwnership(collection, id, newOwnerId, options)",
|
|
58
|
+
"authorization": "owner-only",
|
|
59
|
+
"options": {
|
|
60
|
+
"keepAsCollaborator": "default true; previous owner stays collaborator"
|
|
61
|
+
}
|
|
47
62
|
}
|
|
48
63
|
},
|
|
49
64
|
"collections/{collection}": {
|
|
@@ -57,7 +72,28 @@
|
|
|
57
72
|
"getConnectionStats": "{ openCount, peerIds }",
|
|
58
73
|
"ensureConnectedToPeers": "connect to many peers before broadcast",
|
|
59
74
|
"joinDiscovery": "scoped presence; options.bootstrapPeerIds connects before announce",
|
|
60
|
-
"
|
|
75
|
+
"leaveDiscovery": "stop heartbeat and remove local presence from scope",
|
|
76
|
+
"listPeers": "list presence entries in a discovery scope",
|
|
77
|
+
"announcePresence": "manual presence heartbeat for a joined scope",
|
|
78
|
+
"broadcastMessage": "custom app messages; options.connectToPeers",
|
|
79
|
+
"sendDirectMessage": "encrypted direct message to targetId",
|
|
80
|
+
"registerPeerPublicKey": "trust peer signing/encryption keys with optional generation",
|
|
81
|
+
"trustPeerPublicKey": "register trusted keys without generation metadata",
|
|
82
|
+
"getPublicKey": "returns this node's public key bundle",
|
|
83
|
+
"unbanPeer": "clear manual or automatic peer ban",
|
|
84
|
+
"getBanInfo": "returns ban expiry and reason for peerId, or null"
|
|
85
|
+
},
|
|
86
|
+
"identity": {
|
|
87
|
+
"getPeerIdentityGeneration": "trusted identity generation for peerId",
|
|
88
|
+
"getPeerIdentityState": "public key + generation state for peerId",
|
|
89
|
+
"adoptDerivedIdentityKeyPair": "install credential-derived keys locally",
|
|
90
|
+
"deriveAndAdoptIdentity": "derive keys from username/password and adopt",
|
|
91
|
+
"broadcastIdentityRotation": "broadcast signed identity:rotate to peers",
|
|
92
|
+
"enrollAndBroadcastColdRecovery": "enroll cold recovery key and announce",
|
|
93
|
+
"revokeAndRotateDerivedIdentity": "compromise recovery rotation helper",
|
|
94
|
+
"rotateDerivedIdentityPassword": "password-change rotation helper",
|
|
95
|
+
"applyPeerIdentityRotation": "apply remote identity:rotate message",
|
|
96
|
+
"applyPeerColdRecoveryEnrollment": "apply remote cold-recovery enrollment"
|
|
61
97
|
},
|
|
62
98
|
"peerGroups": {
|
|
63
99
|
"joinPeerGroup": "join scalable gossip group; options: fanout, maxActivePeers, maxHops (default 64), role, tiered, liveCap, tierMode, domainEvents, publisherId",
|
|
@@ -86,8 +122,12 @@
|
|
|
86
122
|
"bulkrelaychanged": "bulk relay peer set changed for a tiered group",
|
|
87
123
|
"checkpointpublished": "publisher published domain-event checkpoint",
|
|
88
124
|
"peerdiscovered": "peer joined discovery scope",
|
|
125
|
+
"peergroupjoined": "local node joined a PeerGroup",
|
|
126
|
+
"peergroupleft": "local node left a PeerGroup",
|
|
89
127
|
"peerleft": "peer left or timed out",
|
|
90
|
-
"message": "custom decrypted message received"
|
|
128
|
+
"message": "custom decrypted message received",
|
|
129
|
+
"securityerror": "signature, PoW, or decrypt failure on incoming message",
|
|
130
|
+
"messageignored": "message dropped (wrong target, banned peer, etc.)"
|
|
91
131
|
},
|
|
92
132
|
"recordShape": {
|
|
93
133
|
"active": {
|