@kumiai/hub-server 0.10.3 → 0.11.0
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 +1 -1
- package/lib/handlers.js +8 -8
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -90,11 +90,11 @@ flood.
|
|
|
90
90
|
|
|
91
91
|
Publish rate limits are per DID (20/s, burst 50) and per topic (100/s, burst 200), merged over
|
|
92
92
|
`DEFAULT_RATE_LIMITS`; `hub/v1/keypackage/fetch` has its own request quota per requester DID.
|
|
93
|
+
A request over a limit is refused with `HUB_RATE_LIMITED` (`RateLimitedError`) before it takes effect, so the caller waits and retries it.
|
|
93
94
|
|
|
94
95
|
## A store failure that is not a request failure
|
|
95
96
|
|
|
96
97
|
Four store operations are deliberately not allowed to fail the request they happen in:
|
|
97
|
-
|
|
98
98
|
- the **last-resort key-package top-up**, read after `fetchKeyPackages` has already consumed
|
|
99
99
|
destructively — surfacing it would destroy packages nobody received, and the client's retry
|
|
100
100
|
would burn the next batch
|
package/lib/handlers.js
CHANGED
|
@@ -239,13 +239,13 @@ export function createHandlers(params) {
|
|
|
239
239
|
}
|
|
240
240
|
if (!didLimiter.tryConsume(senderDID)) {
|
|
241
241
|
throw new HandlerError({
|
|
242
|
-
code:
|
|
242
|
+
code: HUB_ERROR_CODES.rateLimited,
|
|
243
243
|
message: 'Publish rate limit exceeded for DID'
|
|
244
244
|
});
|
|
245
245
|
}
|
|
246
246
|
if (!topicLimiter.tryConsume(topicID)) {
|
|
247
247
|
throw new HandlerError({
|
|
248
|
-
code:
|
|
248
|
+
code: HUB_ERROR_CODES.rateLimited,
|
|
249
249
|
message: 'Publish rate limit exceeded for topic'
|
|
250
250
|
});
|
|
251
251
|
}
|
|
@@ -357,7 +357,7 @@ export function createHandlers(params) {
|
|
|
357
357
|
}
|
|
358
358
|
if (!didLimiter.tryConsume(clientDID)) {
|
|
359
359
|
throw new HandlerError({
|
|
360
|
-
code:
|
|
360
|
+
code: HUB_ERROR_CODES.rateLimited,
|
|
361
361
|
message: 'Subscribe rate limit exceeded for DID'
|
|
362
362
|
});
|
|
363
363
|
}
|
|
@@ -417,7 +417,7 @@ export function createHandlers(params) {
|
|
|
417
417
|
const clientDID = getClientDID(ctx);
|
|
418
418
|
if (!didLimiter.tryConsume(clientDID)) {
|
|
419
419
|
throw new HandlerError({
|
|
420
|
-
code:
|
|
420
|
+
code: HUB_ERROR_CODES.rateLimited,
|
|
421
421
|
message: 'Unsubscribe rate limit exceeded for DID'
|
|
422
422
|
});
|
|
423
423
|
}
|
|
@@ -681,7 +681,7 @@ export function createHandlers(params) {
|
|
|
681
681
|
}
|
|
682
682
|
if (!didLimiter.tryConsume(clientDID)) {
|
|
683
683
|
throw new HandlerError({
|
|
684
|
-
code:
|
|
684
|
+
code: HUB_ERROR_CODES.rateLimited,
|
|
685
685
|
message: 'Key package upload rate limit exceeded for DID'
|
|
686
686
|
});
|
|
687
687
|
}
|
|
@@ -844,7 +844,7 @@ export function createHandlers(params) {
|
|
|
844
844
|
}
|
|
845
845
|
if (!didLimiter.tryConsume(clientDID)) {
|
|
846
846
|
throw new HandlerError({
|
|
847
|
-
code:
|
|
847
|
+
code: HUB_ERROR_CODES.rateLimited,
|
|
848
848
|
message: 'Key package status rate limit exceeded for DID'
|
|
849
849
|
});
|
|
850
850
|
}
|
|
@@ -895,7 +895,7 @@ export function createHandlers(params) {
|
|
|
895
895
|
}
|
|
896
896
|
if (!didLimiter.tryConsume(clientDID)) {
|
|
897
897
|
throw new HandlerError({
|
|
898
|
-
code:
|
|
898
|
+
code: HUB_ERROR_CODES.rateLimited,
|
|
899
899
|
message: 'Wake rate limit exceeded for DID'
|
|
900
900
|
});
|
|
901
901
|
}
|
|
@@ -959,7 +959,7 @@ export function createHandlers(params) {
|
|
|
959
959
|
// the same, or the uncounted half is the one an abusive caller uses.
|
|
960
960
|
if (!didLimiter.tryConsume(clientDID)) {
|
|
961
961
|
throw new HandlerError({
|
|
962
|
-
code:
|
|
962
|
+
code: HUB_ERROR_CODES.rateLimited,
|
|
963
963
|
message: 'Wake rate limit exceeded for DID'
|
|
964
964
|
});
|
|
965
965
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kumiai/hub-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Hub server for Enkaku E2EE group message routing",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hub",
|
|
@@ -25,20 +25,20 @@
|
|
|
25
25
|
"lib/*"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@enkaku/protocol": "^0.
|
|
29
|
-
"@enkaku/server": "^0.
|
|
30
|
-
"@kokuin/capability": "^0.
|
|
31
|
-
"@kokuin/token": "^0.
|
|
32
|
-
"@kumiai/hub-protocol": "^0.
|
|
33
|
-
"@sozai/codec": "^0.4.
|
|
34
|
-
"@sozai/event": "^0.1.
|
|
28
|
+
"@enkaku/protocol": "^0.22.1",
|
|
29
|
+
"@enkaku/server": "^0.22.1",
|
|
30
|
+
"@kokuin/capability": "^0.5.1",
|
|
31
|
+
"@kokuin/token": "^0.6.1",
|
|
32
|
+
"@kumiai/hub-protocol": "^0.11.0",
|
|
33
|
+
"@sozai/codec": "^0.4.3",
|
|
34
|
+
"@sozai/event": "^0.1.6",
|
|
35
35
|
"@sozai/log": "^0.4.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@enkaku/client": "^0.
|
|
39
|
-
"@enkaku/transport": "^0.
|
|
40
|
-
"@kumiai/hub-conformance": "^0.
|
|
41
|
-
"@kumiai/hub-wake": "^0.
|
|
38
|
+
"@enkaku/client": "^0.22.1",
|
|
39
|
+
"@enkaku/transport": "^0.22.1",
|
|
40
|
+
"@kumiai/hub-conformance": "^0.11.0",
|
|
41
|
+
"@kumiai/hub-wake": "^0.11.0"
|
|
42
42
|
},
|
|
43
43
|
"publishConfig": {
|
|
44
44
|
"access": "public"
|