@kumiai/rpc 0.2.0 → 0.3.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/lib/classify.d.ts +132 -0
- package/lib/classify.js +48 -0
- package/lib/commit-frame.d.ts +32 -0
- package/lib/commit-frame.js +43 -0
- package/lib/commit.d.ts +188 -0
- package/lib/commit.js +50 -0
- package/lib/crypto.d.ts +201 -37
- package/lib/crypto.js +16 -8
- package/lib/cursor.d.ts +33 -0
- package/lib/cursor.js +26 -0
- package/lib/directed-crypto.d.ts +4 -4
- package/lib/directed-crypto.js +1 -1
- package/lib/directed.d.ts +5 -6
- package/lib/directed.js +10 -13
- package/lib/handshake.d.ts +13 -6
- package/lib/handshake.js +12 -7
- package/lib/hub-mux.d.ts +51 -12
- package/lib/hub-mux.js +66 -26
- package/lib/index.d.ts +9 -5
- package/lib/index.js +8 -3
- package/lib/ledger-entries.d.ts +22 -0
- package/lib/ledger-entries.js +78 -0
- package/lib/peer.d.ts +105 -15
- package/lib/peer.js +1002 -105
- package/lib/recovery.d.ts +24 -2
- package/lib/recovery.js +66 -54
- package/lib/topic.d.ts +18 -7
- package/lib/topic.js +18 -7
- package/package.json +5 -4
- package/lib/memory-group-mls.d.ts +0 -23
- package/lib/memory-group-mls.js +0 -75
package/lib/recovery.d.ts
CHANGED
|
@@ -1,10 +1,32 @@
|
|
|
1
|
-
export declare function encodeRecoveryRequest(requestID: string,
|
|
1
|
+
export declare function encodeRecoveryRequest(requestID: string, request: Uint8Array): Uint8Array;
|
|
2
2
|
export declare function decodeRecoveryRequest(payload: Uint8Array): {
|
|
3
3
|
requestID: string;
|
|
4
|
-
|
|
4
|
+
request: Uint8Array;
|
|
5
5
|
};
|
|
6
6
|
export declare function encodeRecoveryReply(requestID: string, groupInfo: Uint8Array): Uint8Array;
|
|
7
7
|
export declare function decodeRecoveryReply(payload: Uint8Array): {
|
|
8
8
|
requestID: string;
|
|
9
9
|
groupInfo: Uint8Array;
|
|
10
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* A ledger gather carries the port's signed request blob, as a recovery request does: it is
|
|
13
|
+
* what a responder authorizes against and the only key it will seal to. A request with no blob
|
|
14
|
+
* is from nobody, and every responder refuses it.
|
|
15
|
+
*/
|
|
16
|
+
export declare function encodeLedgerRequest(requestID: string, request: Uint8Array): Uint8Array;
|
|
17
|
+
export declare function decodeLedgerRequest(payload: Uint8Array): {
|
|
18
|
+
requestID: string;
|
|
19
|
+
request: Uint8Array;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* A responder's whole ordered ledger, SEALED to the ephemeral key inside the request it
|
|
23
|
+
* answers. The lane carries the bytes and reads none of them.
|
|
24
|
+
*
|
|
25
|
+
* Order is inside the seal and load-bearing: the head is a chain digest, so a permuted list of
|
|
26
|
+
* the same tokens folds to a different head and the requester rejects it.
|
|
27
|
+
*/
|
|
28
|
+
export declare function encodeLedgerReply(requestID: string, sealed: Uint8Array): Uint8Array;
|
|
29
|
+
export declare function decodeLedgerReply(payload: Uint8Array): {
|
|
30
|
+
requestID: string;
|
|
31
|
+
sealed: Uint8Array;
|
|
32
|
+
};
|
package/lib/recovery.js
CHANGED
|
@@ -1,78 +1,90 @@
|
|
|
1
1
|
import { fromUTF, toUTF } from '@sozai/codec';
|
|
2
2
|
/**
|
|
3
|
-
* Payload codecs for the
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
3
|
+
* Payload codecs for the rendezvous carried on the handshake lane.
|
|
4
|
+
*
|
|
5
|
+
* A request names a `requestID` (reply correlation + responder observe-and-suppress) and carries
|
|
6
|
+
* the port's signed request blob, which the peer never reads. Requester DID and the ephemeral
|
|
7
|
+
* key its reply must be sealed to live INSIDE that signed blob, never in a peer-added field — a
|
|
8
|
+
* field beside the token would offer the responder an unsigned DID to seal against.
|
|
9
|
+
*
|
|
10
|
+
* The ledger gather is the same rendezvous reversed and carries the SAME signed blob: the topic
|
|
11
|
+
* is public and secretless, so an unnamed request is one anyone can mint, and an unsealed reply
|
|
12
|
+
* puts the group's whole authority state in the clear.
|
|
7
13
|
*/ /** Cap on decoded ID lengths — these become attacker-controlled map keys. */ const MAX_REQUEST_ID_BYTES = 128;
|
|
8
|
-
|
|
9
|
-
export function encodeRecoveryRequest(requestID, requesterDID) {
|
|
14
|
+
function encodeWithRequestID(requestID, payload, label) {
|
|
10
15
|
const rid = fromUTF(requestID);
|
|
11
|
-
const did = fromUTF(requesterDID);
|
|
12
16
|
if (rid.length > MAX_REQUEST_ID_BYTES) {
|
|
13
|
-
throw new Error(
|
|
17
|
+
throw new Error(`${label} requestID is too long`);
|
|
14
18
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
const out = new Uint8Array(2 + rid.length + 2 + did.length);
|
|
19
|
-
const view = new DataView(out.buffer);
|
|
20
|
-
view.setUint16(0, rid.length, true);
|
|
19
|
+
const out = new Uint8Array(2 + rid.length + payload.length);
|
|
20
|
+
new DataView(out.buffer).setUint16(0, rid.length, true);
|
|
21
21
|
out.set(rid, 2);
|
|
22
|
-
|
|
23
|
-
out.set(did, 2 + rid.length + 2);
|
|
22
|
+
out.set(payload, 2 + rid.length);
|
|
24
23
|
return out;
|
|
25
24
|
}
|
|
26
|
-
|
|
27
|
-
const view = new DataView(payload.buffer, payload.byteOffset, payload.byteLength);
|
|
25
|
+
function decodeWithRequestID(payload, label) {
|
|
28
26
|
if (payload.length < 2) {
|
|
29
|
-
throw new Error(
|
|
27
|
+
throw new Error(`${label} is too short`);
|
|
30
28
|
}
|
|
31
|
-
const ridLen =
|
|
29
|
+
const ridLen = new DataView(payload.buffer, payload.byteOffset, payload.byteLength).getUint16(0, true);
|
|
32
30
|
if (ridLen > MAX_REQUEST_ID_BYTES) {
|
|
33
|
-
throw new Error(
|
|
34
|
-
}
|
|
35
|
-
if (payload.length < 2 + ridLen + 2) {
|
|
36
|
-
throw new Error('recovery request is truncated');
|
|
31
|
+
throw new Error(`${label} requestID is too long`);
|
|
37
32
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (didLen > MAX_REQUESTER_DID_BYTES) {
|
|
41
|
-
throw new Error('recovery request requesterDID is too long');
|
|
42
|
-
}
|
|
43
|
-
if (payload.length < 2 + ridLen + 2 + didLen) {
|
|
44
|
-
throw new Error('recovery request is truncated');
|
|
33
|
+
if (payload.length < 2 + ridLen) {
|
|
34
|
+
throw new Error(`${label} is truncated`);
|
|
45
35
|
}
|
|
46
|
-
|
|
36
|
+
return {
|
|
37
|
+
requestID: toUTF(payload.subarray(2, 2 + ridLen)),
|
|
38
|
+
rest: payload.subarray(2 + ridLen)
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export function encodeRecoveryRequest(requestID, request) {
|
|
42
|
+
return encodeWithRequestID(requestID, request, 'recovery request');
|
|
43
|
+
}
|
|
44
|
+
export function decodeRecoveryRequest(payload) {
|
|
45
|
+
const { requestID, rest } = decodeWithRequestID(payload, 'recovery request');
|
|
47
46
|
return {
|
|
48
47
|
requestID,
|
|
49
|
-
|
|
48
|
+
request: rest
|
|
50
49
|
};
|
|
51
50
|
}
|
|
52
51
|
export function encodeRecoveryReply(requestID, groupInfo) {
|
|
53
|
-
|
|
54
|
-
if (rid.length > MAX_REQUEST_ID_BYTES) {
|
|
55
|
-
throw new Error('recovery reply requestID is too long');
|
|
56
|
-
}
|
|
57
|
-
const out = new Uint8Array(2 + rid.length + groupInfo.length);
|
|
58
|
-
new DataView(out.buffer).setUint16(0, rid.length, true);
|
|
59
|
-
out.set(rid, 2);
|
|
60
|
-
out.set(groupInfo, 2 + rid.length);
|
|
61
|
-
return out;
|
|
52
|
+
return encodeWithRequestID(requestID, groupInfo, 'recovery reply');
|
|
62
53
|
}
|
|
63
54
|
export function decodeRecoveryReply(payload) {
|
|
64
|
-
|
|
65
|
-
throw new Error('recovery reply is too short');
|
|
66
|
-
}
|
|
67
|
-
const ridLen = new DataView(payload.buffer, payload.byteOffset, payload.byteLength).getUint16(0, true);
|
|
68
|
-
if (ridLen > MAX_REQUEST_ID_BYTES) {
|
|
69
|
-
throw new Error('recovery reply requestID is too long');
|
|
70
|
-
}
|
|
71
|
-
if (payload.length < 2 + ridLen) {
|
|
72
|
-
throw new Error('recovery reply is truncated');
|
|
73
|
-
}
|
|
55
|
+
const { requestID, rest } = decodeWithRequestID(payload, 'recovery reply');
|
|
74
56
|
return {
|
|
75
|
-
requestID
|
|
76
|
-
groupInfo:
|
|
57
|
+
requestID,
|
|
58
|
+
groupInfo: rest
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* A ledger gather carries the port's signed request blob, as a recovery request does: it is
|
|
63
|
+
* what a responder authorizes against and the only key it will seal to. A request with no blob
|
|
64
|
+
* is from nobody, and every responder refuses it.
|
|
65
|
+
*/ export function encodeLedgerRequest(requestID, request) {
|
|
66
|
+
return encodeWithRequestID(requestID, request, 'ledger request');
|
|
67
|
+
}
|
|
68
|
+
export function decodeLedgerRequest(payload) {
|
|
69
|
+
const { requestID, rest } = decodeWithRequestID(payload, 'ledger request');
|
|
70
|
+
return {
|
|
71
|
+
requestID,
|
|
72
|
+
request: rest
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* A responder's whole ordered ledger, SEALED to the ephemeral key inside the request it
|
|
77
|
+
* answers. The lane carries the bytes and reads none of them.
|
|
78
|
+
*
|
|
79
|
+
* Order is inside the seal and load-bearing: the head is a chain digest, so a permuted list of
|
|
80
|
+
* the same tokens folds to a different head and the requester rejects it.
|
|
81
|
+
*/ export function encodeLedgerReply(requestID, sealed) {
|
|
82
|
+
return encodeWithRequestID(requestID, sealed, 'ledger reply');
|
|
83
|
+
}
|
|
84
|
+
export function decodeLedgerReply(payload) {
|
|
85
|
+
const { requestID, rest } = decodeWithRequestID(payload, 'ledger reply');
|
|
86
|
+
return {
|
|
87
|
+
requestID,
|
|
88
|
+
sealed: rest
|
|
77
89
|
};
|
|
78
90
|
}
|
package/lib/topic.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/** Reserved label for per-member unicast inbox topics. */
|
|
2
2
|
export declare const INBOX_LABEL = "enkaku/inbox/v1";
|
|
3
|
-
/** Reserved label for the non-rotating MLS
|
|
4
|
-
export declare const
|
|
3
|
+
/** Reserved label for the non-rotating MLS commit topic. */
|
|
4
|
+
export declare const COMMIT_LABEL = "enkaku/commit/v1";
|
|
5
|
+
/** Reserved label for the non-rotating recovery-rendezvous topic. */
|
|
6
|
+
export declare const RENDEZVOUS_LABEL = "enkaku/rendezvous/v1";
|
|
5
7
|
/**
|
|
6
8
|
* Group-scoped broadcast/multicast topic for an application protocol. Opaque to
|
|
7
9
|
* the hub; derivable only by members holding the epoch secret. `scope`
|
|
@@ -15,12 +17,21 @@ export declare function protocolTopic(secret: Uint8Array, epoch: number, protoco
|
|
|
15
17
|
*/
|
|
16
18
|
export declare function inboxTopic(secret: Uint8Array, epoch: number, memberDID: string): string;
|
|
17
19
|
/**
|
|
18
|
-
* The non-rotating MLS
|
|
19
|
-
* epoch-independent recovery secret (epoch fixed at `0`)
|
|
20
|
-
*
|
|
21
|
-
*
|
|
20
|
+
* The non-rotating commit topic: MLS Commits only, retained as a log, read by pull. Derived
|
|
21
|
+
* from the epoch-independent recovery secret (epoch fixed at `0`), so it is stable for the
|
|
22
|
+
* group's life and a member stranded on any epoch can still derive it. Opaque to the hub.
|
|
23
|
+
*
|
|
24
|
+
* Separate from {@link rendezvousTopic}: the commit lane is a log whose head every commit
|
|
25
|
+
* moves, the rendezvous lane is a mailbox whose frames must never move a head.
|
|
22
26
|
*/
|
|
23
|
-
export declare function
|
|
27
|
+
export declare function commitTopic(recoverySecret: Uint8Array): string;
|
|
28
|
+
/**
|
|
29
|
+
* The non-rotating recovery-rendezvous topic: recovery request/reply, published
|
|
30
|
+
* unconditionally and pushed. Derived from the same epoch-independent recovery secret, so a
|
|
31
|
+
* stranded peer always shares it with the live group. Mailbox semantics: a requester
|
|
32
|
+
* subscribes before it asks, so it cannot miss its own reply. Opaque to the hub.
|
|
33
|
+
*/
|
|
34
|
+
export declare function rendezvousTopic(recoverySecret: Uint8Array): string;
|
|
24
35
|
/**
|
|
25
36
|
* Public, secretless pre-group rendezvous topic (invite / keypackage / Welcome).
|
|
26
37
|
* `b64url(SHA-256(DISCOVERY_PREFIX ‖ SEP ‖ memberDID))` — intentionally
|
package/lib/topic.js
CHANGED
|
@@ -2,7 +2,8 @@ import { deriveTopicID } from '@kumiai/broadcast';
|
|
|
2
2
|
import { sha256 } from '@noble/hashes/sha2.js';
|
|
3
3
|
import { fromUTF, toB64U } from '@sozai/codec';
|
|
4
4
|
/** Reserved label for per-member unicast inbox topics. */ export const INBOX_LABEL = 'enkaku/inbox/v1';
|
|
5
|
-
/** Reserved label for the non-rotating MLS
|
|
5
|
+
/** Reserved label for the non-rotating MLS commit topic. */ export const COMMIT_LABEL = 'enkaku/commit/v1';
|
|
6
|
+
/** Reserved label for the non-rotating recovery-rendezvous topic. */ export const RENDEZVOUS_LABEL = 'enkaku/rendezvous/v1';
|
|
6
7
|
const DISCOVERY_PREFIX = 'enkaku/discovery/v1';
|
|
7
8
|
const SEP = '\0';
|
|
8
9
|
/**
|
|
@@ -20,12 +21,22 @@ const SEP = '\0';
|
|
|
20
21
|
return deriveTopicID(secret, epoch, INBOX_LABEL, memberDID);
|
|
21
22
|
}
|
|
22
23
|
/**
|
|
23
|
-
* The non-rotating MLS
|
|
24
|
-
* epoch-independent recovery secret (epoch fixed at `0`)
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
* The non-rotating commit topic: MLS Commits only, retained as a log, read by pull. Derived
|
|
25
|
+
* from the epoch-independent recovery secret (epoch fixed at `0`), so it is stable for the
|
|
26
|
+
* group's life and a member stranded on any epoch can still derive it. Opaque to the hub.
|
|
27
|
+
*
|
|
28
|
+
* Separate from {@link rendezvousTopic}: the commit lane is a log whose head every commit
|
|
29
|
+
* moves, the rendezvous lane is a mailbox whose frames must never move a head.
|
|
30
|
+
*/ export function commitTopic(recoverySecret) {
|
|
31
|
+
return deriveTopicID(recoverySecret, 0, COMMIT_LABEL);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The non-rotating recovery-rendezvous topic: recovery request/reply, published
|
|
35
|
+
* unconditionally and pushed. Derived from the same epoch-independent recovery secret, so a
|
|
36
|
+
* stranded peer always shares it with the live group. Mailbox semantics: a requester
|
|
37
|
+
* subscribes before it asks, so it cannot miss its own reply. Opaque to the hub.
|
|
38
|
+
*/ export function rendezvousTopic(recoverySecret) {
|
|
39
|
+
return deriveTopicID(recoverySecret, 0, RENDEZVOUS_LABEL);
|
|
29
40
|
}
|
|
30
41
|
/**
|
|
31
42
|
* Public, secretless pre-group rendezvous topic (invite / keypackage / Welcome).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kumiai/rpc",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "High-level MLS-aware group RPC for Enkaku: bus broadcast/anycast/gather plus directed RPC over the pub/sub hub",
|
|
6
6
|
"keywords": [
|
|
@@ -32,11 +32,12 @@
|
|
|
32
32
|
"@enkaku/server": "^0.19.0",
|
|
33
33
|
"@enkaku/transport": "^0.19.1",
|
|
34
34
|
"@noble/hashes": "^2.0.0",
|
|
35
|
-
"@kumiai/
|
|
36
|
-
"@kumiai/
|
|
37
|
-
"@kumiai/hub-
|
|
35
|
+
"@kumiai/broadcast": "^0.3.0",
|
|
36
|
+
"@kumiai/hub-tunnel": "^0.3.0",
|
|
37
|
+
"@kumiai/hub-protocol": "^0.3.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
+
"@noble/curves": "^2.0.1",
|
|
40
41
|
"vitest": "^4.1.10"
|
|
41
42
|
},
|
|
42
43
|
"scripts": {
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { GroupMLS } from './crypto.js';
|
|
2
|
-
export type MemoryGroupMLS = GroupMLS & {
|
|
3
|
-
epoch: () => number;
|
|
4
|
-
commits: () => number;
|
|
5
|
-
lastSender: () => string | undefined;
|
|
6
|
-
};
|
|
7
|
-
export type MemoryGroupMLSOptions = {
|
|
8
|
-
recoverySecret?: Uint8Array;
|
|
9
|
-
epoch?: number;
|
|
10
|
-
/** This member's DID — modelled recipient of GroupInfo sealed to its leaf. */
|
|
11
|
-
localDID?: string;
|
|
12
|
-
/** Called whenever the modelled epoch advances (e.g. to keep a GroupCrypto in step). */
|
|
13
|
-
onAdvance?: (epoch: number) => void;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* In-memory {@link GroupMLS} for exercising peer orchestration WITHOUT real MLS —
|
|
17
|
-
* the group-rpc analogue of `createMemoryBus`. It models a single epoch counter:
|
|
18
|
-
* a non-empty Commit advances it; GroupInfo carries the epoch so a stranded peer
|
|
19
|
-
* can jump forward. The recovery secret is fixed for the instance's life
|
|
20
|
-
* (epoch-independent). NOT real cryptography — a test double for wiring, not a
|
|
21
|
-
* production implementation (a real port adapts a live MLS group).
|
|
22
|
-
*/
|
|
23
|
-
export declare function createMemoryGroupMLS(options?: MemoryGroupMLSOptions): MemoryGroupMLS;
|
package/lib/memory-group-mls.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { fromUTF, toUTF } from '@sozai/codec';
|
|
2
|
-
/**
|
|
3
|
-
* In-memory {@link GroupMLS} for exercising peer orchestration WITHOUT real MLS —
|
|
4
|
-
* the group-rpc analogue of `createMemoryBus`. It models a single epoch counter:
|
|
5
|
-
* a non-empty Commit advances it; GroupInfo carries the epoch so a stranded peer
|
|
6
|
-
* can jump forward. The recovery secret is fixed for the instance's life
|
|
7
|
-
* (epoch-independent). NOT real cryptography — a test double for wiring, not a
|
|
8
|
-
* production implementation (a real port adapts a live MLS group).
|
|
9
|
-
*/ export function createMemoryGroupMLS(options = {}) {
|
|
10
|
-
const recoverySecret = options.recoverySecret ?? new Uint8Array(32).fill(0x33);
|
|
11
|
-
const localDID = options.localDID;
|
|
12
|
-
let epoch = options.epoch ?? 0;
|
|
13
|
-
let commits = 0;
|
|
14
|
-
let lastSender;
|
|
15
|
-
const advance = (to)=>{
|
|
16
|
-
epoch = to;
|
|
17
|
-
options.onAdvance?.(epoch);
|
|
18
|
-
};
|
|
19
|
-
// Seal = [didLen(2)][requesterDID][epoch(1)]. NOT real crypto — a test double
|
|
20
|
-
// that models "only the sealed-to member can open it".
|
|
21
|
-
const seal = (requesterDID, epochByte)=>{
|
|
22
|
-
const did = fromUTF(requesterDID);
|
|
23
|
-
const out = new Uint8Array(2 + did.length + 1);
|
|
24
|
-
new DataView(out.buffer).setUint16(0, did.length, true);
|
|
25
|
-
out.set(did, 2);
|
|
26
|
-
out[2 + did.length] = epochByte;
|
|
27
|
-
return out;
|
|
28
|
-
};
|
|
29
|
-
const open = (sealed)=>{
|
|
30
|
-
if (sealed.length < 3) return undefined;
|
|
31
|
-
const didLen = new DataView(sealed.buffer, sealed.byteOffset, sealed.byteLength).getUint16(0, true);
|
|
32
|
-
if (sealed.length < 2 + didLen + 1) return undefined;
|
|
33
|
-
const sealedTo = toUTF(sealed.subarray(2, 2 + didLen));
|
|
34
|
-
// A member with a set localDID can open only bytes sealed to it. When unset,
|
|
35
|
-
// the double is permissive (used by wiring tests that don't assert sealing).
|
|
36
|
-
if (localDID != null && sealedTo !== localDID) return undefined;
|
|
37
|
-
return sealed[2 + didLen];
|
|
38
|
-
};
|
|
39
|
-
return {
|
|
40
|
-
epoch: ()=>epoch,
|
|
41
|
-
commits: ()=>commits,
|
|
42
|
-
lastSender: ()=>lastSender,
|
|
43
|
-
async processCommit (commit, context) {
|
|
44
|
-
lastSender = context.senderDID;
|
|
45
|
-
if (commit.length === 0) {
|
|
46
|
-
return {
|
|
47
|
-
advanced: false
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
commits += 1;
|
|
51
|
-
advance(epoch + 1);
|
|
52
|
-
return {
|
|
53
|
-
advanced: true
|
|
54
|
-
};
|
|
55
|
-
},
|
|
56
|
-
async exportGroupInfo (requesterDID) {
|
|
57
|
-
return seal(requesterDID, epoch);
|
|
58
|
-
},
|
|
59
|
-
async applyRecovery (groupInfo) {
|
|
60
|
-
const target = open(groupInfo);
|
|
61
|
-
if (target == null || target <= epoch) {
|
|
62
|
-
return {
|
|
63
|
-
advanced: false
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
advance(target);
|
|
67
|
-
return {
|
|
68
|
-
advanced: true
|
|
69
|
-
};
|
|
70
|
-
},
|
|
71
|
-
exportRecoverySecret () {
|
|
72
|
-
return recoverySecret;
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
}
|