@kumiai/hub-server 0.10.3 → 0.10.4

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 CHANGED
@@ -90,6 +90,7 @@ 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
 
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: 'EK01',
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: 'EK01',
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: 'EK01',
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: 'EK01',
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: 'EK01',
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: 'EK01',
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: 'EK01',
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: 'EK01',
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.10.3",
3
+ "version": "0.10.4",
4
4
  "description": "Hub server for Enkaku E2EE group message routing",
5
5
  "keywords": [
6
6
  "hub",
@@ -25,18 +25,18 @@
25
25
  "lib/*"
26
26
  ],
27
27
  "dependencies": {
28
- "@enkaku/protocol": "^0.21.4",
29
- "@enkaku/server": "^0.21.4",
30
- "@kokuin/capability": "^0.4.1",
28
+ "@enkaku/protocol": "^0.21.5",
29
+ "@enkaku/server": "^0.21.5",
30
+ "@kokuin/capability": "^0.4.2",
31
31
  "@kokuin/token": "^0.5.1",
32
- "@kumiai/hub-protocol": "^0.10.1",
33
- "@sozai/codec": "^0.4.2",
34
- "@sozai/event": "^0.1.5",
32
+ "@kumiai/hub-protocol": "^0.10.2",
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.21.3",
39
- "@enkaku/transport": "^0.21.3",
38
+ "@enkaku/client": "^0.21.5",
39
+ "@enkaku/transport": "^0.21.5",
40
40
  "@kumiai/hub-conformance": "^0.10.1",
41
41
  "@kumiai/hub-wake": "^0.10.0"
42
42
  },