@dxos/client-services 0.7.5-labs.e27f9b9 → 0.7.5-main.2567c87
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/dist/lib/browser/{chunk-OHBCYJRF.mjs → chunk-443F7E4C.mjs} +182 -179
- package/dist/lib/browser/chunk-443F7E4C.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +1 -1
- package/dist/lib/node/{chunk-X3IYGB6Q.cjs → chunk-LKVY5GQC.cjs} +210 -207
- package/dist/lib/node/chunk-LKVY5GQC.cjs.map +7 -0
- package/dist/lib/node/index.cjs +47 -47
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +8 -8
- package/dist/lib/node-esm/{chunk-U5S4G236.mjs → chunk-RZEXZLYL.mjs} +182 -179
- package/dist/lib/node-esm/chunk-RZEXZLYL.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +1 -1
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +1 -1
- package/dist/types/src/packlets/agents/edge-agent-service.d.ts +1 -1
- package/dist/types/src/packlets/agents/edge-agent-service.d.ts.map +1 -1
- package/dist/types/src/packlets/devices/devices-service.d.ts +1 -1
- package/dist/types/src/packlets/devices/devices-service.d.ts.map +1 -1
- package/dist/types/src/packlets/devtools/devtools.d.ts +1 -1
- package/dist/types/src/packlets/devtools/devtools.d.ts.map +1 -1
- package/dist/types/src/packlets/devtools/feeds.d.ts +1 -1
- package/dist/types/src/packlets/devtools/feeds.d.ts.map +1 -1
- package/dist/types/src/packlets/devtools/keys.d.ts +1 -1
- package/dist/types/src/packlets/devtools/keys.d.ts.map +1 -1
- package/dist/types/src/packlets/devtools/metadata.d.ts +1 -1
- package/dist/types/src/packlets/devtools/metadata.d.ts.map +1 -1
- package/dist/types/src/packlets/devtools/network.d.ts +1 -1
- package/dist/types/src/packlets/devtools/network.d.ts.map +1 -1
- package/dist/types/src/packlets/devtools/spaces.d.ts +1 -1
- package/dist/types/src/packlets/devtools/spaces.d.ts.map +1 -1
- package/dist/types/src/packlets/diagnostics/diagnostics.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/contacts-service.d.ts +1 -1
- package/dist/types/src/packlets/identity/contacts-service.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-manager.d.ts +3 -0
- package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-recovery-manager.d.ts +5 -4
- package/dist/types/src/packlets/identity/identity-recovery-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-service.d.ts +4 -4
- package/dist/types/src/packlets/identity/identity-service.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity.d.ts +1 -3
- package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-service.d.ts +1 -1
- package/dist/types/src/packlets/invitations/invitations-service.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/utils.d.ts +0 -1
- package/dist/types/src/packlets/invitations/utils.d.ts.map +1 -1
- package/dist/types/src/packlets/logging/logging-service.d.ts +1 -1
- package/dist/types/src/packlets/logging/logging-service.d.ts.map +1 -1
- package/dist/types/src/packlets/network/network-service.d.ts +1 -1
- package/dist/types/src/packlets/network/network-service.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
- package/dist/types/src/packlets/system/system-service.d.ts +1 -1
- package/dist/types/src/packlets/system/system-service.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +38 -38
- package/src/packlets/agents/edge-agent-service.ts +1 -1
- package/src/packlets/devices/devices-service.ts +1 -1
- package/src/packlets/devtools/devtools.ts +1 -1
- package/src/packlets/devtools/feeds.ts +1 -1
- package/src/packlets/devtools/keys.ts +1 -1
- package/src/packlets/devtools/metadata.ts +1 -1
- package/src/packlets/devtools/network.ts +1 -1
- package/src/packlets/devtools/spaces.ts +1 -1
- package/src/packlets/diagnostics/diagnostics.ts +13 -17
- package/src/packlets/identity/contacts-service.ts +1 -1
- package/src/packlets/identity/identity-manager.ts +29 -3
- package/src/packlets/identity/identity-recovery-manager.ts +9 -24
- package/src/packlets/identity/identity-service.ts +3 -5
- package/src/packlets/identity/identity.test.ts +1 -2
- package/src/packlets/identity/identity.ts +1 -4
- package/src/packlets/invitations/invitations-handler.ts +6 -15
- package/src/packlets/invitations/invitations-manager.ts +1 -1
- package/src/packlets/invitations/invitations-service.ts +1 -1
- package/src/packlets/invitations/space-invitation-protocol.ts +3 -2
- package/src/packlets/invitations/utils.ts +0 -7
- package/src/packlets/logging/logging-service.ts +1 -1
- package/src/packlets/network/network-service.ts +1 -1
- package/src/packlets/spaces/data-space-manager.ts +1 -1
- package/src/packlets/spaces/edge-feed-replicator.ts +8 -8
- package/src/packlets/spaces/spaces-service.ts +21 -31
- package/src/packlets/system/system-service.ts +1 -1
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-OHBCYJRF.mjs.map +0 -7
- package/dist/lib/node/chunk-X3IYGB6Q.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-U5S4G236.mjs.map +0 -7
|
@@ -2,7 +2,7 @@ import "@dxos/node-std/globals";
|
|
|
2
2
|
|
|
3
3
|
// packages/sdk/client-services/src/packlets/devtools/feeds.ts
|
|
4
4
|
import { EventSubscriptions } from "@dxos/async";
|
|
5
|
-
import { Stream } from "@dxos/codec-protobuf
|
|
5
|
+
import { Stream } from "@dxos/codec-protobuf";
|
|
6
6
|
import { FeedIterator } from "@dxos/feed-store";
|
|
7
7
|
import { PublicKey } from "@dxos/keys";
|
|
8
8
|
import { log } from "@dxos/log";
|
|
@@ -113,7 +113,7 @@ var subscribeToFeedBlocks = ({ feedStore }, { feedKey, maxBlocks = 10 }) => {
|
|
|
113
113
|
};
|
|
114
114
|
|
|
115
115
|
// packages/sdk/client-services/src/packlets/devtools/network.ts
|
|
116
|
-
import { Stream as Stream2 } from "@dxos/codec-protobuf
|
|
116
|
+
import { Stream as Stream2 } from "@dxos/codec-protobuf";
|
|
117
117
|
import { Context } from "@dxos/context";
|
|
118
118
|
import { PublicKey as PublicKey2 } from "@dxos/keys";
|
|
119
119
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devtools/network.ts";
|
|
@@ -210,7 +210,7 @@ var getNetworkPeers = ({ networkManager }, request) => {
|
|
|
210
210
|
};
|
|
211
211
|
|
|
212
212
|
// packages/sdk/client-services/src/packlets/devtools/spaces.ts
|
|
213
|
-
import { Stream as Stream3 } from "@dxos/codec-protobuf
|
|
213
|
+
import { Stream as Stream3 } from "@dxos/codec-protobuf";
|
|
214
214
|
var subscribeToSpaces = (context, { spaceKeys = [] }) => {
|
|
215
215
|
return new Stream3(({ next }) => {
|
|
216
216
|
let unsubscribe;
|
|
@@ -247,11 +247,11 @@ var subscribeToSpaces = (context, { spaceKeys = [] }) => {
|
|
|
247
247
|
|
|
248
248
|
// packages/sdk/client-services/src/packlets/devtools/devtools.ts
|
|
249
249
|
import { Event as AsyncEvent } from "@dxos/async";
|
|
250
|
-
import { Stream as Stream6 } from "@dxos/codec-protobuf
|
|
250
|
+
import { Stream as Stream6 } from "@dxos/codec-protobuf";
|
|
251
251
|
|
|
252
252
|
// packages/sdk/client-services/src/packlets/devtools/keys.ts
|
|
253
253
|
import { scheduleTask } from "@dxos/async";
|
|
254
|
-
import { Stream as Stream4 } from "@dxos/codec-protobuf
|
|
254
|
+
import { Stream as Stream4 } from "@dxos/codec-protobuf";
|
|
255
255
|
var subscribeToKeyringKeys = ({ keyring }) => new Stream4(({ next, ctx }) => {
|
|
256
256
|
const update = async () => {
|
|
257
257
|
next({
|
|
@@ -263,7 +263,7 @@ var subscribeToKeyringKeys = ({ keyring }) => new Stream4(({ next, ctx }) => {
|
|
|
263
263
|
});
|
|
264
264
|
|
|
265
265
|
// packages/sdk/client-services/src/packlets/devtools/metadata.ts
|
|
266
|
-
import { Stream as Stream5 } from "@dxos/codec-protobuf
|
|
266
|
+
import { Stream as Stream5 } from "@dxos/codec-protobuf";
|
|
267
267
|
var subscribeToMetadata = ({ context }) => new Stream5(({ next, ctx }) => {
|
|
268
268
|
context.metadataStore.update.on(ctx, (data) => next({
|
|
269
269
|
metadata: data
|
|
@@ -390,14 +390,14 @@ var DevtoolsServiceImpl = class {
|
|
|
390
390
|
// packages/sdk/client-services/src/packlets/diagnostics/diagnostics.ts
|
|
391
391
|
import { asyncTimeout } from "@dxos/async";
|
|
392
392
|
import { getFirstStreamValue } from "@dxos/codec-protobuf";
|
|
393
|
-
import {
|
|
393
|
+
import { credentialTypeFilter } from "@dxos/credentials";
|
|
394
394
|
import { invariant } from "@dxos/invariant";
|
|
395
395
|
import { STORAGE_VERSION } from "@dxos/protocols";
|
|
396
396
|
import { SpaceMember } from "@dxos/protocols/proto/dxos/client/services";
|
|
397
397
|
import { TRACE_PROCESSOR } from "@dxos/tracing";
|
|
398
398
|
|
|
399
399
|
// packages/sdk/client-services/src/version.ts
|
|
400
|
-
var DXOS_VERSION = "0.7.5-
|
|
400
|
+
var DXOS_VERSION = "0.7.5-main.2567c87";
|
|
401
401
|
|
|
402
402
|
// packages/sdk/client-services/src/packlets/services/platform.ts
|
|
403
403
|
import { Platform } from "@dxos/protocols/proto/dxos/client/services";
|
|
@@ -466,7 +466,6 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
|
466
466
|
const identity = serviceContext.identityManager.identity;
|
|
467
467
|
if (identity) {
|
|
468
468
|
diagnostics.identity = {
|
|
469
|
-
did: identity.did,
|
|
470
469
|
identityKey: identity.identityKey,
|
|
471
470
|
spaceKey: identity.space.key,
|
|
472
471
|
profile: identity.profileDocument
|
|
@@ -505,17 +504,16 @@ var getSpaceStats = async (space) => {
|
|
|
505
504
|
...credential.subject.assertion,
|
|
506
505
|
id: credential.id
|
|
507
506
|
})),
|
|
508
|
-
members:
|
|
507
|
+
members: Array.from(space.inner.spaceState.members.values()).map((member) => ({
|
|
509
508
|
role: member.role,
|
|
510
509
|
identity: {
|
|
511
|
-
did: await createDidFromIdentityKey(member.key),
|
|
512
510
|
identityKey: member.key,
|
|
513
511
|
profile: {
|
|
514
512
|
displayName: member.assertion.profile?.displayName
|
|
515
513
|
}
|
|
516
514
|
},
|
|
517
515
|
presence: space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key)).length > 0 ? SpaceMember.PresenceState.ONLINE : SpaceMember.PresenceState.OFFLINE
|
|
518
|
-
}))
|
|
516
|
+
})),
|
|
519
517
|
pipeline: {
|
|
520
518
|
// TODO(burdon): Pick properties from credentials if needed.
|
|
521
519
|
currentEpoch: space.automergeSpaceState.lastEpoch,
|
|
@@ -993,7 +991,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
993
991
|
this._remoteLength.clear();
|
|
994
992
|
}
|
|
995
993
|
async addFeed(feed) {
|
|
996
|
-
log4("addFeed", {
|
|
994
|
+
log4.info("addFeed", {
|
|
997
995
|
key: feed.key,
|
|
998
996
|
connected: this._connected,
|
|
999
997
|
hasConnectionCtx: !!this._connectionCtx
|
|
@@ -1030,7 +1028,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1030
1028
|
}
|
|
1031
1029
|
async _sendMessage(message) {
|
|
1032
1030
|
if (!this._connectionCtx) {
|
|
1033
|
-
log4("message dropped because connection was disposed", void 0, {
|
|
1031
|
+
log4.info("message dropped because connection was disposed", void 0, {
|
|
1034
1032
|
F: __dxlog_file6,
|
|
1035
1033
|
L: 146,
|
|
1036
1034
|
S: this,
|
|
@@ -1039,7 +1037,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1039
1037
|
return;
|
|
1040
1038
|
}
|
|
1041
1039
|
if (message.type === "data") {
|
|
1042
|
-
log4("sending blocks", {
|
|
1040
|
+
log4.info("sending blocks", {
|
|
1043
1041
|
feedKey: message.feedKey,
|
|
1044
1042
|
blocks: message.blocks.map((b) => b.index)
|
|
1045
1043
|
}, {
|
|
@@ -1114,7 +1112,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1114
1112
|
feedKey
|
|
1115
1113
|
};
|
|
1116
1114
|
if (message.length > feed.length) {
|
|
1117
|
-
log4("requesting missing blocks", logMeta, {
|
|
1115
|
+
log4.info("requesting missing blocks", logMeta, {
|
|
1118
1116
|
F: __dxlog_file6,
|
|
1119
1117
|
L: 194,
|
|
1120
1118
|
S: this,
|
|
@@ -1129,7 +1127,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1129
1127
|
}
|
|
1130
1128
|
});
|
|
1131
1129
|
} else if (message.length < feed.length) {
|
|
1132
|
-
log4("pushing blocks to remote", logMeta, {
|
|
1130
|
+
log4.info("pushing blocks to remote", logMeta, {
|
|
1133
1131
|
F: __dxlog_file6,
|
|
1134
1132
|
L: 202,
|
|
1135
1133
|
S: this,
|
|
@@ -1145,7 +1143,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1145
1143
|
}
|
|
1146
1144
|
}
|
|
1147
1145
|
case "data": {
|
|
1148
|
-
log4("received data", {
|
|
1146
|
+
log4.info("received data", {
|
|
1149
1147
|
feed: message.feedKey,
|
|
1150
1148
|
blocks: message.blocks.map((b) => b.index)
|
|
1151
1149
|
}, {
|
|
@@ -1184,7 +1182,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1184
1182
|
});
|
|
1185
1183
|
}
|
|
1186
1184
|
async _pushBlocks(feed, from, to) {
|
|
1187
|
-
log4("pushing blocks", {
|
|
1185
|
+
log4.info("pushing blocks", {
|
|
1188
1186
|
feed: feed.key.toHex(),
|
|
1189
1187
|
from,
|
|
1190
1188
|
to
|
|
@@ -1223,7 +1221,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1223
1221
|
this._remoteLength.set(feed.key, to);
|
|
1224
1222
|
}
|
|
1225
1223
|
async _integrateBlocks(feed, blocks) {
|
|
1226
|
-
log4("integrating blocks", {
|
|
1224
|
+
log4.info("integrating blocks", {
|
|
1227
1225
|
feed: feed.key.toHex(),
|
|
1228
1226
|
blocks: blocks.length
|
|
1229
1227
|
}, {
|
|
@@ -2650,7 +2648,7 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
2650
2648
|
guestKeypair: invitation.guestKey ? {
|
|
2651
2649
|
publicKey: invitation.guestKey
|
|
2652
2650
|
} : void 0,
|
|
2653
|
-
lifetime: invitation.expiresOn ?
|
|
2651
|
+
lifetime: invitation.expiresOn ? invitation.expiresOn.getTime() - Date.now() : void 0,
|
|
2654
2652
|
multiUse: invitation.multiUse,
|
|
2655
2653
|
delegationCredentialId: credentialId,
|
|
2656
2654
|
persistent: false
|
|
@@ -2677,8 +2675,8 @@ DataSpaceManager = _ts_decorate3([
|
|
|
2677
2675
|
|
|
2678
2676
|
// packages/sdk/client-services/src/packlets/spaces/spaces-service.ts
|
|
2679
2677
|
import { EventSubscriptions as EventSubscriptions2, UpdateScheduler, scheduleTask as scheduleTask3 } from "@dxos/async";
|
|
2680
|
-
import { Stream as Stream7 } from "@dxos/codec-protobuf
|
|
2681
|
-
import { createAdmissionCredentials as createAdmissionCredentials2,
|
|
2678
|
+
import { Stream as Stream7 } from "@dxos/codec-protobuf";
|
|
2679
|
+
import { createAdmissionCredentials as createAdmissionCredentials2, getCredentialAssertion as getCredentialAssertion3 } from "@dxos/credentials";
|
|
2682
2680
|
import { raise } from "@dxos/debug";
|
|
2683
2681
|
import { writeMessages as writeMessages2 } from "@dxos/feed-store";
|
|
2684
2682
|
import { invariant as invariant6 } from "@dxos/invariant";
|
|
@@ -2734,7 +2732,7 @@ var SpacesServiceImpl = class {
|
|
|
2734
2732
|
const credentials = await createAdmissionCredentials2(identity.getIdentityCredentialSigner(), request.memberKey, space.key, space.genesisFeedKey, request.newRole, space.spaceState.membershipChainHeads);
|
|
2735
2733
|
invariant6(credentials[0].credential, void 0, {
|
|
2736
2734
|
F: __dxlog_file11,
|
|
2737
|
-
L:
|
|
2735
|
+
L: 106,
|
|
2738
2736
|
S: this,
|
|
2739
2737
|
A: [
|
|
2740
2738
|
"credentials[0].credential",
|
|
@@ -2744,7 +2742,7 @@ var SpacesServiceImpl = class {
|
|
|
2744
2742
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
2745
2743
|
invariant6(getCredentialAssertion3(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
2746
2744
|
F: __dxlog_file11,
|
|
2747
|
-
L:
|
|
2745
|
+
L: 108,
|
|
2748
2746
|
S: this,
|
|
2749
2747
|
A: [
|
|
2750
2748
|
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -2757,12 +2755,12 @@ var SpacesServiceImpl = class {
|
|
|
2757
2755
|
return new Stream7(({ next, ctx }) => {
|
|
2758
2756
|
const scheduler = new UpdateScheduler(ctx, async () => {
|
|
2759
2757
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
2760
|
-
const spaces =
|
|
2758
|
+
const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space));
|
|
2761
2759
|
log8("update", () => ({
|
|
2762
2760
|
ids: spaces.map((space) => space.id)
|
|
2763
2761
|
}), {
|
|
2764
2762
|
F: __dxlog_file11,
|
|
2765
|
-
L:
|
|
2763
|
+
L: 119,
|
|
2766
2764
|
S: this,
|
|
2767
2765
|
C: (f, a) => f(...a)
|
|
2768
2766
|
});
|
|
@@ -2854,7 +2852,7 @@ var SpacesServiceImpl = class {
|
|
|
2854
2852
|
} else {
|
|
2855
2853
|
invariant6(!credential.id, "Id on unsigned credentials is not allowed", {
|
|
2856
2854
|
F: __dxlog_file11,
|
|
2857
|
-
L:
|
|
2855
|
+
L: 217,
|
|
2858
2856
|
S: this,
|
|
2859
2857
|
A: [
|
|
2860
2858
|
"!credential.id",
|
|
@@ -2863,7 +2861,7 @@ var SpacesServiceImpl = class {
|
|
|
2863
2861
|
});
|
|
2864
2862
|
invariant6(this._identityManager.identity, "Identity is not available", {
|
|
2865
2863
|
F: __dxlog_file11,
|
|
2866
|
-
L:
|
|
2864
|
+
L: 218,
|
|
2867
2865
|
S: this,
|
|
2868
2866
|
A: [
|
|
2869
2867
|
"this._identityManager.identity",
|
|
@@ -2873,7 +2871,7 @@ var SpacesServiceImpl = class {
|
|
|
2873
2871
|
const signer = this._identityManager.identity.getIdentityCredentialSigner();
|
|
2874
2872
|
invariant6(credential.issuer.equals(signer.getIssuer()), void 0, {
|
|
2875
2873
|
F: __dxlog_file11,
|
|
2876
|
-
L:
|
|
2874
|
+
L: 220,
|
|
2877
2875
|
S: this,
|
|
2878
2876
|
A: [
|
|
2879
2877
|
"credential.issuer.equals(signer.getIssuer())",
|
|
@@ -2923,7 +2921,7 @@ var SpacesServiceImpl = class {
|
|
|
2923
2921
|
const assertion = getCredentialAssertion3(credential);
|
|
2924
2922
|
invariant6(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
2925
2923
|
F: __dxlog_file11,
|
|
2926
|
-
L:
|
|
2924
|
+
L: 254,
|
|
2927
2925
|
S: this,
|
|
2928
2926
|
A: [
|
|
2929
2927
|
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -2933,7 +2931,7 @@ var SpacesServiceImpl = class {
|
|
|
2933
2931
|
const myIdentity = this._identityManager.identity;
|
|
2934
2932
|
invariant6(myIdentity && credential.subject.id.equals(myIdentity.identityKey), void 0, {
|
|
2935
2933
|
F: __dxlog_file11,
|
|
2936
|
-
L:
|
|
2934
|
+
L: 256,
|
|
2937
2935
|
S: this,
|
|
2938
2936
|
A: [
|
|
2939
2937
|
"myIdentity && credential.subject.id.equals(myIdentity.identityKey)",
|
|
@@ -2954,10 +2952,10 @@ var SpacesServiceImpl = class {
|
|
|
2954
2952
|
});
|
|
2955
2953
|
}
|
|
2956
2954
|
return {
|
|
2957
|
-
space:
|
|
2955
|
+
space: this._serializeSpace(dataSpace)
|
|
2958
2956
|
};
|
|
2959
2957
|
}
|
|
2960
|
-
|
|
2958
|
+
_serializeSpace(space) {
|
|
2961
2959
|
return {
|
|
2962
2960
|
id: space.id,
|
|
2963
2961
|
spaceKey: space.key,
|
|
@@ -2977,7 +2975,7 @@ var SpacesServiceImpl = class {
|
|
|
2977
2975
|
totalDataTimeframe: void 0,
|
|
2978
2976
|
spaceRootUrl: space.databaseRoot?.url
|
|
2979
2977
|
},
|
|
2980
|
-
members:
|
|
2978
|
+
members: Array.from(space.inner.spaceState.members.values()).map((member) => {
|
|
2981
2979
|
const peers = space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key));
|
|
2982
2980
|
const isMe = this._identityManager.identity?.identityKey.equals(member.key);
|
|
2983
2981
|
if (isMe) {
|
|
@@ -2985,7 +2983,6 @@ var SpacesServiceImpl = class {
|
|
|
2985
2983
|
}
|
|
2986
2984
|
return {
|
|
2987
2985
|
identity: {
|
|
2988
|
-
did: await createDidFromIdentityKey2(member.key),
|
|
2989
2986
|
identityKey: member.key,
|
|
2990
2987
|
profile: member.profile ?? {}
|
|
2991
2988
|
},
|
|
@@ -2993,7 +2990,7 @@ var SpacesServiceImpl = class {
|
|
|
2993
2990
|
presence: peers.length > 0 ? SpaceMember4.PresenceState.ONLINE : SpaceMember4.PresenceState.OFFLINE,
|
|
2994
2991
|
peerStates: peers
|
|
2995
2992
|
};
|
|
2996
|
-
})
|
|
2993
|
+
}),
|
|
2997
2994
|
creator: space.inner.spaceState.creator?.key,
|
|
2998
2995
|
cache: space.cache,
|
|
2999
2996
|
metrics: space.metrics,
|
|
@@ -3038,14 +3035,13 @@ var Identity = class {
|
|
|
3038
3035
|
this.space = params.space;
|
|
3039
3036
|
this._signer = params.signer;
|
|
3040
3037
|
this._presence = params.presence;
|
|
3041
|
-
this.did = params.did;
|
|
3042
3038
|
this.identityKey = params.identityKey;
|
|
3043
3039
|
this.deviceKey = params.deviceKey;
|
|
3044
3040
|
log9.trace("dxos.halo.device", {
|
|
3045
3041
|
deviceKey: params.deviceKey
|
|
3046
3042
|
}, {
|
|
3047
3043
|
F: __dxlog_file12,
|
|
3048
|
-
L:
|
|
3044
|
+
L: 79,
|
|
3049
3045
|
S: this,
|
|
3050
3046
|
C: (f, a) => f(...a)
|
|
3051
3047
|
});
|
|
@@ -3147,7 +3143,7 @@ var Identity = class {
|
|
|
3147
3143
|
getIdentityCredentialSigner() {
|
|
3148
3144
|
invariant7(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.", {
|
|
3149
3145
|
F: __dxlog_file12,
|
|
3150
|
-
L:
|
|
3146
|
+
L: 195,
|
|
3151
3147
|
S: this,
|
|
3152
3148
|
A: [
|
|
3153
3149
|
"this._deviceStateMachine.deviceCredentialChain",
|
|
@@ -3191,7 +3187,7 @@ var Identity = class {
|
|
|
3191
3187
|
dataFeedKey
|
|
3192
3188
|
}, {
|
|
3193
3189
|
F: __dxlog_file12,
|
|
3194
|
-
L:
|
|
3190
|
+
L: 220,
|
|
3195
3191
|
S: this,
|
|
3196
3192
|
C: (f, a) => f(...a)
|
|
3197
3193
|
});
|
|
@@ -3248,7 +3244,7 @@ Identity = _ts_decorate4([
|
|
|
3248
3244
|
import platform from "platform";
|
|
3249
3245
|
import { Event as Event6 } from "@dxos/async";
|
|
3250
3246
|
import { Context as Context4 } from "@dxos/context";
|
|
3251
|
-
import { createCredentialSignerWithKey as createCredentialSignerWithKey2,
|
|
3247
|
+
import { createCredentialSignerWithKey as createCredentialSignerWithKey2, CredentialGenerator, generateSeedPhrase, keyPairFromSeedPhrase } from "@dxos/credentials";
|
|
3252
3248
|
import { invariant as invariant8 } from "@dxos/invariant";
|
|
3253
3249
|
import { PublicKey as PublicKey7 } from "@dxos/keys";
|
|
3254
3250
|
import { log as log10 } from "@dxos/log";
|
|
@@ -3290,7 +3286,7 @@ var IdentityManager = class {
|
|
|
3290
3286
|
id: traceId
|
|
3291
3287
|
}), {
|
|
3292
3288
|
F: __dxlog_file13,
|
|
3293
|
-
L:
|
|
3289
|
+
L: 121,
|
|
3294
3290
|
S: this,
|
|
3295
3291
|
C: (f, a) => f(...a)
|
|
3296
3292
|
});
|
|
@@ -3299,7 +3295,7 @@ var IdentityManager = class {
|
|
|
3299
3295
|
identityRecord
|
|
3300
3296
|
}, {
|
|
3301
3297
|
F: __dxlog_file13,
|
|
3302
|
-
L:
|
|
3298
|
+
L: 124,
|
|
3303
3299
|
S: this,
|
|
3304
3300
|
C: (f, a) => f(...a)
|
|
3305
3301
|
});
|
|
@@ -3312,7 +3308,7 @@ var IdentityManager = class {
|
|
|
3312
3308
|
displayName: this._identity.profileDocument?.displayName
|
|
3313
3309
|
}, {
|
|
3314
3310
|
F: __dxlog_file13,
|
|
3315
|
-
L:
|
|
3311
|
+
L: 129,
|
|
3316
3312
|
S: this,
|
|
3317
3313
|
C: (f, a) => f(...a)
|
|
3318
3314
|
});
|
|
@@ -3322,7 +3318,7 @@ var IdentityManager = class {
|
|
|
3322
3318
|
id: traceId
|
|
3323
3319
|
}), {
|
|
3324
3320
|
F: __dxlog_file13,
|
|
3325
|
-
L:
|
|
3321
|
+
L: 136,
|
|
3326
3322
|
S: this,
|
|
3327
3323
|
C: (f, a) => f(...a)
|
|
3328
3324
|
});
|
|
@@ -3330,13 +3326,13 @@ var IdentityManager = class {
|
|
|
3330
3326
|
async close() {
|
|
3331
3327
|
await this._identity?.close(new Context4(void 0, {
|
|
3332
3328
|
F: __dxlog_file13,
|
|
3333
|
-
L:
|
|
3329
|
+
L: 140
|
|
3334
3330
|
}));
|
|
3335
3331
|
}
|
|
3336
3332
|
async createIdentity({ displayName, deviceProfile } = {}) {
|
|
3337
3333
|
invariant8(!this._identity, "Identity already exists.", {
|
|
3338
3334
|
F: __dxlog_file13,
|
|
3339
|
-
L:
|
|
3335
|
+
L: 145,
|
|
3340
3336
|
S: this,
|
|
3341
3337
|
A: [
|
|
3342
3338
|
"!this._identity",
|
|
@@ -3345,7 +3341,7 @@ var IdentityManager = class {
|
|
|
3345
3341
|
});
|
|
3346
3342
|
log10("creating identity...", void 0, {
|
|
3347
3343
|
F: __dxlog_file13,
|
|
3348
|
-
L:
|
|
3344
|
+
L: 146,
|
|
3349
3345
|
S: this,
|
|
3350
3346
|
C: (f, a) => f(...a)
|
|
3351
3347
|
});
|
|
@@ -3363,13 +3359,13 @@ var IdentityManager = class {
|
|
|
3363
3359
|
const identity = await this._constructIdentity(identityRecord);
|
|
3364
3360
|
await identity.open(new Context4(void 0, {
|
|
3365
3361
|
F: __dxlog_file13,
|
|
3366
|
-
L:
|
|
3362
|
+
L: 161
|
|
3367
3363
|
}));
|
|
3368
3364
|
{
|
|
3369
3365
|
const generator = new CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
|
|
3370
3366
|
invariant8(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.", {
|
|
3371
3367
|
F: __dxlog_file13,
|
|
3372
|
-
L:
|
|
3368
|
+
L: 165,
|
|
3373
3369
|
S: this,
|
|
3374
3370
|
A: [
|
|
3375
3371
|
"identityRecord.haloSpace.genesisFeedKey",
|
|
@@ -3378,7 +3374,7 @@ var IdentityManager = class {
|
|
|
3378
3374
|
});
|
|
3379
3375
|
invariant8(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.", {
|
|
3380
3376
|
F: __dxlog_file13,
|
|
3381
|
-
L:
|
|
3377
|
+
L: 166,
|
|
3382
3378
|
S: this,
|
|
3383
3379
|
A: [
|
|
3384
3380
|
"identityRecord.haloSpace.dataFeedKey",
|
|
@@ -3417,7 +3413,7 @@ var IdentityManager = class {
|
|
|
3417
3413
|
displayName: this._identity.profileDocument?.displayName
|
|
3418
3414
|
}, {
|
|
3419
3415
|
F: __dxlog_file13,
|
|
3420
|
-
L:
|
|
3416
|
+
L: 204,
|
|
3421
3417
|
S: this,
|
|
3422
3418
|
C: (f, a) => f(...a)
|
|
3423
3419
|
});
|
|
@@ -3428,7 +3424,7 @@ var IdentityManager = class {
|
|
|
3428
3424
|
profile: identity.profileDocument
|
|
3429
3425
|
}, {
|
|
3430
3426
|
F: __dxlog_file13,
|
|
3431
|
-
L:
|
|
3427
|
+
L: 210,
|
|
3432
3428
|
S: this,
|
|
3433
3429
|
C: (f, a) => f(...a)
|
|
3434
3430
|
});
|
|
@@ -3465,13 +3461,13 @@ var IdentityManager = class {
|
|
|
3465
3461
|
params
|
|
3466
3462
|
}, {
|
|
3467
3463
|
F: __dxlog_file13,
|
|
3468
|
-
L:
|
|
3464
|
+
L: 249,
|
|
3469
3465
|
S: this,
|
|
3470
3466
|
C: (f, a) => f(...a)
|
|
3471
3467
|
});
|
|
3472
3468
|
invariant8(!this._identity, "Identity already exists.", {
|
|
3473
3469
|
F: __dxlog_file13,
|
|
3474
|
-
L:
|
|
3470
|
+
L: 250,
|
|
3475
3471
|
S: this,
|
|
3476
3472
|
A: [
|
|
3477
3473
|
"!this._identity",
|
|
@@ -3492,7 +3488,7 @@ var IdentityManager = class {
|
|
|
3492
3488
|
const identity = await this._constructIdentity(identityRecord);
|
|
3493
3489
|
await identity.open(new Context4(void 0, {
|
|
3494
3490
|
F: __dxlog_file13,
|
|
3495
|
-
L:
|
|
3491
|
+
L: 264
|
|
3496
3492
|
}));
|
|
3497
3493
|
return {
|
|
3498
3494
|
identity,
|
|
@@ -3511,7 +3507,7 @@ var IdentityManager = class {
|
|
|
3511
3507
|
displayName: this._identity.profileDocument?.displayName
|
|
3512
3508
|
}, {
|
|
3513
3509
|
F: __dxlog_file13,
|
|
3514
|
-
L:
|
|
3510
|
+
L: 278,
|
|
3515
3511
|
S: this,
|
|
3516
3512
|
C: (f, a) => f(...a)
|
|
3517
3513
|
});
|
|
@@ -3525,7 +3521,7 @@ var IdentityManager = class {
|
|
|
3525
3521
|
deviceKey: identity.deviceKey
|
|
3526
3522
|
}, {
|
|
3527
3523
|
F: __dxlog_file13,
|
|
3528
|
-
L:
|
|
3524
|
+
L: 289,
|
|
3529
3525
|
S: this,
|
|
3530
3526
|
C: (f, a) => f(...a)
|
|
3531
3527
|
});
|
|
@@ -3536,7 +3532,7 @@ var IdentityManager = class {
|
|
|
3536
3532
|
async updateProfile(profile) {
|
|
3537
3533
|
invariant8(this._identity, "Identity not initialized.", {
|
|
3538
3534
|
F: __dxlog_file13,
|
|
3539
|
-
L:
|
|
3535
|
+
L: 296,
|
|
3540
3536
|
S: this,
|
|
3541
3537
|
A: [
|
|
3542
3538
|
"this._identity",
|
|
@@ -3567,7 +3563,7 @@ var IdentityManager = class {
|
|
|
3567
3563
|
async updateDeviceProfile(profile) {
|
|
3568
3564
|
invariant8(this._identity, "Identity not initialized.", {
|
|
3569
3565
|
F: __dxlog_file13,
|
|
3570
|
-
L:
|
|
3566
|
+
L: 313,
|
|
3571
3567
|
S: this,
|
|
3572
3568
|
A: [
|
|
3573
3569
|
"this._identity",
|
|
@@ -3600,10 +3596,48 @@ var IdentityManager = class {
|
|
|
3600
3596
|
profile
|
|
3601
3597
|
};
|
|
3602
3598
|
}
|
|
3599
|
+
async createRecoveryPhrase() {
|
|
3600
|
+
const identity = this._identity;
|
|
3601
|
+
invariant8(identity, void 0, {
|
|
3602
|
+
F: __dxlog_file13,
|
|
3603
|
+
L: 340,
|
|
3604
|
+
S: this,
|
|
3605
|
+
A: [
|
|
3606
|
+
"identity",
|
|
3607
|
+
""
|
|
3608
|
+
]
|
|
3609
|
+
});
|
|
3610
|
+
const seedphrase = generateSeedPhrase();
|
|
3611
|
+
const keypair = keyPairFromSeedPhrase(seedphrase);
|
|
3612
|
+
const recoveryKey = PublicKey7.from(keypair.publicKey);
|
|
3613
|
+
const identityKey = identity.identityKey;
|
|
3614
|
+
const credential = await identity.getIdentityCredentialSigner().createCredential({
|
|
3615
|
+
subject: identityKey,
|
|
3616
|
+
assertion: {
|
|
3617
|
+
"@type": "dxos.halo.credentials.IdentityRecovery",
|
|
3618
|
+
recoveryKey,
|
|
3619
|
+
identityKey
|
|
3620
|
+
}
|
|
3621
|
+
});
|
|
3622
|
+
const receipt = await identity.controlPipeline.writer.write({
|
|
3623
|
+
credential: {
|
|
3624
|
+
credential
|
|
3625
|
+
}
|
|
3626
|
+
});
|
|
3627
|
+
await identity.controlPipeline.state.waitUntilTimeframe(new Timeframe3([
|
|
3628
|
+
[
|
|
3629
|
+
receipt.feedKey,
|
|
3630
|
+
receipt.seq
|
|
3631
|
+
]
|
|
3632
|
+
]));
|
|
3633
|
+
return {
|
|
3634
|
+
seedphrase
|
|
3635
|
+
};
|
|
3636
|
+
}
|
|
3603
3637
|
async _constructIdentity(identityRecord) {
|
|
3604
3638
|
invariant8(!this._identity, void 0, {
|
|
3605
3639
|
F: __dxlog_file13,
|
|
3606
|
-
L:
|
|
3640
|
+
L: 362,
|
|
3607
3641
|
S: this,
|
|
3608
3642
|
A: [
|
|
3609
3643
|
"!this._identity",
|
|
@@ -3614,7 +3648,7 @@ var IdentityManager = class {
|
|
|
3614
3648
|
identityRecord
|
|
3615
3649
|
}, {
|
|
3616
3650
|
F: __dxlog_file13,
|
|
3617
|
-
L:
|
|
3651
|
+
L: 363,
|
|
3618
3652
|
S: this,
|
|
3619
3653
|
C: (f, a) => f(...a)
|
|
3620
3654
|
});
|
|
@@ -3629,7 +3663,7 @@ var IdentityManager = class {
|
|
|
3629
3663
|
});
|
|
3630
3664
|
invariant8(identityRecord.haloSpace.controlFeedKey, void 0, {
|
|
3631
3665
|
F: __dxlog_file13,
|
|
3632
|
-
L:
|
|
3666
|
+
L: 376,
|
|
3633
3667
|
S: this,
|
|
3634
3668
|
A: [
|
|
3635
3669
|
"identityRecord.haloSpace.controlFeedKey",
|
|
@@ -3641,7 +3675,7 @@ var IdentityManager = class {
|
|
|
3641
3675
|
});
|
|
3642
3676
|
invariant8(identityRecord.haloSpace.dataFeedKey, void 0, {
|
|
3643
3677
|
F: __dxlog_file13,
|
|
3644
|
-
L:
|
|
3678
|
+
L: 380,
|
|
3645
3679
|
S: this,
|
|
3646
3680
|
A: [
|
|
3647
3681
|
"identityRecord.haloSpace.dataFeedKey",
|
|
@@ -3665,12 +3699,10 @@ var IdentityManager = class {
|
|
|
3665
3699
|
});
|
|
3666
3700
|
await space.setControlFeed(controlFeed);
|
|
3667
3701
|
await space.setDataFeed(dataFeed);
|
|
3668
|
-
const did = await createDidFromIdentityKey3(identityRecord.identityKey);
|
|
3669
3702
|
const identity = new Identity({
|
|
3670
3703
|
space,
|
|
3671
3704
|
presence,
|
|
3672
3705
|
signer: this._keyring,
|
|
3673
|
-
did,
|
|
3674
3706
|
identityKey: identityRecord.identityKey,
|
|
3675
3707
|
deviceKey: identityRecord.deviceKey,
|
|
3676
3708
|
edgeConnection: this._edgeConnection,
|
|
@@ -3680,7 +3712,7 @@ var IdentityManager = class {
|
|
|
3680
3712
|
identityKey: identityRecord.identityKey
|
|
3681
3713
|
}, {
|
|
3682
3714
|
F: __dxlog_file13,
|
|
3683
|
-
L:
|
|
3715
|
+
L: 409,
|
|
3684
3716
|
S: this,
|
|
3685
3717
|
C: (f, a) => f(...a)
|
|
3686
3718
|
});
|
|
@@ -3705,7 +3737,7 @@ var IdentityManager = class {
|
|
|
3705
3737
|
onAuthFailure: () => {
|
|
3706
3738
|
log10.warn("auth failure", void 0, {
|
|
3707
3739
|
F: __dxlog_file13,
|
|
3708
|
-
L:
|
|
3740
|
+
L: 434,
|
|
3709
3741
|
S: this,
|
|
3710
3742
|
C: (f, a) => f(...a)
|
|
3711
3743
|
});
|
|
@@ -3729,7 +3761,7 @@ IdentityManager = _ts_decorate5([
|
|
|
3729
3761
|
|
|
3730
3762
|
// packages/sdk/client-services/src/packlets/identity/identity-service.ts
|
|
3731
3763
|
import { Trigger as Trigger4, sleep as sleep2 } from "@dxos/async";
|
|
3732
|
-
import { Stream as Stream8 } from "@dxos/codec-protobuf
|
|
3764
|
+
import { Stream as Stream8 } from "@dxos/codec-protobuf";
|
|
3733
3765
|
import { Resource as Resource5 } from "@dxos/context";
|
|
3734
3766
|
import { createCredential as createCredential2, signPresentation } from "@dxos/credentials";
|
|
3735
3767
|
import { invariant as invariant9 } from "@dxos/invariant";
|
|
@@ -3768,7 +3800,7 @@ var IdentityServiceImpl = class extends Resource5 {
|
|
|
3768
3800
|
const identity = this._identityManager.identity;
|
|
3769
3801
|
invariant9(identity, void 0, {
|
|
3770
3802
|
F: __dxlog_file14,
|
|
3771
|
-
L:
|
|
3803
|
+
L: 60,
|
|
3772
3804
|
S: this,
|
|
3773
3805
|
A: [
|
|
3774
3806
|
"identity",
|
|
@@ -3791,7 +3823,6 @@ var IdentityServiceImpl = class extends Resource5 {
|
|
|
3791
3823
|
return void 0;
|
|
3792
3824
|
}
|
|
3793
3825
|
return {
|
|
3794
|
-
did: this._identityManager.identity.did,
|
|
3795
3826
|
identityKey: this._identityManager.identity.identityKey,
|
|
3796
3827
|
spaceKey: this._identityManager.identity.space.key,
|
|
3797
3828
|
profile: this._identityManager.identity.profileDocument
|
|
@@ -3800,7 +3831,7 @@ var IdentityServiceImpl = class extends Resource5 {
|
|
|
3800
3831
|
async updateProfile(profile) {
|
|
3801
3832
|
invariant9(this._identityManager.identity, "Identity not initialized.", {
|
|
3802
3833
|
F: __dxlog_file14,
|
|
3803
|
-
L:
|
|
3834
|
+
L: 86,
|
|
3804
3835
|
S: this,
|
|
3805
3836
|
A: [
|
|
3806
3837
|
"this._identityManager.identity",
|
|
@@ -3811,8 +3842,8 @@ var IdentityServiceImpl = class extends Resource5 {
|
|
|
3811
3842
|
await this._onProfileUpdate?.(this._identityManager.identity.profileDocument);
|
|
3812
3843
|
return this._getIdentity();
|
|
3813
3844
|
}
|
|
3814
|
-
async
|
|
3815
|
-
return this._recoveryManager.
|
|
3845
|
+
async createRecoveryPhrase() {
|
|
3846
|
+
return this._recoveryManager.createRecoveryPhrase();
|
|
3816
3847
|
}
|
|
3817
3848
|
async recoverIdentity(request) {
|
|
3818
3849
|
await this._recoveryManager.recoverIdentity(request);
|
|
@@ -3822,7 +3853,7 @@ var IdentityServiceImpl = class extends Resource5 {
|
|
|
3822
3853
|
async signPresentation({ presentation, nonce }) {
|
|
3823
3854
|
invariant9(this._identityManager.identity, "Identity not initialized.", {
|
|
3824
3855
|
F: __dxlog_file14,
|
|
3825
|
-
L:
|
|
3856
|
+
L: 103,
|
|
3826
3857
|
S: this,
|
|
3827
3858
|
A: [
|
|
3828
3859
|
"this._identityManager.identity",
|
|
@@ -3841,7 +3872,7 @@ var IdentityServiceImpl = class extends Resource5 {
|
|
|
3841
3872
|
const identity = this._identityManager.identity;
|
|
3842
3873
|
invariant9(identity, "Identity not initialized.", {
|
|
3843
3874
|
F: __dxlog_file14,
|
|
3844
|
-
L:
|
|
3875
|
+
L: 117,
|
|
3845
3876
|
S: this,
|
|
3846
3877
|
A: [
|
|
3847
3878
|
"identity",
|
|
@@ -3879,7 +3910,7 @@ var IdentityServiceImpl = class extends Resource5 {
|
|
|
3879
3910
|
duplicate: space.id
|
|
3880
3911
|
}, {
|
|
3881
3912
|
F: __dxlog_file14,
|
|
3882
|
-
L:
|
|
3913
|
+
L: 151,
|
|
3883
3914
|
S: this,
|
|
3884
3915
|
C: (f, a) => f(...a)
|
|
3885
3916
|
});
|
|
@@ -3893,7 +3924,7 @@ var IdentityServiceImpl = class extends Resource5 {
|
|
|
3893
3924
|
}, (err) => {
|
|
3894
3925
|
log11.catch(err, void 0, {
|
|
3895
3926
|
F: __dxlog_file14,
|
|
3896
|
-
L:
|
|
3927
|
+
L: 162,
|
|
3897
3928
|
S: this,
|
|
3898
3929
|
C: (f, a) => f(...a)
|
|
3899
3930
|
});
|
|
@@ -4674,14 +4705,14 @@ var DeviceInvitationProtocol = class {
|
|
|
4674
4705
|
|
|
4675
4706
|
// packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts
|
|
4676
4707
|
import { scheduleTask as scheduleTask7, TimeoutError as TimeoutError2 } from "@dxos/async";
|
|
4677
|
-
import { INVITATION_TIMEOUT
|
|
4708
|
+
import { INVITATION_TIMEOUT } from "@dxos/client-protocol";
|
|
4678
4709
|
import { ContextDisposedError as ContextDisposedError3 } from "@dxos/context";
|
|
4679
4710
|
import { createKeyPair, sign as sign2 } from "@dxos/crypto";
|
|
4680
4711
|
import { invariant as invariant15 } from "@dxos/invariant";
|
|
4681
4712
|
import { PublicKey as PublicKey11 } from "@dxos/keys";
|
|
4682
4713
|
import { log as log18 } from "@dxos/log";
|
|
4683
4714
|
import { createTeleportProtocolFactory } from "@dxos/network-manager";
|
|
4684
|
-
import {
|
|
4715
|
+
import { InvalidInvitationExtensionRoleError as InvalidInvitationExtensionRoleError3, trace as trace7 } from "@dxos/protocols";
|
|
4685
4716
|
import { Invitation as Invitation7 } from "@dxos/protocols/proto/dxos/client/services";
|
|
4686
4717
|
import { AuthenticationResponse as AuthenticationResponse2 } from "@dxos/protocols/proto/dxos/halo/invitations";
|
|
4687
4718
|
import { InvitationOptions as InvitationOptions4 } from "@dxos/protocols/proto/dxos/halo/invitations";
|
|
@@ -4704,12 +4735,6 @@ import { Invitation as Invitation3 } from "@dxos/protocols/proto/dxos/client/ser
|
|
|
4704
4735
|
var stateToString = (state) => {
|
|
4705
4736
|
return Object.entries(Invitation3.State).find(([key, val]) => val === state)?.[0] ?? "unknown";
|
|
4706
4737
|
};
|
|
4707
|
-
var computeExpirationTime = (invitation) => {
|
|
4708
|
-
if (!invitation.lifetime) {
|
|
4709
|
-
return;
|
|
4710
|
-
}
|
|
4711
|
-
return new Date((invitation.created?.getTime() ?? Date.now()) + invitation.lifetime * 1e3);
|
|
4712
|
-
};
|
|
4713
4738
|
var tryAcquireBeforeContextDisposed = async (ctx, mutex) => {
|
|
4714
4739
|
let guard;
|
|
4715
4740
|
return cancelWithContext3(ctx, (async () => {
|
|
@@ -5725,19 +5750,18 @@ var InvitationsHandler = class {
|
|
|
5725
5750
|
});
|
|
5726
5751
|
return extension;
|
|
5727
5752
|
};
|
|
5728
|
-
|
|
5729
|
-
|
|
5730
|
-
if (expiresOn.getTime() < Date.now()) {
|
|
5753
|
+
if (invitation.lifetime && invitation.created) {
|
|
5754
|
+
if (invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now()) {
|
|
5731
5755
|
log18.warn("invitation has already expired", void 0, {
|
|
5732
5756
|
F: __dxlog_file22,
|
|
5733
|
-
L:
|
|
5757
|
+
L: 193,
|
|
5734
5758
|
S: this,
|
|
5735
5759
|
C: (f, a) => f(...a)
|
|
5736
5760
|
});
|
|
5737
5761
|
guardedState.set(null, Invitation7.State.EXPIRED);
|
|
5738
5762
|
void ctx.dispose().catch((err) => log18.catch(err, void 0, {
|
|
5739
5763
|
F: __dxlog_file22,
|
|
5740
|
-
L:
|
|
5764
|
+
L: 195,
|
|
5741
5765
|
S: this,
|
|
5742
5766
|
C: (f, a) => f(...a)
|
|
5743
5767
|
}));
|
|
@@ -5748,7 +5772,7 @@ var InvitationsHandler = class {
|
|
|
5748
5772
|
guardedState.set(null, Invitation7.State.EXPIRED);
|
|
5749
5773
|
metrics.increment("dxos.invitation.expired");
|
|
5750
5774
|
await ctx.dispose();
|
|
5751
|
-
},
|
|
5775
|
+
}, invitation.created.getTime() + invitation.lifetime * 1e3 - Date.now());
|
|
5752
5776
|
}
|
|
5753
5777
|
let swarmConnection;
|
|
5754
5778
|
scheduleTask7(ctx, async () => {
|
|
@@ -5764,7 +5788,7 @@ var InvitationsHandler = class {
|
|
|
5764
5788
|
type: invitation.type
|
|
5765
5789
|
}, {
|
|
5766
5790
|
F: __dxlog_file22,
|
|
5767
|
-
L:
|
|
5791
|
+
L: 226,
|
|
5768
5792
|
S: this,
|
|
5769
5793
|
C: (f, a) => f(...a)
|
|
5770
5794
|
});
|
|
@@ -5772,7 +5796,7 @@ var InvitationsHandler = class {
|
|
|
5772
5796
|
if (deviceProfile) {
|
|
5773
5797
|
invariant15(invitation.kind === Invitation7.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
|
|
5774
5798
|
F: __dxlog_file22,
|
|
5775
|
-
L:
|
|
5799
|
+
L: 235,
|
|
5776
5800
|
S: this,
|
|
5777
5801
|
A: [
|
|
5778
5802
|
"invitation.kind === Invitation.Kind.DEVICE",
|
|
@@ -5790,7 +5814,7 @@ var InvitationsHandler = class {
|
|
|
5790
5814
|
triedPeers: triedPeersIds.size
|
|
5791
5815
|
}, {
|
|
5792
5816
|
F: __dxlog_file22,
|
|
5793
|
-
L:
|
|
5817
|
+
L: 243,
|
|
5794
5818
|
S: this,
|
|
5795
5819
|
C: (f, a) => f(...a)
|
|
5796
5820
|
});
|
|
@@ -5817,7 +5841,7 @@ var InvitationsHandler = class {
|
|
|
5817
5841
|
currentState: guardedState.current.state
|
|
5818
5842
|
}, {
|
|
5819
5843
|
F: __dxlog_file22,
|
|
5820
|
-
L:
|
|
5844
|
+
L: 271,
|
|
5821
5845
|
S: this,
|
|
5822
5846
|
C: (f, a) => f(...a)
|
|
5823
5847
|
});
|
|
@@ -5835,7 +5859,7 @@ var InvitationsHandler = class {
|
|
|
5835
5859
|
id: traceId
|
|
5836
5860
|
}), {
|
|
5837
5861
|
F: __dxlog_file22,
|
|
5838
|
-
L:
|
|
5862
|
+
L: 283,
|
|
5839
5863
|
S: this,
|
|
5840
5864
|
C: (f, a) => f(...a)
|
|
5841
5865
|
});
|
|
@@ -5847,7 +5871,7 @@ var InvitationsHandler = class {
|
|
|
5847
5871
|
...protocol.toJSON()
|
|
5848
5872
|
}, {
|
|
5849
5873
|
F: __dxlog_file22,
|
|
5850
|
-
L:
|
|
5874
|
+
L: 294,
|
|
5851
5875
|
S: this,
|
|
5852
5876
|
C: (f, a) => f(...a)
|
|
5853
5877
|
});
|
|
@@ -5857,7 +5881,7 @@ var InvitationsHandler = class {
|
|
|
5857
5881
|
...protocol.toJSON()
|
|
5858
5882
|
}, {
|
|
5859
5883
|
F: __dxlog_file22,
|
|
5860
|
-
L:
|
|
5884
|
+
L: 298,
|
|
5861
5885
|
S: this,
|
|
5862
5886
|
C: (f, a) => f(...a)
|
|
5863
5887
|
});
|
|
@@ -5871,7 +5895,7 @@ var InvitationsHandler = class {
|
|
|
5871
5895
|
authMethod: introductionResponse.authMethod
|
|
5872
5896
|
}, {
|
|
5873
5897
|
F: __dxlog_file22,
|
|
5874
|
-
L:
|
|
5898
|
+
L: 306,
|
|
5875
5899
|
S: this,
|
|
5876
5900
|
C: (f, a) => f(...a)
|
|
5877
5901
|
});
|
|
@@ -5893,7 +5917,7 @@ var InvitationsHandler = class {
|
|
|
5893
5917
|
...protocol.toJSON()
|
|
5894
5918
|
}, {
|
|
5895
5919
|
F: __dxlog_file22,
|
|
5896
|
-
L:
|
|
5920
|
+
L: 336,
|
|
5897
5921
|
S: this,
|
|
5898
5922
|
C: (f, a) => f(...a)
|
|
5899
5923
|
});
|
|
@@ -5906,7 +5930,7 @@ var InvitationsHandler = class {
|
|
|
5906
5930
|
...protocol.toJSON()
|
|
5907
5931
|
}, {
|
|
5908
5932
|
F: __dxlog_file22,
|
|
5909
|
-
L:
|
|
5933
|
+
L: 350,
|
|
5910
5934
|
S: this,
|
|
5911
5935
|
C: (f, a) => f(...a)
|
|
5912
5936
|
});
|
|
@@ -5919,7 +5943,7 @@ var InvitationsHandler = class {
|
|
|
5919
5943
|
id: traceId
|
|
5920
5944
|
}), {
|
|
5921
5945
|
F: __dxlog_file22,
|
|
5922
|
-
L:
|
|
5946
|
+
L: 359,
|
|
5923
5947
|
S: this,
|
|
5924
5948
|
C: (f, a) => f(...a)
|
|
5925
5949
|
});
|
|
@@ -5929,7 +5953,7 @@ var InvitationsHandler = class {
|
|
|
5929
5953
|
...protocol.toJSON()
|
|
5930
5954
|
}, {
|
|
5931
5955
|
F: __dxlog_file22,
|
|
5932
|
-
L:
|
|
5956
|
+
L: 362,
|
|
5933
5957
|
S: this,
|
|
5934
5958
|
C: (f, a) => f(...a)
|
|
5935
5959
|
});
|
|
@@ -5937,7 +5961,7 @@ var InvitationsHandler = class {
|
|
|
5937
5961
|
} else {
|
|
5938
5962
|
log18.verbose("auth failed", err, {
|
|
5939
5963
|
F: __dxlog_file22,
|
|
5940
|
-
L:
|
|
5964
|
+
L: 365,
|
|
5941
5965
|
S: this,
|
|
5942
5966
|
C: (f, a) => f(...a)
|
|
5943
5967
|
});
|
|
@@ -5949,7 +5973,7 @@ var InvitationsHandler = class {
|
|
|
5949
5973
|
error: err
|
|
5950
5974
|
}), {
|
|
5951
5975
|
F: __dxlog_file22,
|
|
5952
|
-
L:
|
|
5976
|
+
L: 369,
|
|
5953
5977
|
S: this,
|
|
5954
5978
|
C: (f, a) => f(...a)
|
|
5955
5979
|
});
|
|
@@ -5965,7 +5989,7 @@ var InvitationsHandler = class {
|
|
|
5965
5989
|
...protocol.toJSON()
|
|
5966
5990
|
}, {
|
|
5967
5991
|
F: __dxlog_file22,
|
|
5968
|
-
L:
|
|
5992
|
+
L: 378,
|
|
5969
5993
|
S: this,
|
|
5970
5994
|
C: (f, a) => f(...a)
|
|
5971
5995
|
});
|
|
@@ -5973,7 +5997,7 @@ var InvitationsHandler = class {
|
|
|
5973
5997
|
} else {
|
|
5974
5998
|
log18.verbose("auth failed", err, {
|
|
5975
5999
|
F: __dxlog_file22,
|
|
5976
|
-
L:
|
|
6000
|
+
L: 381,
|
|
5977
6001
|
S: this,
|
|
5978
6002
|
C: (f, a) => f(...a)
|
|
5979
6003
|
});
|
|
@@ -5990,7 +6014,7 @@ var InvitationsHandler = class {
|
|
|
5990
6014
|
...protocol.toJSON()
|
|
5991
6015
|
}, {
|
|
5992
6016
|
F: __dxlog_file22,
|
|
5993
|
-
L:
|
|
6017
|
+
L: 393,
|
|
5994
6018
|
S: this,
|
|
5995
6019
|
C: (f, a) => f(...a)
|
|
5996
6020
|
});
|
|
@@ -6003,14 +6027,14 @@ var InvitationsHandler = class {
|
|
|
6003
6027
|
});
|
|
6004
6028
|
edgeInvitationHandler.handle(ctx, guardedState, protocol, deviceProfile);
|
|
6005
6029
|
scheduleTask7(ctx, async () => {
|
|
6006
|
-
const error = checkInvitation(
|
|
6030
|
+
const error = protocol.checkInvitation(invitation);
|
|
6007
6031
|
if (error) {
|
|
6008
6032
|
stream.error(error);
|
|
6009
6033
|
await ctx.dispose();
|
|
6010
6034
|
} else {
|
|
6011
6035
|
invariant15(invitation.swarmKey, void 0, {
|
|
6012
6036
|
F: __dxlog_file22,
|
|
6013
|
-
L:
|
|
6037
|
+
L: 405,
|
|
6014
6038
|
S: this,
|
|
6015
6039
|
A: [
|
|
6016
6040
|
"invitation.swarmKey",
|
|
@@ -6054,7 +6078,7 @@ var InvitationsHandler = class {
|
|
|
6054
6078
|
for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
|
|
6055
6079
|
log18("guest waiting for authentication code...", void 0, {
|
|
6056
6080
|
F: __dxlog_file22,
|
|
6057
|
-
L:
|
|
6081
|
+
L: 457,
|
|
6058
6082
|
S: this,
|
|
6059
6083
|
C: (f, a) => f(...a)
|
|
6060
6084
|
});
|
|
@@ -6062,7 +6086,7 @@ var InvitationsHandler = class {
|
|
|
6062
6086
|
const authCode = await authenticated.wait(options);
|
|
6063
6087
|
log18("sending authentication request", void 0, {
|
|
6064
6088
|
F: __dxlog_file22,
|
|
6065
|
-
L:
|
|
6089
|
+
L: 461,
|
|
6066
6090
|
S: this,
|
|
6067
6091
|
C: (f, a) => f(...a)
|
|
6068
6092
|
});
|
|
@@ -6081,7 +6105,7 @@ var InvitationsHandler = class {
|
|
|
6081
6105
|
attempt
|
|
6082
6106
|
}, {
|
|
6083
6107
|
F: __dxlog_file22,
|
|
6084
|
-
L:
|
|
6108
|
+
L: 472,
|
|
6085
6109
|
S: this,
|
|
6086
6110
|
C: (f, a) => f(...a)
|
|
6087
6111
|
});
|
|
@@ -6099,7 +6123,7 @@ var InvitationsHandler = class {
|
|
|
6099
6123
|
}
|
|
6100
6124
|
log18("sending authentication request", void 0, {
|
|
6101
6125
|
F: __dxlog_file22,
|
|
6102
|
-
L:
|
|
6126
|
+
L: 491,
|
|
6103
6127
|
S: this,
|
|
6104
6128
|
C: (f, a) => f(...a)
|
|
6105
6129
|
});
|
|
@@ -6112,13 +6136,6 @@ var InvitationsHandler = class {
|
|
|
6112
6136
|
}
|
|
6113
6137
|
}
|
|
6114
6138
|
};
|
|
6115
|
-
var checkInvitation = (protocol, invitation) => {
|
|
6116
|
-
const expiresOn = getExpirationTime(invitation);
|
|
6117
|
-
if (expiresOn && expiresOn.getTime() < Date.now()) {
|
|
6118
|
-
return new InvalidInvitationError("Invitation already expired.");
|
|
6119
|
-
}
|
|
6120
|
-
return protocol.checkInvitation(invitation);
|
|
6121
|
-
};
|
|
6122
6139
|
var createAdmissionKeypair = () => {
|
|
6123
6140
|
const keypair = createKeyPair();
|
|
6124
6141
|
return {
|
|
@@ -6128,7 +6145,7 @@ var createAdmissionKeypair = () => {
|
|
|
6128
6145
|
};
|
|
6129
6146
|
|
|
6130
6147
|
// packages/sdk/client-services/src/packlets/invitations/invitations-service.ts
|
|
6131
|
-
import { Stream as Stream9 } from "@dxos/codec-protobuf
|
|
6148
|
+
import { Stream as Stream9 } from "@dxos/codec-protobuf";
|
|
6132
6149
|
import { QueryInvitationsResponse } from "@dxos/protocols/proto/dxos/client/services";
|
|
6133
6150
|
import { trace as trace8 } from "@dxos/tracing";
|
|
6134
6151
|
var InvitationsServiceImpl = class {
|
|
@@ -6233,7 +6250,7 @@ import { createCancelDelegatedSpaceInvitationCredential, createDelegatedSpaceInv
|
|
|
6233
6250
|
import { writeMessages as writeMessages4 } from "@dxos/feed-store";
|
|
6234
6251
|
import { invariant as invariant16 } from "@dxos/invariant";
|
|
6235
6252
|
import { log as log19 } from "@dxos/log";
|
|
6236
|
-
import { AlreadyJoinedError as AlreadyJoinedError3, AuthorizationError as AuthorizationError2, InvalidInvitationError
|
|
6253
|
+
import { AlreadyJoinedError as AlreadyJoinedError3, AuthorizationError as AuthorizationError2, InvalidInvitationError, SpaceNotFoundError as SpaceNotFoundError2 } from "@dxos/protocols";
|
|
6237
6254
|
import { Invitation as Invitation8 } from "@dxos/protocols/proto/dxos/client/services";
|
|
6238
6255
|
import { SpaceMember as SpaceMember6 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
6239
6256
|
var __dxlog_file23 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
|
|
@@ -6253,7 +6270,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6253
6270
|
}
|
|
6254
6271
|
checkCanInviteNewMembers() {
|
|
6255
6272
|
if (this._spaceKey == null) {
|
|
6256
|
-
return new
|
|
6273
|
+
return new InvalidInvitationError("No spaceKey was provided for a space invitation.");
|
|
6257
6274
|
}
|
|
6258
6275
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
6259
6276
|
if (space == null) {
|
|
@@ -6267,7 +6284,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6267
6284
|
getInvitationContext() {
|
|
6268
6285
|
invariant16(this._spaceKey, void 0, {
|
|
6269
6286
|
F: __dxlog_file23,
|
|
6270
|
-
L:
|
|
6287
|
+
L: 64,
|
|
6271
6288
|
S: this,
|
|
6272
6289
|
A: [
|
|
6273
6290
|
"this._spaceKey",
|
|
@@ -6277,7 +6294,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6277
6294
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
6278
6295
|
invariant16(space, void 0, {
|
|
6279
6296
|
F: __dxlog_file23,
|
|
6280
|
-
L:
|
|
6297
|
+
L: 66,
|
|
6281
6298
|
S: this,
|
|
6282
6299
|
A: [
|
|
6283
6300
|
"space",
|
|
@@ -6293,7 +6310,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6293
6310
|
async admit(invitation, request, guestProfile) {
|
|
6294
6311
|
invariant16(this._spaceKey && request.space, void 0, {
|
|
6295
6312
|
F: __dxlog_file23,
|
|
6296
|
-
L:
|
|
6313
|
+
L: 79,
|
|
6297
6314
|
S: this,
|
|
6298
6315
|
A: [
|
|
6299
6316
|
"this._spaceKey && request.space",
|
|
@@ -6305,7 +6322,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6305
6322
|
guest: request.space.deviceKey
|
|
6306
6323
|
}, {
|
|
6307
6324
|
F: __dxlog_file23,
|
|
6308
|
-
L:
|
|
6325
|
+
L: 80,
|
|
6309
6326
|
S: this,
|
|
6310
6327
|
C: (f, a) => f(...a)
|
|
6311
6328
|
});
|
|
@@ -6327,7 +6344,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6327
6344
|
async delegate(invitation) {
|
|
6328
6345
|
invariant16(this._spaceKey, void 0, {
|
|
6329
6346
|
F: __dxlog_file23,
|
|
6330
|
-
L:
|
|
6347
|
+
L: 100,
|
|
6331
6348
|
S: this,
|
|
6332
6349
|
A: [
|
|
6333
6350
|
"this._spaceKey",
|
|
@@ -6337,7 +6354,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6337
6354
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
6338
6355
|
invariant16(space, void 0, {
|
|
6339
6356
|
F: __dxlog_file23,
|
|
6340
|
-
L:
|
|
6357
|
+
L: 102,
|
|
6341
6358
|
S: this,
|
|
6342
6359
|
A: [
|
|
6343
6360
|
"space",
|
|
@@ -6347,7 +6364,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6347
6364
|
if (invitation.authMethod === Invitation8.AuthMethod.KNOWN_PUBLIC_KEY) {
|
|
6348
6365
|
invariant16(invitation.guestKeypair?.publicKey, void 0, {
|
|
6349
6366
|
F: __dxlog_file23,
|
|
6350
|
-
L:
|
|
6367
|
+
L: 104,
|
|
6351
6368
|
S: this,
|
|
6352
6369
|
A: [
|
|
6353
6370
|
"invitation.guestKeypair?.publicKey",
|
|
@@ -6360,7 +6377,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6360
6377
|
id: invitation.invitationId
|
|
6361
6378
|
}, {
|
|
6362
6379
|
F: __dxlog_file23,
|
|
6363
|
-
L:
|
|
6380
|
+
L: 107,
|
|
6364
6381
|
S: this,
|
|
6365
6382
|
C: (f, a) => f(...a)
|
|
6366
6383
|
});
|
|
@@ -6369,13 +6386,13 @@ var SpaceInvitationProtocol = class {
|
|
|
6369
6386
|
authMethod: invitation.authMethod,
|
|
6370
6387
|
swarmKey: invitation.swarmKey,
|
|
6371
6388
|
role: invitation.role ?? SpaceMember6.Role.ADMIN,
|
|
6372
|
-
expiresOn:
|
|
6389
|
+
expiresOn: invitation.lifetime ? new Date((invitation.created?.getTime() ?? Date.now()) + invitation.lifetime) : void 0,
|
|
6373
6390
|
multiUse: invitation.multiUse ?? false,
|
|
6374
6391
|
guestKey: invitation.authMethod === Invitation8.AuthMethod.KNOWN_PUBLIC_KEY ? invitation.guestKeypair.publicKey : void 0
|
|
6375
6392
|
});
|
|
6376
6393
|
invariant16(credential.credential, void 0, {
|
|
6377
6394
|
F: __dxlog_file23,
|
|
6378
|
-
L:
|
|
6395
|
+
L: 127,
|
|
6379
6396
|
S: this,
|
|
6380
6397
|
A: [
|
|
6381
6398
|
"credential.credential",
|
|
@@ -6390,7 +6407,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6390
6407
|
async cancelDelegation(invitation) {
|
|
6391
6408
|
invariant16(this._spaceKey, void 0, {
|
|
6392
6409
|
F: __dxlog_file23,
|
|
6393
|
-
L:
|
|
6410
|
+
L: 133,
|
|
6394
6411
|
S: this,
|
|
6395
6412
|
A: [
|
|
6396
6413
|
"this._spaceKey",
|
|
@@ -6399,7 +6416,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6399
6416
|
});
|
|
6400
6417
|
invariant16(invitation.type === Invitation8.Type.DELEGATED && invitation.delegationCredentialId, void 0, {
|
|
6401
6418
|
F: __dxlog_file23,
|
|
6402
|
-
L:
|
|
6419
|
+
L: 134,
|
|
6403
6420
|
S: this,
|
|
6404
6421
|
A: [
|
|
6405
6422
|
"invitation.type === Invitation.Type.DELEGATED && invitation.delegationCredentialId",
|
|
@@ -6409,7 +6426,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6409
6426
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
6410
6427
|
invariant16(space, void 0, {
|
|
6411
6428
|
F: __dxlog_file23,
|
|
6412
|
-
L:
|
|
6429
|
+
L: 136,
|
|
6413
6430
|
S: this,
|
|
6414
6431
|
A: [
|
|
6415
6432
|
"space",
|
|
@@ -6421,14 +6438,14 @@ var SpaceInvitationProtocol = class {
|
|
|
6421
6438
|
id: invitation.invitationId
|
|
6422
6439
|
}, {
|
|
6423
6440
|
F: __dxlog_file23,
|
|
6424
|
-
L:
|
|
6441
|
+
L: 138,
|
|
6425
6442
|
S: this,
|
|
6426
6443
|
C: (f, a) => f(...a)
|
|
6427
6444
|
});
|
|
6428
6445
|
const credential = await createCancelDelegatedSpaceInvitationCredential(this._signingContext.credentialSigner, space.key, invitation.delegationCredentialId);
|
|
6429
6446
|
invariant16(credential.credential, void 0, {
|
|
6430
6447
|
F: __dxlog_file23,
|
|
6431
|
-
L:
|
|
6448
|
+
L: 145,
|
|
6432
6449
|
S: this,
|
|
6433
6450
|
A: [
|
|
6434
6451
|
"credential.credential",
|
|
@@ -6441,7 +6458,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6441
6458
|
}
|
|
6442
6459
|
checkInvitation(invitation) {
|
|
6443
6460
|
if (invitation.spaceKey == null) {
|
|
6444
|
-
return new
|
|
6461
|
+
return new InvalidInvitationError("No spaceKey was provided for a space invitation.");
|
|
6445
6462
|
}
|
|
6446
6463
|
if (this._spaceManager.spaces.has(invitation.spaceKey)) {
|
|
6447
6464
|
return new AlreadyJoinedError3("Already joined space.");
|
|
@@ -6467,7 +6484,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6467
6484
|
async accept(response) {
|
|
6468
6485
|
invariant16(response.space, void 0, {
|
|
6469
6486
|
F: __dxlog_file23,
|
|
6470
|
-
L:
|
|
6487
|
+
L: 180,
|
|
6471
6488
|
S: this,
|
|
6472
6489
|
A: [
|
|
6473
6490
|
"response.space",
|
|
@@ -6478,7 +6495,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6478
6495
|
const assertion = getCredentialAssertion5(credential);
|
|
6479
6496
|
invariant16(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
6480
6497
|
F: __dxlog_file23,
|
|
6481
|
-
L:
|
|
6498
|
+
L: 183,
|
|
6482
6499
|
S: this,
|
|
6483
6500
|
A: [
|
|
6484
6501
|
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -6487,7 +6504,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6487
6504
|
});
|
|
6488
6505
|
invariant16(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
|
|
6489
6506
|
F: __dxlog_file23,
|
|
6490
|
-
L:
|
|
6507
|
+
L: 184,
|
|
6491
6508
|
S: this,
|
|
6492
6509
|
A: [
|
|
6493
6510
|
"credential.subject.id.equals(this._signingContext.identityKey)",
|
|
@@ -6723,7 +6740,7 @@ var InvitationsManager = class {
|
|
|
6723
6740
|
}
|
|
6724
6741
|
}
|
|
6725
6742
|
_createInvitation(protocol, _options) {
|
|
6726
|
-
const { invitationId = PublicKey12.random().toHex(), type = Invitation9.Type.INTERACTIVE, authMethod = Invitation9.AuthMethod.SHARED_SECRET, state = Invitation9.State.INIT, timeout = INVITATION_TIMEOUT2, swarmKey = PublicKey12.random(), persistent = _options?.authMethod !== Invitation9.AuthMethod.KNOWN_PUBLIC_KEY, created = /* @__PURE__ */ new Date(), guestKeypair = void 0, role = SpaceMember7.Role.ADMIN, lifetime = 86400
|
|
6743
|
+
const { invitationId = PublicKey12.random().toHex(), type = Invitation9.Type.INTERACTIVE, authMethod = Invitation9.AuthMethod.SHARED_SECRET, state = Invitation9.State.INIT, timeout = INVITATION_TIMEOUT2, swarmKey = PublicKey12.random(), persistent = _options?.authMethod !== Invitation9.AuthMethod.KNOWN_PUBLIC_KEY, created = /* @__PURE__ */ new Date(), guestKeypair = void 0, role = SpaceMember7.Role.ADMIN, lifetime = 86400, multiUse = false, ...options } = _options ?? {};
|
|
6727
6744
|
const authCode = options?.authCode ?? (authMethod === Invitation9.AuthMethod.SHARED_SECRET ? generatePasscode(AUTHENTICATION_CODE_LENGTH) : void 0);
|
|
6728
6745
|
return {
|
|
6729
6746
|
invitationId,
|
|
@@ -7310,7 +7327,7 @@ _ts_decorate9([
|
|
|
7310
7327
|
], EdgeAgentManager.prototype, "createAgent", null);
|
|
7311
7328
|
|
|
7312
7329
|
// packages/sdk/client-services/src/packlets/agents/edge-agent-service.ts
|
|
7313
|
-
import { Stream as Stream11 } from "@dxos/codec-protobuf
|
|
7330
|
+
import { Stream as Stream11 } from "@dxos/codec-protobuf";
|
|
7314
7331
|
import { EdgeAgentStatus as EdgeAgentStatus2 } from "@dxos/protocols";
|
|
7315
7332
|
import { QueryAgentStatusResponse, QueryEdgeStatusResponse } from "@dxos/protocols/proto/dxos/client/services";
|
|
7316
7333
|
var EdgeAgentServiceImpl = class {
|
|
@@ -7389,7 +7406,7 @@ import { trace as Trace3 } from "@dxos/tracing";
|
|
|
7389
7406
|
import { safeInstanceof } from "@dxos/util";
|
|
7390
7407
|
|
|
7391
7408
|
// packages/sdk/client-services/src/packlets/identity/identity-recovery-manager.ts
|
|
7392
|
-
import { generateSeedPhrase, keyPairFromSeedPhrase } from "@dxos/credentials";
|
|
7409
|
+
import { generateSeedPhrase as generateSeedPhrase2, keyPairFromSeedPhrase as keyPairFromSeedPhrase2 } from "@dxos/credentials";
|
|
7393
7410
|
import { sign as sign3 } from "@dxos/crypto";
|
|
7394
7411
|
import { invariant as invariant19 } from "@dxos/invariant";
|
|
7395
7412
|
import { PublicKey as PublicKey14 } from "@dxos/keys";
|
|
@@ -7405,41 +7422,27 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7405
7422
|
this._identityProvider = _identityProvider;
|
|
7406
7423
|
this._acceptRecoveredIdentity = _acceptRecoveredIdentity;
|
|
7407
7424
|
}
|
|
7408
|
-
async
|
|
7425
|
+
async createRecoveryPhrase() {
|
|
7409
7426
|
const identity = this._identityProvider();
|
|
7410
7427
|
invariant19(identity, void 0, {
|
|
7411
7428
|
F: __dxlog_file27,
|
|
7412
|
-
L:
|
|
7429
|
+
L: 29,
|
|
7413
7430
|
S: this,
|
|
7414
7431
|
A: [
|
|
7415
7432
|
"identity",
|
|
7416
7433
|
""
|
|
7417
7434
|
]
|
|
7418
7435
|
});
|
|
7419
|
-
|
|
7420
|
-
|
|
7421
|
-
|
|
7422
|
-
const keypair = keyPairFromSeedPhrase(recoveryCode);
|
|
7423
|
-
recoveryKey = PublicKey14.from(keypair.publicKey);
|
|
7424
|
-
algorithm = -8;
|
|
7425
|
-
}
|
|
7426
|
-
invariant19(algorithm, "Algorithm is required.", {
|
|
7427
|
-
F: __dxlog_file27,
|
|
7428
|
-
L: 47,
|
|
7429
|
-
S: this,
|
|
7430
|
-
A: [
|
|
7431
|
-
"algorithm",
|
|
7432
|
-
"'Algorithm is required.'"
|
|
7433
|
-
]
|
|
7434
|
-
});
|
|
7436
|
+
const seedphrase = generateSeedPhrase2();
|
|
7437
|
+
const keypair = keyPairFromSeedPhrase2(seedphrase);
|
|
7438
|
+
const recoveryKey = PublicKey14.from(keypair.publicKey);
|
|
7435
7439
|
const identityKey = identity.identityKey;
|
|
7436
7440
|
const credential = await identity.getIdentityCredentialSigner().createCredential({
|
|
7437
7441
|
subject: identityKey,
|
|
7438
7442
|
assertion: {
|
|
7439
7443
|
"@type": "dxos.halo.credentials.IdentityRecovery",
|
|
7440
7444
|
recoveryKey,
|
|
7441
|
-
identityKey
|
|
7442
|
-
algorithm
|
|
7445
|
+
identityKey
|
|
7443
7446
|
}
|
|
7444
7447
|
});
|
|
7445
7448
|
const receipt = await identity.controlPipeline.writer.write({
|
|
@@ -7454,20 +7457,20 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7454
7457
|
]
|
|
7455
7458
|
]));
|
|
7456
7459
|
return {
|
|
7457
|
-
|
|
7460
|
+
seedphrase
|
|
7458
7461
|
};
|
|
7459
7462
|
}
|
|
7460
|
-
async recoverIdentity(
|
|
7463
|
+
async recoverIdentity(args) {
|
|
7461
7464
|
invariant19(this._edgeClient, "Not connected to EDGE.", {
|
|
7462
7465
|
F: __dxlog_file27,
|
|
7463
|
-
L:
|
|
7466
|
+
L: 51,
|
|
7464
7467
|
S: this,
|
|
7465
7468
|
A: [
|
|
7466
7469
|
"this._edgeClient",
|
|
7467
7470
|
"'Not connected to EDGE.'"
|
|
7468
7471
|
]
|
|
7469
7472
|
});
|
|
7470
|
-
const recoveryKeypair =
|
|
7473
|
+
const recoveryKeypair = keyPairFromSeedPhrase2(args.seedphrase);
|
|
7471
7474
|
const recoveryKey = PublicKey14.from(recoveryKeypair.publicKey);
|
|
7472
7475
|
const deviceKey = await this._keyring.createKey();
|
|
7473
7476
|
const controlFeedKey = await this._keyring.createKey();
|
|
@@ -7491,7 +7494,7 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7491
7494
|
}
|
|
7492
7495
|
log23.info("recovering identity", response, {
|
|
7493
7496
|
F: __dxlog_file27,
|
|
7494
|
-
L:
|
|
7497
|
+
L: 77,
|
|
7495
7498
|
S: this,
|
|
7496
7499
|
C: (f, a) => f(...a)
|
|
7497
7500
|
});
|
|
@@ -8231,7 +8234,7 @@ import { WebsocketRpcClient } from "@dxos/websocket-rpc";
|
|
|
8231
8234
|
|
|
8232
8235
|
// packages/sdk/client-services/src/packlets/devices/devices-service.ts
|
|
8233
8236
|
import { EventSubscriptions as EventSubscriptions3 } from "@dxos/async";
|
|
8234
|
-
import { Stream as Stream12 } from "@dxos/codec-protobuf
|
|
8237
|
+
import { Stream as Stream12 } from "@dxos/codec-protobuf";
|
|
8235
8238
|
import { invariant as invariant22 } from "@dxos/invariant";
|
|
8236
8239
|
import { Device as Device2, DeviceKind as DeviceKind2 } from "@dxos/protocols/proto/dxos/client/services";
|
|
8237
8240
|
var __dxlog_file30 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
|
|
@@ -8321,7 +8324,7 @@ var DevicesServiceImpl = class {
|
|
|
8321
8324
|
|
|
8322
8325
|
// packages/sdk/client-services/src/packlets/identity/contacts-service.ts
|
|
8323
8326
|
import { EventSubscriptions as EventSubscriptions4, scheduleTask as scheduleTask9, UpdateScheduler as UpdateScheduler2 } from "@dxos/async";
|
|
8324
|
-
import { Stream as Stream13 } from "@dxos/codec-protobuf
|
|
8327
|
+
import { Stream as Stream13 } from "@dxos/codec-protobuf";
|
|
8325
8328
|
import { PublicKey as PublicKey17 } from "@dxos/keys";
|
|
8326
8329
|
import { ComplexMap as ComplexMap5, ComplexSet as ComplexSet6 } from "@dxos/util";
|
|
8327
8330
|
var ContactsServiceImpl = class {
|
|
@@ -8404,7 +8407,7 @@ var ContactsServiceImpl = class {
|
|
|
8404
8407
|
|
|
8405
8408
|
// packages/sdk/client-services/src/packlets/logging/logging-service.ts
|
|
8406
8409
|
import { Event as Event10 } from "@dxos/async";
|
|
8407
|
-
import { Stream as Stream14 } from "@dxos/codec-protobuf
|
|
8410
|
+
import { Stream as Stream14 } from "@dxos/codec-protobuf";
|
|
8408
8411
|
import { PublicKey as PublicKey18 } from "@dxos/keys";
|
|
8409
8412
|
import { getContextFromEntry, log as log26 } from "@dxos/log";
|
|
8410
8413
|
import { QueryLogsRequest } from "@dxos/protocols/proto/dxos/client/services";
|
|
@@ -8527,7 +8530,7 @@ var shouldLog = (entry2, request) => {
|
|
|
8527
8530
|
var LOG_PROCESSING = 0;
|
|
8528
8531
|
|
|
8529
8532
|
// packages/sdk/client-services/src/packlets/network/network-service.ts
|
|
8530
|
-
import { Stream as Stream15 } from "@dxos/codec-protobuf
|
|
8533
|
+
import { Stream as Stream15 } from "@dxos/codec-protobuf";
|
|
8531
8534
|
var NetworkServiceImpl = class {
|
|
8532
8535
|
constructor(networkManager, signalManager) {
|
|
8533
8536
|
this.networkManager = networkManager;
|
|
@@ -8589,7 +8592,7 @@ var NetworkServiceImpl = class {
|
|
|
8589
8592
|
};
|
|
8590
8593
|
|
|
8591
8594
|
// packages/sdk/client-services/src/packlets/system/system-service.ts
|
|
8592
|
-
import { Stream as Stream16 } from "@dxos/codec-protobuf
|
|
8595
|
+
import { Stream as Stream16 } from "@dxos/codec-protobuf";
|
|
8593
8596
|
import { GetDiagnosticsRequest as GetDiagnosticsRequest2 } from "@dxos/protocols/proto/dxos/client/services";
|
|
8594
8597
|
import { jsonKeyReplacer as jsonKeyReplacer2 } from "@dxos/util";
|
|
8595
8598
|
var SystemServiceImpl = class {
|
|
@@ -9093,4 +9096,4 @@ export {
|
|
|
9093
9096
|
importProfileData,
|
|
9094
9097
|
ClientServicesHost
|
|
9095
9098
|
};
|
|
9096
|
-
//# sourceMappingURL=chunk-
|
|
9099
|
+
//# sourceMappingURL=chunk-443F7E4C.mjs.map
|