@kumiai/rpc 0.3.0 → 0.4.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 +120 -0
- package/lib/anchor.d.ts +27 -0
- package/lib/anchor.js +18 -0
- package/lib/app-cursor.d.ts +63 -0
- package/lib/app-cursor.js +44 -0
- package/lib/app-lane.d.ts +78 -0
- package/lib/app-lane.js +401 -0
- package/lib/bus-server.d.ts +6 -6
- package/lib/bus-server.js +3 -9
- package/lib/classify.d.ts +94 -44
- package/lib/classify.js +35 -19
- package/lib/commit-frame.d.ts +40 -4
- package/lib/commit-frame.js +60 -13
- package/lib/crypto.d.ts +277 -112
- package/lib/crypto.js +5 -6
- package/lib/cursor.d.ts +1 -1
- package/lib/cursor.js +1 -1
- package/lib/directed.d.ts +44 -5
- package/lib/directed.js +135 -60
- package/lib/handshake.d.ts +41 -4
- package/lib/handshake.js +40 -7
- package/lib/hub-mux.d.ts +94 -1
- package/lib/hub-mux.js +254 -11
- package/lib/index.d.ts +10 -6
- package/lib/index.js +6 -5
- package/lib/ledger-entries.d.ts +52 -8
- package/lib/ledger-entries.js +59 -23
- package/lib/open-once.d.ts +46 -0
- package/lib/open-once.js +63 -0
- package/lib/peer.d.ts +122 -54
- package/lib/peer.js +665 -307
- package/lib/protocol.d.ts +52 -0
- package/lib/protocol.js +22 -0
- package/lib/roster.d.ts +22 -0
- package/lib/roster.js +29 -0
- package/lib/topic.d.ts +20 -3
- package/lib/topic.js +20 -4
- package/package.json +17 -13
- package/lib/directed-crypto.d.ts +0 -17
- package/lib/directed-crypto.js +0 -80
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ChannelProcedureDefinition, EventProcedureDefinition, RequestProcedureDefinition, StreamProcedureDefinition } from '@enkaku/protocol';
|
|
2
|
+
/**
|
|
3
|
+
* Retention class of an app procedure's dispatched frames. `log` is retained by the hub and
|
|
4
|
+
* pullable to a cursor (drained on a member's return); `ephemeral` is live push, mailbox-class,
|
|
5
|
+
* dropped if no subscriber is listening.
|
|
6
|
+
*/
|
|
7
|
+
export type Retention = 'log' | 'ephemeral';
|
|
8
|
+
/**
|
|
9
|
+
* An event procedure that may opt into log retention. `retain: 'log'` makes every dispatch of
|
|
10
|
+
* the procedure retained and pullable regardless of call site; absent, dispatches are ephemeral.
|
|
11
|
+
*/
|
|
12
|
+
export type RetainableEventProcedureDefinition = EventProcedureDefinition & {
|
|
13
|
+
retain?: 'log';
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* A single procedure of a group protocol. Only `event` procedures may carry `retain`.
|
|
17
|
+
*/
|
|
18
|
+
export type GroupProcedureDefinition = RetainableEventProcedureDefinition | RequestProcedureDefinition | StreamProcedureDefinition | ChannelProcedureDefinition;
|
|
19
|
+
/**
|
|
20
|
+
* A protocol run over a group broadcast substrate, where only `event` procedures may declare
|
|
21
|
+
* `retain: 'log'`. Correlation traffic (`request`/`stream`/`channel`) is always ephemeral:
|
|
22
|
+
* retaining it is unsafe — a re-pulled request re-fires its responder, and the rid/timeout/quorum
|
|
23
|
+
* a reply correlates against is dead by the time a returning member drains it. Structurally a
|
|
24
|
+
* superset of the underlying Enkaku protocol definition for everything else.
|
|
25
|
+
*/
|
|
26
|
+
export type GroupProtocolDefinition = Record<string, GroupProcedureDefinition>;
|
|
27
|
+
/**
|
|
28
|
+
* Per-entry retention rule used as a constraint: an `event` procedure is unconstrained (retain
|
|
29
|
+
* allowed); every other procedure must carry no `retain` (`retain?: never`), so a `retain` on a
|
|
30
|
+
* request/stream/channel fails the constraint and the definition is rejected at the type level.
|
|
31
|
+
*/
|
|
32
|
+
type RetainRule<Procedure> = Procedure extends {
|
|
33
|
+
type: 'event';
|
|
34
|
+
} ? unknown : {
|
|
35
|
+
retain?: never;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Identity helper that returns the protocol definition unchanged while preserving its literal
|
|
39
|
+
* type for downstream inference — extended over the underlying broadcast helper so an `event`
|
|
40
|
+
* procedure may declare `retain: 'log'`. Declaring `retain` on a non-`event` procedure is a type
|
|
41
|
+
* error (the `RetainRule` constraint) AND throws here at definition time, so a JS caller or an
|
|
42
|
+
* erased type cannot slip a retained request/stream/channel past the guardrail.
|
|
43
|
+
*/
|
|
44
|
+
export declare function defineGroupProtocol<const Definition extends GroupProtocolDefinition & {
|
|
45
|
+
[Name in keyof Definition]: RetainRule<Definition[Name]>;
|
|
46
|
+
}>(definition: Definition): Definition;
|
|
47
|
+
/**
|
|
48
|
+
* The retention a procedure was declared with in its group protocol definition. `'log'` only for
|
|
49
|
+
* an `event` procedure carrying `retain: 'log'`; `'ephemeral'` for everything else (the default).
|
|
50
|
+
*/
|
|
51
|
+
export declare function retentionOf(protocol: GroupProtocolDefinition, procedureName: string): Retention;
|
|
52
|
+
export {};
|
package/lib/protocol.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Identity helper that returns the protocol definition unchanged while preserving its literal
|
|
3
|
+
* type for downstream inference — extended over the underlying broadcast helper so an `event`
|
|
4
|
+
* procedure may declare `retain: 'log'`. Declaring `retain` on a non-`event` procedure is a type
|
|
5
|
+
* error (the `RetainRule` constraint) AND throws here at definition time, so a JS caller or an
|
|
6
|
+
* erased type cannot slip a retained request/stream/channel past the guardrail.
|
|
7
|
+
*/ export function defineGroupProtocol(definition) {
|
|
8
|
+
for (const [name, procedure] of Object.entries(definition)){
|
|
9
|
+
const proc = procedure;
|
|
10
|
+
if (proc.retain !== undefined && proc.type !== 'event') {
|
|
11
|
+
throw new Error(`defineGroupProtocol: procedure "${name}" has type "${String(proc.type)}" and declares retain; only 'event' procedures may be retained, request/stream/channel traffic is always ephemeral`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return definition;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The retention a procedure was declared with in its group protocol definition. `'log'` only for
|
|
18
|
+
* an `event` procedure carrying `retain: 'log'`; `'ephemeral'` for everything else (the default).
|
|
19
|
+
*/ export function retentionOf(protocol, procedureName) {
|
|
20
|
+
const procedure = protocol[procedureName];
|
|
21
|
+
return procedure?.type === 'event' && procedure.retain === 'log' ? 'log' : 'ephemeral';
|
|
22
|
+
}
|
package/lib/roster.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detect a roster CHANGE by diffing the roster around a Commit's application: the DIDs a handle
|
|
3
|
+
* held before applying against the DIDs it holds after. `true` iff the two sets differ at all —
|
|
4
|
+
* a leaf gained, a leaf lost, or both.
|
|
5
|
+
*
|
|
6
|
+
* Set inequality, not set difference: an Add rotates the app-lane anchor just as a Remove does.
|
|
7
|
+
* A Remove must rotate it for forward secrecy — the evicted member keeps every topic ID it ever
|
|
8
|
+
* derived, so the group has to stop using them. An Add must rotate it because the anchor secret
|
|
9
|
+
* is the anchor epoch's exported secret, and MLS ratchets forward: a member added at epoch E can
|
|
10
|
+
* never export the secret of an epoch before E, so an anchor the group left behind is one the
|
|
11
|
+
* newest member cannot derive. The two constraints intersect at `max(last add, last remove)` —
|
|
12
|
+
* the last roster change — which is the only epoch that is both ≥ every current member's join
|
|
13
|
+
* and after every removal.
|
|
14
|
+
*
|
|
15
|
+
* A set, not a count: a Commit carrying both an Add and a Remove leaves the leaf count unchanged
|
|
16
|
+
* and still changes the roster, and a count check would miss it.
|
|
17
|
+
*
|
|
18
|
+
* Pure: no state, no order dependence (the inputs are compared as sets), duplicates ignored.
|
|
19
|
+
* Because it compares DIDs and not leaves, a change that leaves the DID set intact is invisible
|
|
20
|
+
* to it — an external-commit rejoin by a member the roster still holds is exactly that.
|
|
21
|
+
*/
|
|
22
|
+
export declare function detectRosterChange(before: Array<string>, after: Array<string>): boolean;
|
package/lib/roster.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detect a roster CHANGE by diffing the roster around a Commit's application: the DIDs a handle
|
|
3
|
+
* held before applying against the DIDs it holds after. `true` iff the two sets differ at all —
|
|
4
|
+
* a leaf gained, a leaf lost, or both.
|
|
5
|
+
*
|
|
6
|
+
* Set inequality, not set difference: an Add rotates the app-lane anchor just as a Remove does.
|
|
7
|
+
* A Remove must rotate it for forward secrecy — the evicted member keeps every topic ID it ever
|
|
8
|
+
* derived, so the group has to stop using them. An Add must rotate it because the anchor secret
|
|
9
|
+
* is the anchor epoch's exported secret, and MLS ratchets forward: a member added at epoch E can
|
|
10
|
+
* never export the secret of an epoch before E, so an anchor the group left behind is one the
|
|
11
|
+
* newest member cannot derive. The two constraints intersect at `max(last add, last remove)` —
|
|
12
|
+
* the last roster change — which is the only epoch that is both ≥ every current member's join
|
|
13
|
+
* and after every removal.
|
|
14
|
+
*
|
|
15
|
+
* A set, not a count: a Commit carrying both an Add and a Remove leaves the leaf count unchanged
|
|
16
|
+
* and still changes the roster, and a count check would miss it.
|
|
17
|
+
*
|
|
18
|
+
* Pure: no state, no order dependence (the inputs are compared as sets), duplicates ignored.
|
|
19
|
+
* Because it compares DIDs and not leaves, a change that leaves the DID set intact is invisible
|
|
20
|
+
* to it — an external-commit rejoin by a member the roster still holds is exactly that.
|
|
21
|
+
*/ export function detectRosterChange(before, after) {
|
|
22
|
+
const held = new Set(before);
|
|
23
|
+
const present = new Set(after);
|
|
24
|
+
if (held.size !== present.size) return true;
|
|
25
|
+
for (const did of held){
|
|
26
|
+
if (!present.has(did)) return true;
|
|
27
|
+
}
|
|
28
|
+
return false;
|
|
29
|
+
}
|
package/lib/topic.d.ts
CHANGED
|
@@ -1,9 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The label the app-lane anchor is exported under — the one `GroupCrypto.exportSecret` call in
|
|
3
|
+
* this package, made once per anchor capture (`captureAnchor` in `peer.ts`, on init and every
|
|
4
|
+
* roster-changing commit). Fixed rather than per-protocol: the secret it produces is not itself
|
|
5
|
+
* a topic, it is what {@link protocolTopic} and {@link inboxTopic} derive every app-lane topic
|
|
6
|
+
* FROM, so one label covers every protocol a host defines and `protocol`/`scope` do the
|
|
7
|
+
* discriminating below it.
|
|
8
|
+
*
|
|
9
|
+
* Chosen by and internal to this package alone — `GroupCrypto.exportSecret` takes `label` as a
|
|
10
|
+
* required argument with no default (see that method's doc in `crypto.ts`), so a conforming
|
|
11
|
+
* implementation is label-agnostic by construction: it passes whatever label its caller supplies
|
|
12
|
+
* straight to the underlying exporter and closes over none of its own. `@kumiai/mls-rpc`'s
|
|
13
|
+
* `createGroupCrypto` is exactly that — a pass-through. No implementation should hardcode this
|
|
14
|
+
* string or any other; the only caller that is allowed to know it is this package's own peer.
|
|
15
|
+
* Changing it changes every topic ID this package has ever derived.
|
|
16
|
+
*/
|
|
17
|
+
export declare const APP_TOPIC_LABEL = "kumiai/app-topic/v1";
|
|
1
18
|
/** Reserved label for per-member unicast inbox topics. */
|
|
2
|
-
export declare const INBOX_LABEL = "
|
|
19
|
+
export declare const INBOX_LABEL = "kumiai/inbox/v1";
|
|
3
20
|
/** Reserved label for the non-rotating MLS commit topic. */
|
|
4
|
-
export declare const COMMIT_LABEL = "
|
|
21
|
+
export declare const COMMIT_LABEL = "kumiai/commit/v1";
|
|
5
22
|
/** Reserved label for the non-rotating recovery-rendezvous topic. */
|
|
6
|
-
export declare const RENDEZVOUS_LABEL = "
|
|
23
|
+
export declare const RENDEZVOUS_LABEL = "kumiai/rendezvous/v1";
|
|
7
24
|
/**
|
|
8
25
|
* Group-scoped broadcast/multicast topic for an application protocol. Opaque to
|
|
9
26
|
* the hub; derivable only by members holding the epoch secret. `scope`
|
package/lib/topic.js
CHANGED
|
@@ -1,10 +1,26 @@
|
|
|
1
1
|
import { deriveTopicID } from '@kumiai/broadcast';
|
|
2
2
|
import { sha256 } from '@noble/hashes/sha2.js';
|
|
3
3
|
import { fromUTF, toB64U } from '@sozai/codec';
|
|
4
|
-
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
/**
|
|
5
|
+
* The label the app-lane anchor is exported under — the one `GroupCrypto.exportSecret` call in
|
|
6
|
+
* this package, made once per anchor capture (`captureAnchor` in `peer.ts`, on init and every
|
|
7
|
+
* roster-changing commit). Fixed rather than per-protocol: the secret it produces is not itself
|
|
8
|
+
* a topic, it is what {@link protocolTopic} and {@link inboxTopic} derive every app-lane topic
|
|
9
|
+
* FROM, so one label covers every protocol a host defines and `protocol`/`scope` do the
|
|
10
|
+
* discriminating below it.
|
|
11
|
+
*
|
|
12
|
+
* Chosen by and internal to this package alone — `GroupCrypto.exportSecret` takes `label` as a
|
|
13
|
+
* required argument with no default (see that method's doc in `crypto.ts`), so a conforming
|
|
14
|
+
* implementation is label-agnostic by construction: it passes whatever label its caller supplies
|
|
15
|
+
* straight to the underlying exporter and closes over none of its own. `@kumiai/mls-rpc`'s
|
|
16
|
+
* `createGroupCrypto` is exactly that — a pass-through. No implementation should hardcode this
|
|
17
|
+
* string or any other; the only caller that is allowed to know it is this package's own peer.
|
|
18
|
+
* Changing it changes every topic ID this package has ever derived.
|
|
19
|
+
*/ export const APP_TOPIC_LABEL = 'kumiai/app-topic/v1';
|
|
20
|
+
/** Reserved label for per-member unicast inbox topics. */ export const INBOX_LABEL = 'kumiai/inbox/v1';
|
|
21
|
+
/** Reserved label for the non-rotating MLS commit topic. */ export const COMMIT_LABEL = 'kumiai/commit/v1';
|
|
22
|
+
/** Reserved label for the non-rotating recovery-rendezvous topic. */ export const RENDEZVOUS_LABEL = 'kumiai/rendezvous/v1';
|
|
23
|
+
const DISCOVERY_PREFIX = 'kumiai/discovery/v1';
|
|
8
24
|
const SEP = '\0';
|
|
9
25
|
/**
|
|
10
26
|
* Group-scoped broadcast/multicast topic for an application protocol. Opaque to
|
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kumiai/rpc",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"license": "MIT",
|
|
3
|
+
"version": "0.4.0",
|
|
5
4
|
"description": "High-level MLS-aware group RPC for Enkaku: bus broadcast/anycast/gather plus directed RPC over the pub/sub hub",
|
|
6
5
|
"keywords": [
|
|
7
6
|
"rpc",
|
|
@@ -15,38 +14,43 @@
|
|
|
15
14
|
"url": "https://github.com/TairuFramework/kumiai",
|
|
16
15
|
"directory": "packages/rpc"
|
|
17
16
|
},
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"sideEffects": false,
|
|
18
19
|
"type": "module",
|
|
19
|
-
"main": "lib/index.js",
|
|
20
|
-
"types": "lib/index.d.ts",
|
|
21
20
|
"exports": {
|
|
22
21
|
".": "./lib/index.js"
|
|
23
22
|
},
|
|
23
|
+
"main": "lib/index.js",
|
|
24
|
+
"types": "lib/index.d.ts",
|
|
24
25
|
"files": [
|
|
25
26
|
"lib/*"
|
|
26
27
|
],
|
|
27
|
-
"sideEffects": false,
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@enkaku/client": "^0.19.0",
|
|
30
|
-
"@sozai/codec": "^0.2.0",
|
|
31
30
|
"@enkaku/protocol": "^0.19.0",
|
|
32
31
|
"@enkaku/server": "^0.19.0",
|
|
33
32
|
"@enkaku/transport": "^0.19.1",
|
|
34
33
|
"@noble/hashes": "^2.0.0",
|
|
35
|
-
"@
|
|
36
|
-
"@
|
|
37
|
-
"@
|
|
34
|
+
"@sozai/codec": "^0.2.0",
|
|
35
|
+
"@sozai/log": "^0.2.0",
|
|
36
|
+
"@sozai/runtime": "^0.1.0",
|
|
37
|
+
"@kumiai/broadcast": "^0.4.0",
|
|
38
|
+
"@kumiai/hub-protocol": "^0.4.0",
|
|
39
|
+
"@kumiai/hub-tunnel": "^0.4.0"
|
|
38
40
|
},
|
|
39
41
|
"devDependencies": {
|
|
40
42
|
"@noble/curves": "^2.0.1",
|
|
41
|
-
"vitest": "^4.1.10"
|
|
43
|
+
"vitest": "^4.1.10",
|
|
44
|
+
"@kumiai/hub-conformance": "^0.4.0",
|
|
45
|
+
"@kumiai/rpc-conformance": "^0.4.0"
|
|
42
46
|
},
|
|
43
47
|
"scripts": {
|
|
48
|
+
"build": "pnpm run build:clean && pnpm run build:js && pnpm run build:types",
|
|
44
49
|
"build:clean": "del lib",
|
|
45
50
|
"build:js": "swc src -d ./lib --config-file ../../node_modules/@kigu/dev/swc.json --strip-leading-paths",
|
|
46
51
|
"build:types": "tsc --emitDeclarationOnly --skipLibCheck",
|
|
47
|
-
"
|
|
52
|
+
"test": "pnpm run test:types && pnpm run test:unit",
|
|
48
53
|
"test:types": "tsc --noEmit --skipLibCheck -p tsconfig.test.json",
|
|
49
|
-
"test:unit": "vitest run"
|
|
50
|
-
"test": "pnpm run test:types && pnpm run test:unit"
|
|
54
|
+
"test:unit": "vitest run"
|
|
51
55
|
}
|
|
52
56
|
}
|
package/lib/directed-crypto.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { ByteTransform, Unwrap } from '@kumiai/broadcast';
|
|
2
|
-
import type { MailboxHub } from '@kumiai/hub-tunnel';
|
|
3
|
-
export type SealDirectedHubParams = {
|
|
4
|
-
hub: MailboxHub;
|
|
5
|
-
wrap: ByteTransform;
|
|
6
|
-
unwrap: Unwrap;
|
|
7
|
-
/** When set, inbound frames whose recovered senderDID != this are dropped. */
|
|
8
|
-
expectedSenderDID?: string;
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* Wrap a MailboxHub so directed frames are sealed with `wrap` on publish and opened
|
|
12
|
-
* with `unwrap` on receive. The recovered MLS `senderDID` replaces the
|
|
13
|
-
* hub-asserted one (a lying hub cannot forge it); frames that fail to open,
|
|
14
|
-
* that unwrap without a recovered sender, or whose recovered sender !=
|
|
15
|
-
* `expectedSenderDID`, are dropped.
|
|
16
|
-
*/
|
|
17
|
-
export declare function sealDirectedHub(params: SealDirectedHubParams): MailboxHub;
|
package/lib/directed-crypto.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
function normalizeUnwrap(result) {
|
|
2
|
-
return result instanceof Uint8Array ? {
|
|
3
|
-
payload: result
|
|
4
|
-
} : result;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Wrap a MailboxHub so directed frames are sealed with `wrap` on publish and opened
|
|
8
|
-
* with `unwrap` on receive. The recovered MLS `senderDID` replaces the
|
|
9
|
-
* hub-asserted one (a lying hub cannot forge it); frames that fail to open,
|
|
10
|
-
* that unwrap without a recovered sender, or whose recovered sender !=
|
|
11
|
-
* `expectedSenderDID`, are dropped.
|
|
12
|
-
*/ export function sealDirectedHub(params) {
|
|
13
|
-
const { hub, wrap, unwrap, expectedSenderDID } = params;
|
|
14
|
-
return {
|
|
15
|
-
async publish (publishParams) {
|
|
16
|
-
const sealed = await wrap(publishParams.payload);
|
|
17
|
-
return hub.publish({
|
|
18
|
-
senderDID: publishParams.senderDID,
|
|
19
|
-
topicID: publishParams.topicID,
|
|
20
|
-
payload: sealed
|
|
21
|
-
});
|
|
22
|
-
},
|
|
23
|
-
subscribe: (subscriberDID, topicID)=>hub.subscribe(subscriberDID, topicID),
|
|
24
|
-
unsubscribe: (subscriberDID, topicID)=>hub.unsubscribe?.(subscriberDID, topicID),
|
|
25
|
-
receive (subscriberDID) {
|
|
26
|
-
const inner = hub.receive(subscriberDID);
|
|
27
|
-
const innerIterator = inner[Symbol.asyncIterator]();
|
|
28
|
-
const iterator = {
|
|
29
|
-
async next () {
|
|
30
|
-
while(true){
|
|
31
|
-
const result = await innerIterator.next();
|
|
32
|
-
if (result.done) {
|
|
33
|
-
return {
|
|
34
|
-
value: undefined,
|
|
35
|
-
done: true
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
const message = result.value;
|
|
39
|
-
let opened;
|
|
40
|
-
try {
|
|
41
|
-
opened = normalizeUnwrap(await unwrap(message.payload));
|
|
42
|
-
} catch {
|
|
43
|
-
continue; // un-openable (garbage / another lane) — drop
|
|
44
|
-
}
|
|
45
|
-
if (opened.senderDID == null) {
|
|
46
|
-
continue; // no authenticated sender — never fall back to the hub-asserted one
|
|
47
|
-
}
|
|
48
|
-
if (expectedSenderDID != null && opened.senderDID !== expectedSenderDID) {
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
return {
|
|
52
|
-
value: {
|
|
53
|
-
sequenceID: message.sequenceID,
|
|
54
|
-
senderDID: opened.senderDID,
|
|
55
|
-
topicID: message.topicID,
|
|
56
|
-
payload: opened.payload
|
|
57
|
-
},
|
|
58
|
-
done: false
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
return () {
|
|
63
|
-
innerIterator.return?.();
|
|
64
|
-
return Promise.resolve({
|
|
65
|
-
value: undefined,
|
|
66
|
-
done: true
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
return {
|
|
71
|
-
[Symbol.asyncIterator] () {
|
|
72
|
-
return iterator;
|
|
73
|
-
},
|
|
74
|
-
return () {
|
|
75
|
-
inner.return?.();
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
}
|