@celljs/ta-relay 4.19.0 → 4.21.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/esm/common/index.d.ts +1 -0
- package/esm/common/index.js +1 -0
- package/esm/common/relay-account-client.d.ts +4 -0
- package/esm/common/relay-account-client.js +13 -3
- package/esm/common/relay-account.d.ts +17 -2
- package/esm/common/relay-account.js +15 -6
- package/esm/common/relay-accounts.d.ts +2 -0
- package/esm/common/relay-accounts.js +16 -2
- package/esm/common/relay-group-invites.d.ts +6 -2
- package/esm/common/relay-group-invites.js +6 -5
- package/esm/common/relay-hub-charter.d.ts +74 -0
- package/esm/common/relay-hub-charter.js +149 -0
- package/esm/common/relay-hub-epochs.d.ts +43 -0
- package/esm/common/relay-hub-epochs.js +92 -0
- package/esm/common/relay-hub-util.d.ts +39 -7
- package/esm/common/relay-hub-util.js +46 -15
- package/esm/common/relay-hub.d.ts +13 -0
- package/esm/common/relay-hub.js +81 -18
- package/esm/common/relay-hubs-admins.d.ts +27 -0
- package/esm/common/relay-hubs-admins.js +91 -0
- package/esm/common/relay-hubs-connection.d.ts +21 -63
- package/esm/common/relay-hubs-connection.js +103 -87
- package/esm/common/relay-hubs-identity.d.ts +29 -1
- package/esm/common/relay-hubs-identity.js +109 -1
- package/esm/common/relay-hubs-live.d.ts +58 -0
- package/esm/common/relay-hubs-live.js +27 -0
- package/esm/common/relay-hubs-protocol.d.ts +10 -0
- package/esm/common/relay-hubs-util.d.ts +9 -0
- package/esm/common/relay-hubs-util.js +23 -1
- package/esm/common/relay-hubs.d.ts +12 -15
- package/esm/common/relay-hubs.js +60 -57
- package/esm/common/relay-identity.d.ts +7 -0
- package/esm/common/relay-identity.js +8 -0
- package/esm/common/relay-protocol.d.ts +21 -3
- package/esm/common/relay-protocol.js +8 -1
- package/esm/common/relay-room-chat.d.ts +6 -1
- package/esm/common/relay-room-chat.js +1 -0
- package/esm/node/relay-server-accounts.d.ts +1 -1
- package/esm/node/relay-server-accounts.js +1 -1
- package/lib/common/index.d.ts +1 -0
- package/lib/common/index.js +1 -0
- package/lib/common/relay-account-client.d.ts +4 -0
- package/lib/common/relay-account-client.js +13 -3
- package/lib/common/relay-account.d.ts +17 -2
- package/lib/common/relay-account.js +15 -6
- package/lib/common/relay-accounts.d.ts +2 -0
- package/lib/common/relay-accounts.js +16 -2
- package/lib/common/relay-group-invites.d.ts +6 -2
- package/lib/common/relay-group-invites.js +6 -5
- package/lib/common/relay-hub-charter.d.ts +75 -0
- package/lib/common/relay-hub-charter.js +152 -0
- package/lib/common/relay-hub-epochs.d.ts +44 -0
- package/lib/common/relay-hub-epochs.js +95 -0
- package/lib/common/relay-hub-util.d.ts +39 -7
- package/lib/common/relay-hub-util.js +46 -15
- package/lib/common/relay-hub.d.ts +13 -0
- package/lib/common/relay-hub.js +81 -18
- package/lib/common/relay-hubs-admins.d.ts +28 -0
- package/lib/common/relay-hubs-admins.js +95 -0
- package/lib/common/relay-hubs-connection.d.ts +21 -63
- package/lib/common/relay-hubs-connection.js +109 -94
- package/lib/common/relay-hubs-identity.d.ts +29 -1
- package/lib/common/relay-hubs-identity.js +109 -1
- package/lib/common/relay-hubs-live.d.ts +59 -0
- package/lib/common/relay-hubs-live.js +31 -0
- package/lib/common/relay-hubs-protocol.d.ts +10 -0
- package/lib/common/relay-hubs-util.d.ts +9 -0
- package/lib/common/relay-hubs-util.js +23 -1
- package/lib/common/relay-hubs.d.ts +12 -15
- package/lib/common/relay-hubs.js +66 -63
- package/lib/common/relay-identity.d.ts +7 -0
- package/lib/common/relay-identity.js +8 -0
- package/lib/common/relay-protocol.d.ts +21 -3
- package/lib/common/relay-protocol.js +9 -2
- package/lib/common/relay-room-chat.d.ts +6 -1
- package/lib/common/relay-room-chat.js +1 -0
- package/lib/node/relay-server-accounts.d.ts +1 -1
- package/lib/node/relay-server-accounts.js +1 -1
- package/package.json +3 -3
- package/viewer/join.html +6 -6
- package/viewer/page.html +12 -12
- package/viewer/room.html +15 -15
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export const MAX_RECONNECT_MS = 30000;
|
|
2
|
+
export const SKEW_MS = 5 * 60 * 1000;
|
|
3
|
+
/** How long a call waits for the room to be connected, or for the relay to answer. */
|
|
4
|
+
export const READY_MS = 15000;
|
|
5
|
+
export const OPEN = 1;
|
|
6
|
+
/** A room as this Ta holds it while it runs: its connection and what it knows of the room. */
|
|
7
|
+
export class Live {
|
|
8
|
+
constructor(record) {
|
|
9
|
+
this.record = record;
|
|
10
|
+
this.synced = false;
|
|
11
|
+
this.online = new Set();
|
|
12
|
+
this.state = new Map();
|
|
13
|
+
/** Asks to join, with the invitation each came with. */
|
|
14
|
+
this.asks = new Map();
|
|
15
|
+
this.done = new Map();
|
|
16
|
+
this.ready = [];
|
|
17
|
+
this.attempts = 0;
|
|
18
|
+
/** Connect again at once, whatever the close said. */
|
|
19
|
+
this.retry = false;
|
|
20
|
+
this.awaitingPong = false;
|
|
21
|
+
/** The keys of the latest epoch this Ta sealed for each member (RelayHubEpochs.seal). */
|
|
22
|
+
this.sealedEpochs = new Map();
|
|
23
|
+
/** Events are handled one after another: opening them is async. */
|
|
24
|
+
this.chain = Promise.resolve();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=relay-hubs-live.js.map
|
|
@@ -14,6 +14,10 @@ export interface RelayRoomRecord {
|
|
|
14
14
|
token: string;
|
|
15
15
|
/** base64url, 32 bytes: the key of the room, once admitted. */
|
|
16
16
|
key?: string;
|
|
17
|
+
/** The keys of the epochs after the first, by number, the latest kept (docs/design/ta-link.md 8.7). */
|
|
18
|
+
epochs?: Record<string, string>;
|
|
19
|
+
/** The version of the latest roster taken: an older one, served again, is not. */
|
|
20
|
+
rosterV?: number;
|
|
17
21
|
/** The owner: all of it once admitted (its keys check the roster), its id and name from the link before. */
|
|
18
22
|
owner: Pick<RelayPublicIdentity, 'id' | 'name'> & Partial<RelayPublicIdentity>;
|
|
19
23
|
/** This Ta made the room. */
|
|
@@ -63,6 +67,8 @@ export interface RelayRoomMember {
|
|
|
63
67
|
/** The look of its double (RelayPublicIdentity.look). */
|
|
64
68
|
look?: string;
|
|
65
69
|
owner: boolean;
|
|
70
|
+
/** An admin the owner made (docs/design/ta-link.md 8). */
|
|
71
|
+
admin?: true;
|
|
66
72
|
online: boolean;
|
|
67
73
|
self: boolean;
|
|
68
74
|
/** In a browser, without Ta: it only chats (docs/design/ta-link.md 3.8). */
|
|
@@ -77,8 +83,12 @@ export interface RelayRoomInfo {
|
|
|
77
83
|
/** The relay it is on. */
|
|
78
84
|
relay: string;
|
|
79
85
|
owner: boolean;
|
|
86
|
+
/** This Ta is an admin of the room: it lets in, takes out and invites, as the owner. */
|
|
87
|
+
admin?: true;
|
|
80
88
|
/** Of a room this Ta made: the members it lets in at most. */
|
|
81
89
|
capacity?: number;
|
|
90
|
+
/** The rules its owner set, for all (RelayHubRules); none when it set none. */
|
|
91
|
+
rules?: Record<string, boolean>;
|
|
82
92
|
ownerName: string;
|
|
83
93
|
status: RelayRoomStatus;
|
|
84
94
|
reason?: RelayRoomRecord['reason'];
|
|
@@ -8,4 +8,13 @@ export declare namespace RelayHubsUtil {
|
|
|
8
8
|
* key and the owner's keys once either has them, the invitations of both, made once either made it.
|
|
9
9
|
*/
|
|
10
10
|
function merge(local: RelayRoomRecord, other: RelayRoomRecord): RelayRoomRecord;
|
|
11
|
+
/**
|
|
12
|
+
* Whether a key of the state names another member than the one who set it (docs/design/ta-link.md 8.8): a key naming
|
|
13
|
+
* a member (`chat:<member>:<n>`, `agents:<member>`, a like of a post) is theirs alone; the owner of the room may only
|
|
14
|
+
* clear it. Keys naming nobody (a game's) are anyone's.
|
|
15
|
+
*/
|
|
16
|
+
function foreign(members: readonly {
|
|
17
|
+
member: string;
|
|
18
|
+
owner?: boolean;
|
|
19
|
+
}[], key: string, by: string, value: unknown): boolean;
|
|
11
20
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { RelayHubEpochs } from './relay-hub-epochs.js';
|
|
1
2
|
/** How far a membership has come: one computer heard it end, it ended for both. */
|
|
2
3
|
const STATUS_RANK = { waiting: 0, member: 1, refused: 2, gone: 3 };
|
|
3
4
|
export var RelayHubsUtil;
|
|
@@ -34,7 +35,7 @@ export var RelayHubsUtil;
|
|
|
34
35
|
* key and the owner's keys once either has them, the invitations of both, made once either made it.
|
|
35
36
|
*/
|
|
36
37
|
function merge(local, other) {
|
|
37
|
-
var _a, _b, _c, _d, _e, _f;
|
|
38
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
38
39
|
const ahead = STATUS_RANK[other.status] > STATUS_RANK[local.status] ? other : local;
|
|
39
40
|
const behind = ahead === local ? other : local;
|
|
40
41
|
const invites = [...((_a = local.invites) !== null && _a !== void 0 ? _a : []), ...((_b = other.invites) !== null && _b !== void 0 ? _b : [])]
|
|
@@ -51,7 +52,12 @@ export var RelayHubsUtil;
|
|
|
51
52
|
const key = (_c = ahead.key) !== null && _c !== void 0 ? _c : behind.key;
|
|
52
53
|
const joinedAt = Math.max((_d = local.joinedAt) !== null && _d !== void 0 ? _d : 0, (_e = other.joinedAt) !== null && _e !== void 0 ? _e : 0);
|
|
53
54
|
const identity = (_f = local.identity) !== null && _f !== void 0 ? _f : other.identity;
|
|
55
|
+
// The keys of the epochs either has (docs/design/ta-link.md 8.7), the latest kept.
|
|
56
|
+
const epochs = RelayHubEpochs.kept({ ...behind.epochs, ...ahead.epochs, ...local.epochs, ...other.epochs });
|
|
57
|
+
const rosterV = Math.max((_g = local.rosterV) !== null && _g !== void 0 ? _g : 0, (_h = other.rosterV) !== null && _h !== void 0 ? _h : 0);
|
|
54
58
|
delete merged.key;
|
|
59
|
+
delete merged.epochs;
|
|
60
|
+
delete merged.rosterV;
|
|
55
61
|
delete merged.invites;
|
|
56
62
|
delete merged.joinedAt;
|
|
57
63
|
delete merged.identity;
|
|
@@ -63,6 +69,8 @@ export var RelayHubsUtil;
|
|
|
63
69
|
return {
|
|
64
70
|
...merged,
|
|
65
71
|
...(key && (merged.status === 'member' || merged.status === 'waiting') ? { key } : {}),
|
|
72
|
+
...(key && merged.status === 'member' && Object.keys(epochs).length ? { epochs } : {}),
|
|
73
|
+
...(rosterV ? { rosterV } : {}),
|
|
66
74
|
...(invites.length ? { invites } : {}),
|
|
67
75
|
...(local.made || other.made ? { made: true } : {}),
|
|
68
76
|
...(joinedAt ? { joinedAt } : {}),
|
|
@@ -70,5 +78,19 @@ export var RelayHubsUtil;
|
|
|
70
78
|
};
|
|
71
79
|
}
|
|
72
80
|
RelayHubsUtil.merge = merge;
|
|
81
|
+
/**
|
|
82
|
+
* Whether a key of the state names another member than the one who set it (docs/design/ta-link.md 8.8): a key naming
|
|
83
|
+
* a member (`chat:<member>:<n>`, `agents:<member>`, a like of a post) is theirs alone; the owner of the room may only
|
|
84
|
+
* clear it. Keys naming nobody (a game's) are anyone's.
|
|
85
|
+
*/
|
|
86
|
+
function foreign(members, key, by, value) {
|
|
87
|
+
const parts = new Set(key.split(':'));
|
|
88
|
+
const named = members.find(member => parts.has(member.member));
|
|
89
|
+
if (!named || named.member === by) {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
return !(value === null && members.some(member => member.member === by && member.owner));
|
|
93
|
+
}
|
|
94
|
+
RelayHubsUtil.foreign = foreign;
|
|
73
95
|
})(RelayHubsUtil || (RelayHubsUtil = {}));
|
|
74
96
|
//# sourceMappingURL=relay-hubs-util.js.map
|
|
@@ -2,9 +2,9 @@ import { RelayFriendSends, type RelayFriendShare } from './relay-friend-sends.js
|
|
|
2
2
|
import { RelayFriends } from './relay-friends.js';
|
|
3
3
|
import { type RelayGroupInvite, RelayGroupInvites } from './relay-group-invites.js';
|
|
4
4
|
import { type RelayHubAskBody } from './relay-hub-util.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import type { RelayFriend, RelayFriendInfo, RelayFriendRequest, RelayRoomEvent, RelayRoomInfo, RelayRoomRequest, RelayRoomValue } from './relay-hubs-protocol.js';
|
|
5
|
+
import { RelayHubsAdmins } from './relay-hubs-admins.js';
|
|
6
|
+
import { Live } from './relay-hubs-live.js';
|
|
7
|
+
import type { RelayFriend, RelayFriendInfo, RelayFriendRequest, RelayRoomEvent, RelayRoomInfo, RelayRoomRecord, RelayRoomRequest, RelayRoomValue } from './relay-hubs-protocol.js';
|
|
8
8
|
import { type RelayPublicIdentity } from './relay-identity.js';
|
|
9
9
|
/**
|
|
10
10
|
* The rooms of this Ta (docs/design/ta-link.md 3): its identity and friends, the rooms it made or asked to join,
|
|
@@ -12,7 +12,7 @@ import { type RelayPublicIdentity } from './relay-identity.js';
|
|
|
12
12
|
* the others; every message signed by its member and sealed with the key of the room. The friends are a room of
|
|
13
13
|
* their own (RelayFriends).
|
|
14
14
|
*/
|
|
15
|
-
export declare class RelayHubs extends
|
|
15
|
+
export declare class RelayHubs extends RelayHubsAdmins {
|
|
16
16
|
protected readonly book: RelayFriends;
|
|
17
17
|
protected readonly groups: RelayGroupInvites;
|
|
18
18
|
protected readonly sends: RelayFriendSends;
|
|
@@ -49,14 +49,7 @@ export declare class RelayHubs extends RelayHubsIdentity {
|
|
|
49
49
|
requests(): Promise<RelayRoomRequest[]>;
|
|
50
50
|
/** The user's answer to one asking to join: admitted, it gets the key of the room and is in the roster. */
|
|
51
51
|
answer(roomId: string, askId: string, accept: boolean): Promise<void>;
|
|
52
|
-
/**
|
|
53
|
-
* The owner's choices for a room: how many members it lets in at most (RELAY_ROOM_MAX_MEMBERS by default, 2 to
|
|
54
|
-
* RELAY_ROOM_CAPACITY_MAX), for one many come to (feedback from a browser). Those in already stay.
|
|
55
|
-
*/
|
|
56
|
-
configure(roomId: string, options: {
|
|
57
|
-
members?: number;
|
|
58
|
-
}): RelayRoomInfo;
|
|
59
|
-
/** The owner takes a member out: the relay closes it at once. */
|
|
52
|
+
/** The owner or an admin takes a member out: the relay closes it at once. An admin takes out neither the owner nor an admin. */
|
|
60
53
|
remove(roomId: string, member: string): Promise<void>;
|
|
61
54
|
/** Leaves the room; the owner closes it, for everyone. A room asked to join is forgotten. */
|
|
62
55
|
leave(roomId: string): Promise<void>;
|
|
@@ -72,6 +65,12 @@ export declare class RelayHubs extends RelayHubsIdentity {
|
|
|
72
65
|
ok: boolean;
|
|
73
66
|
version: number;
|
|
74
67
|
}>;
|
|
68
|
+
/**
|
|
69
|
+
* Whether a key of the state is this Ta's own, which no other member may replace or clear at the relay: one that
|
|
70
|
+
* names its member id (`chat:<member>:<n>`, `agents:<member>`, a like of a post), and every key of a room of
|
|
71
|
+
* friends it owns (its posts, what it sends its friends). Any other is shared, as a game's.
|
|
72
|
+
*/
|
|
73
|
+
static owns(record: Pick<RelayRoomRecord, 'member' | 'kind' | 'own'>, name: string): boolean;
|
|
75
74
|
/** Friends of the user's other computer, with those of this Ta. */
|
|
76
75
|
mergeFriends(friends: RelayFriend[]): number;
|
|
77
76
|
/** The friends, with their keys: each in the room of the other (shares to friends are sealed for them). */
|
|
@@ -109,14 +108,12 @@ export declare class RelayHubs extends RelayHubsIdentity {
|
|
|
109
108
|
friendShares(): Promise<RelayFriendShare[]>;
|
|
110
109
|
/** The user opened one (`keep`) or let it go. */
|
|
111
110
|
answerFriendShare(id: string, keep: boolean): void;
|
|
112
|
-
protected isFriends(live: Live): boolean;
|
|
113
111
|
protected friendIds(): Set<string>;
|
|
114
112
|
protected heardAsk(live: Live, ask: RelayHubAskBody): void;
|
|
113
|
+
protected foreignSet(live: Live, key: string): void;
|
|
115
114
|
protected heardMembers(members: RelayPublicIdentity[]): void;
|
|
116
115
|
protected offered(live: Live, from: RelayPublicIdentity, link: string): void;
|
|
117
116
|
/** What changes the friends: rooms coming and going, members, the links friends leave to join back. */
|
|
118
117
|
protected after(event: RelayRoomEvent): void;
|
|
119
|
-
protected owned(roomId: string): Live;
|
|
120
|
-
protected member(roomId: string): Live;
|
|
121
118
|
protected info(live: Live): RelayRoomInfo;
|
|
122
119
|
}
|
package/esm/common/relay-hubs.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { RelayFriendSends } from './relay-friend-sends.js';
|
|
2
2
|
import { RELAY_FRIENDS_KIND, RelayFriends, RelayFriendsUtil } from './relay-friends.js';
|
|
3
3
|
import { RelayGroupInvites } from './relay-group-invites.js';
|
|
4
|
+
import { RelayHubCharterUtil } from './relay-hub-charter.js';
|
|
4
5
|
import { RelayHubUtil } from './relay-hub-util.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
6
|
+
import { RelayHubsAdmins } from './relay-hubs-admins.js';
|
|
7
|
+
import { Live, OPEN, READY_MS } from './relay-hubs-live.js';
|
|
7
8
|
import { RelayIdentityUtil, RelayKeys } from './relay-identity.js';
|
|
8
|
-
import {
|
|
9
|
+
import { RELAY_INVITE_MAX_DAYS, RELAY_ROOM_MAX_MEMBERS } from './relay-protocol.js';
|
|
9
10
|
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
10
11
|
/**
|
|
11
12
|
* The rooms of this Ta (docs/design/ta-link.md 3): its identity and friends, the rooms it made or asked to join,
|
|
@@ -13,7 +14,7 @@ const DAY_MS = 24 * 60 * 60 * 1000;
|
|
|
13
14
|
* the others; every message signed by its member and sealed with the key of the room. The friends are a room of
|
|
14
15
|
* their own (RelayFriends).
|
|
15
16
|
*/
|
|
16
|
-
export class RelayHubs extends
|
|
17
|
+
export class RelayHubs extends RelayHubsAdmins {
|
|
17
18
|
constructor() {
|
|
18
19
|
super(...arguments);
|
|
19
20
|
this.book = new RelayFriends({
|
|
@@ -40,6 +41,10 @@ export class RelayHubs extends RelayHubsIdentity {
|
|
|
40
41
|
identity: () => this.identity(),
|
|
41
42
|
list: () => this.list(),
|
|
42
43
|
record: room => { var _a; return (_a = this.live.get(room)) === null || _a === void 0 ? void 0 : _a.record; },
|
|
44
|
+
manages: room => {
|
|
45
|
+
const live = this.live.get(room);
|
|
46
|
+
return !!live && this.manages(live);
|
|
47
|
+
},
|
|
43
48
|
save: () => this.save(),
|
|
44
49
|
friends: () => this.friends(),
|
|
45
50
|
friendRoom: () => this.friendRoom(),
|
|
@@ -142,14 +147,15 @@ export class RelayHubs extends RelayHubsIdentity {
|
|
|
142
147
|
async invite(roomId, options = {}) {
|
|
143
148
|
var _a;
|
|
144
149
|
var _b, _c;
|
|
145
|
-
const live = this.
|
|
150
|
+
const live = this.managed(roomId);
|
|
146
151
|
const identity = await this.identityOf(live);
|
|
147
152
|
const linkOf = (invite) => ({
|
|
148
153
|
link: RelayHubUtil.link({
|
|
149
154
|
relay: live.record.relay,
|
|
150
155
|
room: live.record.id,
|
|
151
156
|
invite: invite.secret,
|
|
152
|
-
owner:
|
|
157
|
+
// The owner's, whoever invites: the one who asks checks the answer against it (an admin's by the charter).
|
|
158
|
+
owner: live.record.owner.id,
|
|
153
159
|
title: live.record.title,
|
|
154
160
|
by: identity.name,
|
|
155
161
|
}),
|
|
@@ -223,9 +229,9 @@ export class RelayHubs extends RelayHubsIdentity {
|
|
|
223
229
|
}
|
|
224
230
|
/** The user's answer to one asking to join: admitted, it gets the key of the room and is in the roster. */
|
|
225
231
|
async answer(roomId, askId, accept) {
|
|
226
|
-
var _a;
|
|
227
|
-
var
|
|
228
|
-
const live = this.
|
|
232
|
+
var _a, _b;
|
|
233
|
+
var _c;
|
|
234
|
+
const live = this.managed(roomId);
|
|
229
235
|
const asked = live.asks.get(askId);
|
|
230
236
|
if (!asked) {
|
|
231
237
|
throw new Error('Nobody asks that now.');
|
|
@@ -238,17 +244,21 @@ export class RelayHubs extends RelayHubsIdentity {
|
|
|
238
244
|
const identity = await this.identityOf(live);
|
|
239
245
|
const body = {
|
|
240
246
|
key: live.record.key,
|
|
247
|
+
...(live.record.epochs && Object.keys(live.record.epochs).length ? { epochs: live.record.epochs } : {}),
|
|
241
248
|
kind: live.record.kind,
|
|
242
249
|
title: live.record.title,
|
|
243
250
|
...(live.record.view ? { view: live.record.view } : {}),
|
|
244
251
|
...(live.record.unlisted ? { unlisted: true } : {}),
|
|
245
252
|
};
|
|
246
253
|
const ask = asked.body;
|
|
247
|
-
|
|
248
|
-
if (((_c = (_a = live.roster) === null || _a === void 0 ? void 0 : _a.members.length) !== null && _c !== void 0 ? _c : 0) >= most) {
|
|
254
|
+
if (((_c = (_a = live.roster) === null || _a === void 0 ? void 0 : _a.members.length) !== null && _c !== void 0 ? _c : 0) >= this.capacityOf(live)) {
|
|
249
255
|
throw new Error('The room is full.');
|
|
250
256
|
}
|
|
251
|
-
const
|
|
257
|
+
const head = live.record.owner;
|
|
258
|
+
const proof = !live.record.own && ((_b = live.roster) === null || _b === void 0 ? void 0 : _b.charter) && head.sign && head.box
|
|
259
|
+
? RelayHubCharterUtil.answerProof({ ...head, sign: head.sign, box: head.box }, live.roster.charter)
|
|
260
|
+
: undefined;
|
|
261
|
+
const answer = await RelayHubUtil.sealAnswer(identity, live.record.id, ask, body, asked.invite, proof);
|
|
252
262
|
const member = { ...RelayIdentityUtil.publicOf(ask), member: ask.member, ...(ask.guest ? { guest: true } : {}), at: Date.now() };
|
|
253
263
|
const roster = await this.nextRoster(live, members => [...members.filter(other => other.member !== ask.member), member]);
|
|
254
264
|
this.request(live, { t: 'admit', ask: askId, answer, roster });
|
|
@@ -256,35 +266,20 @@ export class RelayHubs extends RelayHubsIdentity {
|
|
|
256
266
|
live.asks.delete(askId);
|
|
257
267
|
this.emit({ type: 'rooms' });
|
|
258
268
|
}
|
|
259
|
-
/**
|
|
260
|
-
* The owner's choices for a room: how many members it lets in at most (RELAY_ROOM_MAX_MEMBERS by default, 2 to
|
|
261
|
-
* RELAY_ROOM_CAPACITY_MAX), for one many come to (feedback from a browser). Those in already stay.
|
|
262
|
-
*/
|
|
263
|
-
configure(roomId, options) {
|
|
264
|
-
const live = this.owned(roomId);
|
|
265
|
-
if (options.members !== undefined) {
|
|
266
|
-
const members = Math.round(Number(options.members));
|
|
267
|
-
if (!(members >= 2 && members <= RELAY_ROOM_CAPACITY_MAX)) {
|
|
268
|
-
throw new Error(`A room takes 2 to ${RELAY_ROOM_CAPACITY_MAX} members.`);
|
|
269
|
-
}
|
|
270
|
-
if (members === RELAY_ROOM_MAX_MEMBERS) {
|
|
271
|
-
delete live.record.capacity;
|
|
272
|
-
}
|
|
273
|
-
else {
|
|
274
|
-
live.record.capacity = members;
|
|
275
|
-
}
|
|
276
|
-
this.save();
|
|
277
|
-
}
|
|
278
|
-
return this.info(live);
|
|
279
|
-
}
|
|
280
|
-
/** The owner takes a member out: the relay closes it at once. */
|
|
269
|
+
/** The owner or an admin takes a member out: the relay closes it at once. An admin takes out neither the owner nor an admin. */
|
|
281
270
|
async remove(roomId, member) {
|
|
282
|
-
|
|
271
|
+
var _a, _b;
|
|
272
|
+
const live = this.managed(roomId);
|
|
283
273
|
if (member === live.record.member) {
|
|
284
274
|
throw new Error('The owner leaves by closing the room.');
|
|
285
275
|
}
|
|
276
|
+
const owner = (_b = (_a = live.roster) === null || _a === void 0 ? void 0 : _a.members.find(other => other.owner)) === null || _b === void 0 ? void 0 : _b.member;
|
|
277
|
+
if (!live.record.own && (member === owner || this.isAdmin(live, member))) {
|
|
278
|
+
throw new Error('Only the owner of the room does that.');
|
|
279
|
+
}
|
|
286
280
|
await this.ready(live);
|
|
287
|
-
|
|
281
|
+
// A new key for those left: the one taken out holds those of before alone (docs/design/ta-link.md 8.7).
|
|
282
|
+
const roster = await this.nextRoster(live, members => members.filter(other => other.member !== member), undefined, true);
|
|
288
283
|
this.request(live, { t: 'remove', member, roster });
|
|
289
284
|
}
|
|
290
285
|
/** Leaves the room; the owner closes it, for everyone. A room asked to join is forgotten. */
|
|
@@ -329,7 +324,7 @@ export class RelayHubs extends RelayHubsIdentity {
|
|
|
329
324
|
await this.ready(live);
|
|
330
325
|
const identity = await this.identityOf(live);
|
|
331
326
|
const keys = live.keys;
|
|
332
|
-
const d = await RelayHubUtil.
|
|
327
|
+
const d = await RelayHubUtil.sealIn(keys, identity, live.record.member, { key: name, value: value !== null && value !== void 0 ? value : null });
|
|
333
328
|
const k = await RelayHubUtil.keyId(keys, name);
|
|
334
329
|
const id = this.nextId++;
|
|
335
330
|
const result = await new Promise((resolve, reject) => {
|
|
@@ -342,7 +337,14 @@ export class RelayHubs extends RelayHubsIdentity {
|
|
|
342
337
|
resolve(answer);
|
|
343
338
|
});
|
|
344
339
|
try {
|
|
345
|
-
this.request(live, {
|
|
340
|
+
this.request(live, {
|
|
341
|
+
t: 'set',
|
|
342
|
+
id,
|
|
343
|
+
k,
|
|
344
|
+
d,
|
|
345
|
+
...(version === undefined ? {} : { v: version }),
|
|
346
|
+
...(RelayHubs.owns(live.record, name) ? { own: true } : {}),
|
|
347
|
+
});
|
|
346
348
|
}
|
|
347
349
|
catch (error) {
|
|
348
350
|
clearTimeout(timer);
|
|
@@ -355,7 +357,9 @@ export class RelayHubs extends RelayHubsIdentity {
|
|
|
355
357
|
? 'The value is too large.'
|
|
356
358
|
: result.error === 'limit'
|
|
357
359
|
? 'The shared state of the room is full.'
|
|
358
|
-
:
|
|
360
|
+
: result.error === 'owned'
|
|
361
|
+
? 'Another member keeps this key: only they or the owner of the room change it.'
|
|
362
|
+
: 'The relay refused it.');
|
|
359
363
|
}
|
|
360
364
|
if (result.ok) {
|
|
361
365
|
live.state.set(name, { value: value !== null && value !== void 0 ? value : null, version: result.v, by: live.record.member });
|
|
@@ -363,6 +367,14 @@ export class RelayHubs extends RelayHubsIdentity {
|
|
|
363
367
|
}
|
|
364
368
|
return { ok: result.ok, version: result.v };
|
|
365
369
|
}
|
|
370
|
+
/**
|
|
371
|
+
* Whether a key of the state is this Ta's own, which no other member may replace or clear at the relay: one that
|
|
372
|
+
* names its member id (`chat:<member>:<n>`, `agents:<member>`, a like of a post), and every key of a room of
|
|
373
|
+
* friends it owns (its posts, what it sends its friends). Any other is shared, as a game's.
|
|
374
|
+
*/
|
|
375
|
+
static owns(record, name) {
|
|
376
|
+
return name.split(':').includes(record.member) || (record.own && RelayFriendsUtil.isKind(record.kind));
|
|
377
|
+
}
|
|
366
378
|
/** Friends of the user's other computer, with those of this Ta. */
|
|
367
379
|
mergeFriends(friends) {
|
|
368
380
|
return this.book.merge(friends);
|
|
@@ -427,17 +439,15 @@ export class RelayHubs extends RelayHubsIdentity {
|
|
|
427
439
|
this.sends.answer(id, keep);
|
|
428
440
|
this.emit({ type: 'rooms' });
|
|
429
441
|
}
|
|
430
|
-
isFriends(live) {
|
|
431
|
-
return live.record.own && live.record.kind === RELAY_FRIENDS_KIND;
|
|
432
|
-
}
|
|
433
442
|
friendIds() {
|
|
434
443
|
return this.book.ids();
|
|
435
444
|
}
|
|
436
445
|
heardAsk(live, ask) {
|
|
446
|
+
var _a;
|
|
437
447
|
if (this.isFriends(live)) {
|
|
438
448
|
this.book.asked(ask);
|
|
439
449
|
}
|
|
440
|
-
else if (this.groups.admits(live.record, ask)) {
|
|
450
|
+
else if (!((_a = live.charter) === null || _a === void 0 ? void 0 : _a.rules.approve) && this.groups.admits(live.record, ask)) {
|
|
441
451
|
// A friend the user invited: in at once, as the user chose it; asked as any other should that fail.
|
|
442
452
|
void this.answer(live.record.id, ask.member, true).then(() => this.groups.admitted(live.record, ask.id), () => super.heardAsk(live, ask));
|
|
443
453
|
}
|
|
@@ -445,6 +455,10 @@ export class RelayHubs extends RelayHubsIdentity {
|
|
|
445
455
|
super.heardAsk(live, ask);
|
|
446
456
|
}
|
|
447
457
|
}
|
|
458
|
+
foreignSet(live, key) {
|
|
459
|
+
// Not awaited: the owner clears what one set under another's name, as soon as it is in the room.
|
|
460
|
+
void this.setState(live.record.id, key, null).catch(() => undefined);
|
|
461
|
+
}
|
|
448
462
|
heardMembers(members) {
|
|
449
463
|
if (!this.options.guest) {
|
|
450
464
|
this.book.heard(members);
|
|
@@ -467,20 +481,6 @@ export class RelayHubs extends RelayHubsIdentity {
|
|
|
467
481
|
this.emit({ type: 'rooms' });
|
|
468
482
|
}
|
|
469
483
|
}
|
|
470
|
-
owned(roomId) {
|
|
471
|
-
const live = this.member(roomId);
|
|
472
|
-
if (!live.record.own) {
|
|
473
|
-
throw new Error('Only the owner of the room does that.');
|
|
474
|
-
}
|
|
475
|
-
return live;
|
|
476
|
-
}
|
|
477
|
-
member(roomId) {
|
|
478
|
-
const live = this.live.get(roomId);
|
|
479
|
-
if ((live === null || live === void 0 ? void 0 : live.record.status) !== 'member') {
|
|
480
|
-
throw new Error('Not in that room.');
|
|
481
|
-
}
|
|
482
|
-
return live;
|
|
483
|
-
}
|
|
484
484
|
info(live) {
|
|
485
485
|
var _a, _b;
|
|
486
486
|
var _c, _d;
|
|
@@ -491,6 +491,7 @@ export class RelayHubs extends RelayHubsIdentity {
|
|
|
491
491
|
name: member.name,
|
|
492
492
|
...(RelayIdentityUtil.isLook(member.look) ? { look: member.look } : {}),
|
|
493
493
|
owner: !!member.owner,
|
|
494
|
+
...(this.isAdmin(live, member.member) ? { admin: true } : {}),
|
|
494
495
|
online: member.member === record.member ? ((_a = live.socket) === null || _a === void 0 ? void 0 : _a.readyState) === OPEN && live.synced : live.online.has(member.member),
|
|
495
496
|
self: member.member === record.member,
|
|
496
497
|
...(member.guest ? { guest: true } : {}),
|
|
@@ -503,7 +504,9 @@ export class RelayHubs extends RelayHubsIdentity {
|
|
|
503
504
|
...(record.unlisted ? { unlisted: true } : {}),
|
|
504
505
|
relay: record.relay,
|
|
505
506
|
owner: record.own,
|
|
507
|
+
...(!record.own && this.isAdmin(live, record.member) ? { admin: true } : {}),
|
|
506
508
|
...(record.own ? { capacity: (_d = record.capacity) !== null && _d !== void 0 ? _d : RELAY_ROOM_MAX_MEMBERS } : {}),
|
|
509
|
+
...(live.charter && Object.keys(live.charter.rules).length ? { rules: { ...live.charter.rules } } : {}),
|
|
507
510
|
ownerName: record.owner.name,
|
|
508
511
|
status: record.status,
|
|
509
512
|
...(record.reason ? { reason: record.reason } : {}),
|
|
@@ -20,6 +20,11 @@ export interface RelayIdentity extends RelayPublicIdentity {
|
|
|
20
20
|
createdAt: number;
|
|
21
21
|
/** The user's other computers are this Ta too: who answers in a room is agreed first (docs/design/ta-sync.md 9). */
|
|
22
22
|
shared?: true;
|
|
23
|
+
/**
|
|
24
|
+
* The picture others see of the user (RelayIdentityUtil.isPicture), instead of the dinosaur of the look: kept in the
|
|
25
|
+
* state of the rooms this Ta is in (RELAY_PICTURE_KEY), never in what others are given of the identity.
|
|
26
|
+
*/
|
|
27
|
+
picture?: string;
|
|
23
28
|
}
|
|
24
29
|
/** Keys, sealing and signatures of rooms and identities, with WebCrypto only: the same in ta serve, a browser and a Worker. */
|
|
25
30
|
export declare namespace RelayKeys {
|
|
@@ -44,6 +49,8 @@ export declare namespace RelayIdentityUtil {
|
|
|
44
49
|
function publicOf(identity: RelayPublicIdentity): RelayPublicIdentity;
|
|
45
50
|
/** Whether it is a look as a Ta gives it: a short word of letters, digits and dashes. */
|
|
46
51
|
function isLook(look: unknown): look is string;
|
|
52
|
+
/** Whether it is a picture as a Ta keeps it: a data URL of a PNG, JPEG, WebP or SVG, small. */
|
|
53
|
+
function isPicture(picture: unknown): picture is string;
|
|
47
54
|
/** `value` with `look`, or without any for one that is none. */
|
|
48
55
|
function withLook<T extends {
|
|
49
56
|
look?: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RelayBytes } from './relay-bytes.js';
|
|
2
|
+
import { RELAY_PICTURE_MAX_CHARS } from './relay-protocol.js';
|
|
2
3
|
const encoder = new TextEncoder();
|
|
3
4
|
const decoder = new TextDecoder();
|
|
4
5
|
const subtle = () => globalThis.crypto.subtle;
|
|
@@ -96,6 +97,13 @@ export var RelayIdentityUtil;
|
|
|
96
97
|
return typeof look === 'string' && /^[a-z][a-z0-9-]{0,31}$/.test(look);
|
|
97
98
|
}
|
|
98
99
|
RelayIdentityUtil.isLook = isLook;
|
|
100
|
+
/** Whether it is a picture as a Ta keeps it: a data URL of a PNG, JPEG, WebP or SVG, small. */
|
|
101
|
+
function isPicture(picture) {
|
|
102
|
+
return (typeof picture === 'string' &&
|
|
103
|
+
picture.length <= RELAY_PICTURE_MAX_CHARS &&
|
|
104
|
+
/^data:image\/(png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/.test(picture));
|
|
105
|
+
}
|
|
106
|
+
RelayIdentityUtil.isPicture = isPicture;
|
|
99
107
|
/** `value` with `look`, or without any for one that is none. */
|
|
100
108
|
function withLook(value, look) {
|
|
101
109
|
const { look: _, ...rest } = value;
|
|
@@ -186,17 +186,29 @@ export declare const RELAY_HUB_MAX_VALUE: number;
|
|
|
186
186
|
export declare const RELAY_HUB_MAX_KEYS = 4096;
|
|
187
187
|
/** Characters of all of the state, sealed. */
|
|
188
188
|
export declare const RELAY_HUB_MAX_STATE: number;
|
|
189
|
-
/** Asks to join waiting for the owner, and for how long. */
|
|
189
|
+
/** Asks to join waiting for the owner or an admin, and for how long. */
|
|
190
190
|
export declare const RELAY_HUB_MAX_ASKS = 20;
|
|
191
|
+
/**
|
|
192
|
+
* The key of the state of a room a member keeps its picture under (RelayIdentity.picture), its member id after it: each
|
|
193
|
+
* member its own, in the rooms of friends the owner alone (RelayHubs.keepPicture).
|
|
194
|
+
*/
|
|
195
|
+
export declare const RELAY_PICTURE_KEY = "picture:";
|
|
196
|
+
/** Characters of a picture at most, as a data URL: a small square, a few of them in a room. */
|
|
197
|
+
export declare const RELAY_PICTURE_MAX_CHARS: number;
|
|
191
198
|
export declare const RELAY_HUB_ASK_DAYS = 7;
|
|
192
199
|
/** A room nobody used for so long is deleted. */
|
|
193
200
|
export declare const RELAY_HUB_IDLE_DAYS = 90;
|
|
194
201
|
/** Messages of a connection in a second. */
|
|
195
202
|
export declare const RELAY_HUB_RATE = 40;
|
|
196
|
-
/**
|
|
203
|
+
/**
|
|
204
|
+
* The sealed list of the members of a room, signed by its owner (or an admin); `v` grows with each change. After a
|
|
205
|
+
* member was taken out or left, `k` holds the keys of the room's epochs sealed for each member left
|
|
206
|
+
* (docs/design/ta-link.md 8.7), by member id.
|
|
207
|
+
*/
|
|
197
208
|
export interface RelayHubRoster {
|
|
198
209
|
v: number;
|
|
199
210
|
d: string;
|
|
211
|
+
k?: Record<string, string>;
|
|
200
212
|
}
|
|
201
213
|
/** A key of the shared state: `k` the HMAC of its name, `v` its version (from 1), `d` sealed, `by` the member who wrote it last. */
|
|
202
214
|
export interface RelayHubEntry {
|
|
@@ -204,6 +216,8 @@ export interface RelayHubEntry {
|
|
|
204
216
|
v: number;
|
|
205
217
|
d: string;
|
|
206
218
|
by: string;
|
|
219
|
+
/** Its member's own: only they, or the owner of the room, set it again or clear it while they are a member. */
|
|
220
|
+
own?: true;
|
|
207
221
|
}
|
|
208
222
|
/** An ask to join, for the owner: `d` sealed with the key of the invitation. */
|
|
209
223
|
export interface RelayHubAsk {
|
|
@@ -244,10 +258,14 @@ export type RelayHubRequest = {
|
|
|
244
258
|
k: string;
|
|
245
259
|
d: string;
|
|
246
260
|
v?: number;
|
|
261
|
+
own?: true;
|
|
247
262
|
} | {
|
|
248
263
|
t: 'invite';
|
|
249
264
|
hash: string;
|
|
250
265
|
expiresAt: number;
|
|
266
|
+
} | {
|
|
267
|
+
t: 'admins';
|
|
268
|
+
admins: string[];
|
|
251
269
|
} | {
|
|
252
270
|
t: 'admit';
|
|
253
271
|
ask: string;
|
|
@@ -269,7 +287,7 @@ export type RelayHubRequest = {
|
|
|
269
287
|
t: 'close';
|
|
270
288
|
};
|
|
271
289
|
/** Why the hub refused: `auth` not a member, `gone` no such room, `invite` the invitation is wrong or ran out. */
|
|
272
|
-
export type RelayHubFailure = 'auth' | 'gone' | 'invite' | 'full' | 'large' | 'limit' | 'rate' | 'owner' | 'exists' | 'invalid';
|
|
290
|
+
export type RelayHubFailure = 'auth' | 'gone' | 'invite' | 'full' | 'large' | 'limit' | 'rate' | 'owner' | 'exists' | 'invalid' | 'owned';
|
|
273
291
|
/**
|
|
274
292
|
* What a hub sends. A member is first `welcome`d (who is online, the roster, asks for the owner), then given the
|
|
275
293
|
* state in `entries` and `synced`.
|
|
@@ -119,8 +119,15 @@ export const RELAY_HUB_MAX_VALUE = 96 * 1024;
|
|
|
119
119
|
export const RELAY_HUB_MAX_KEYS = 4096;
|
|
120
120
|
/** Characters of all of the state, sealed. */
|
|
121
121
|
export const RELAY_HUB_MAX_STATE = 3 * 1024 * 1024;
|
|
122
|
-
/** Asks to join waiting for the owner, and for how long. */
|
|
122
|
+
/** Asks to join waiting for the owner or an admin, and for how long. */
|
|
123
123
|
export const RELAY_HUB_MAX_ASKS = 20;
|
|
124
|
+
/**
|
|
125
|
+
* The key of the state of a room a member keeps its picture under (RelayIdentity.picture), its member id after it: each
|
|
126
|
+
* member its own, in the rooms of friends the owner alone (RelayHubs.keepPicture).
|
|
127
|
+
*/
|
|
128
|
+
export const RELAY_PICTURE_KEY = 'picture:';
|
|
129
|
+
/** Characters of a picture at most, as a data URL: a small square, a few of them in a room. */
|
|
130
|
+
export const RELAY_PICTURE_MAX_CHARS = 16 * 1024;
|
|
124
131
|
export const RELAY_HUB_ASK_DAYS = 7;
|
|
125
132
|
/** A room nobody used for so long is deleted. */
|
|
126
133
|
export const RELAY_HUB_IDLE_DAYS = 90;
|
|
@@ -36,6 +36,11 @@ export interface RelayChatLine {
|
|
|
36
36
|
* by `<member>/<agent id>`, their member's Ta answering.
|
|
37
37
|
*/
|
|
38
38
|
to?: string[];
|
|
39
|
+
/**
|
|
40
|
+
* `to` names the members themselves with @, not their doubles (docs/design/ta-link.md 7): each one's Ta tells them, and
|
|
41
|
+
* answers for them as far as they set it to (their double at once, once they are away, a draft for them to send).
|
|
42
|
+
*/
|
|
43
|
+
person?: boolean;
|
|
39
44
|
/** The id of the line it answers. */
|
|
40
45
|
re?: string;
|
|
41
46
|
/**
|
|
@@ -50,7 +55,7 @@ export interface RelayChatAgent {
|
|
|
50
55
|
name: string;
|
|
51
56
|
}
|
|
52
57
|
/** What a line adds to its text: who said it and to whom (RelayRoomChat.say). */
|
|
53
|
-
export type RelayChatLineExtra = Pick<RelayChatLine, 'double' | 'agent' | 'to' | 're' | 'task'>;
|
|
58
|
+
export type RelayChatLineExtra = Pick<RelayChatLine, 'double' | 'agent' | 'to' | 'person' | 're' | 'task'>;
|
|
54
59
|
/** What is kept of a line: `from` is the key's. */
|
|
55
60
|
type StoredLine = Omit<RelayChatLine, 'from'>;
|
|
56
61
|
/** The keys of what is said, `chat:<member>:<n>`: each member writes only its own, so none can write as another. */
|
|
@@ -41,6 +41,7 @@ export var RelayRoomChatUtil;
|
|
|
41
41
|
? { agent: { id: agent.id.slice(0, 64), name: agent.name.slice(0, 64) } }
|
|
42
42
|
: {}),
|
|
43
43
|
...(to.length ? { to } : {}),
|
|
44
|
+
...(line.person === true && to.length && line.double !== true && !line.agent ? { person: true } : {}),
|
|
44
45
|
...(typeof line.re === 'string' ? { re: line.re } : {}),
|
|
45
46
|
...(line.task === true && to.length ? { task: true } : {}),
|
|
46
47
|
};
|
|
@@ -7,7 +7,7 @@ import { type RelayAccountProvider, RelayAccounts, type RelayAccountsOptions } f
|
|
|
7
7
|
export declare class RelayServerAccounts {
|
|
8
8
|
protected readonly accounts: RelayAccounts;
|
|
9
9
|
/** `authenticate`: a gateway's, whose sign-in gives the tokens (RelayAccountsOptions.authenticate). */
|
|
10
|
-
constructor(data: string | undefined, options?: Pick<RelayAccountsOptions, 'authenticate'> & {
|
|
10
|
+
constructor(data: string | undefined, options?: Pick<RelayAccountsOptions, 'authenticate' | 'issue'> & {
|
|
11
11
|
providers?: RelayAccountProvider[];
|
|
12
12
|
});
|
|
13
13
|
/** Answers a request of RELAY_ACCOUNT_PATH; never throws, an unhandled rejection would end the relay. */
|
|
@@ -15,7 +15,7 @@ export class RelayServerAccounts {
|
|
|
15
15
|
var _a;
|
|
16
16
|
const books = new RelayAccountBooks(account => data ? new FileRelayStorage(join(data, 'accounts', RelayBytes.toBase64(new TextEncoder().encode(account)))) : new MemoryHubStorage());
|
|
17
17
|
const providers = (_a = options.providers) !== null && _a !== void 0 ? _a : (options.authenticate ? [] : [new RelayGitHubAccounts()]);
|
|
18
|
-
this.accounts = new RelayAccounts({ book: account => books.book(account), providers, authenticate: options.authenticate });
|
|
18
|
+
this.accounts = new RelayAccounts({ book: account => books.book(account), providers, authenticate: options.authenticate, issue: options.issue });
|
|
19
19
|
}
|
|
20
20
|
/** Answers a request of RELAY_ACCOUNT_PATH; never throws, an unhandled rejection would end the relay. */
|
|
21
21
|
serve(request, response) {
|
package/lib/common/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export * from './relay-friends';
|
|
|
14
14
|
export * from './relay-group-invites';
|
|
15
15
|
export * from './relay-host-calls';
|
|
16
16
|
export * from './relay-hub';
|
|
17
|
+
export * from './relay-hub-charter';
|
|
17
18
|
export * from './relay-hub-util';
|
|
18
19
|
export * from './relay-hubs';
|
|
19
20
|
export * from './relay-hubs-protocol';
|
package/lib/common/index.js
CHANGED
|
@@ -30,6 +30,7 @@ __exportStar(require("./relay-friends"), exports);
|
|
|
30
30
|
__exportStar(require("./relay-group-invites"), exports);
|
|
31
31
|
__exportStar(require("./relay-host-calls"), exports);
|
|
32
32
|
__exportStar(require("./relay-hub"), exports);
|
|
33
|
+
__exportStar(require("./relay-hub-charter"), exports);
|
|
33
34
|
__exportStar(require("./relay-hub-util"), exports);
|
|
34
35
|
__exportStar(require("./relay-hubs"), exports);
|
|
35
36
|
__exportStar(require("./relay-hubs-protocol"), exports);
|