@dxos/client-services 0.7.5-main.9d2a38b → 0.7.5-main.e94eead
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-RFZHCLFI.mjs → chunk-5QA4IAAU.mjs} +262 -181
- package/dist/lib/browser/chunk-5QA4IAAU.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-WCTGAZLA.cjs → chunk-FQ5WZIGO.cjs} +255 -174
- package/dist/lib/node/chunk-FQ5WZIGO.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-RSOLUJE6.mjs → chunk-YAOQ7FPR.mjs} +262 -181
- package/dist/lib/node-esm/chunk-YAOQ7FPR.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-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/diagnostics/diagnostics-collector.d.ts.map +1 -1
- package/dist/types/src/packlets/diagnostics/diagnostics.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-manager.d.ts +0 -3
- package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-recovery-manager.d.ts +12 -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 +8 -3
- package/dist/types/src/packlets/identity/identity-service.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity.d.ts +3 -1
- 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/space-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/utils.d.ts +1 -0
- package/dist/types/src/packlets/invitations/utils.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +39 -38
- package/src/packlets/agents/edge-agent-manager.ts +6 -0
- package/src/packlets/diagnostics/diagnostics-collector.ts +2 -2
- package/src/packlets/diagnostics/diagnostics.ts +17 -13
- package/src/packlets/identity/identity-manager.ts +3 -29
- package/src/packlets/identity/identity-recovery-manager.ts +95 -10
- package/src/packlets/identity/identity-service.ts +16 -3
- package/src/packlets/identity/identity.test.ts +2 -1
- package/src/packlets/identity/identity.ts +4 -1
- package/src/packlets/invitations/invitations-handler.ts +15 -6
- package/src/packlets/invitations/invitations-manager.ts +1 -1
- package/src/packlets/invitations/space-invitation-protocol.ts +2 -3
- package/src/packlets/invitations/utils.ts +7 -0
- package/src/packlets/spaces/data-space-manager.ts +3 -3
- package/src/packlets/spaces/data-space.ts +2 -2
- package/src/packlets/spaces/edge-feed-replicator.ts +8 -8
- package/src/packlets/spaces/spaces-service.ts +30 -20
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-RFZHCLFI.mjs.map +0 -7
- package/dist/lib/node/chunk-WCTGAZLA.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-RSOLUJE6.mjs.map +0 -7
|
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_FQ5WZIGO_exports = {};
|
|
30
|
+
__export(chunk_FQ5WZIGO_exports, {
|
|
31
31
|
ClientRpcServer: () => ClientRpcServer,
|
|
32
32
|
ClientServicesHost: () => ClientServicesHost,
|
|
33
33
|
DataSpace: () => DataSpace,
|
|
@@ -72,7 +72,7 @@ __export(chunk_WCTGAZLA_exports, {
|
|
|
72
72
|
subscribeToSpaces: () => subscribeToSpaces,
|
|
73
73
|
subscribeToSwarmInfo: () => subscribeToSwarmInfo
|
|
74
74
|
});
|
|
75
|
-
module.exports = __toCommonJS(
|
|
75
|
+
module.exports = __toCommonJS(chunk_FQ5WZIGO_exports);
|
|
76
76
|
var import_async = require("@dxos/async");
|
|
77
77
|
var import_stream = require("@dxos/codec-protobuf/stream");
|
|
78
78
|
var import_feed_store = require("@dxos/feed-store");
|
|
@@ -735,7 +735,7 @@ var DevtoolsServiceImpl = class {
|
|
|
735
735
|
});
|
|
736
736
|
}
|
|
737
737
|
};
|
|
738
|
-
var DXOS_VERSION = "0.7.5-main.
|
|
738
|
+
var DXOS_VERSION = "0.7.5-main.e94eead";
|
|
739
739
|
var getPlatform = () => {
|
|
740
740
|
if (process.browser) {
|
|
741
741
|
if (typeof window !== "undefined") {
|
|
@@ -799,6 +799,7 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
|
799
799
|
const identity = serviceContext.identityManager.identity;
|
|
800
800
|
if (identity) {
|
|
801
801
|
diagnostics.identity = {
|
|
802
|
+
did: identity.did,
|
|
802
803
|
identityKey: identity.identityKey,
|
|
803
804
|
spaceKey: identity.space.key,
|
|
804
805
|
profile: identity.profileDocument
|
|
@@ -837,16 +838,17 @@ var getSpaceStats = async (space) => {
|
|
|
837
838
|
...credential.subject.assertion,
|
|
838
839
|
id: credential.id
|
|
839
840
|
})),
|
|
840
|
-
members: Array.from(space.inner.spaceState.members.values()).map((member) => ({
|
|
841
|
+
members: await Promise.all(Array.from(space.inner.spaceState.members.values()).map(async (member) => ({
|
|
841
842
|
role: member.role,
|
|
842
843
|
identity: {
|
|
844
|
+
did: await (0, import_credentials.createDidFromIdentityKey)(member.key),
|
|
843
845
|
identityKey: member.key,
|
|
844
846
|
profile: {
|
|
845
847
|
displayName: member.assertion.profile?.displayName
|
|
846
848
|
}
|
|
847
849
|
},
|
|
848
850
|
presence: space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key)).length > 0 ? import_services.SpaceMember.PresenceState.ONLINE : import_services.SpaceMember.PresenceState.OFFLINE
|
|
849
|
-
})),
|
|
851
|
+
}))),
|
|
850
852
|
pipeline: {
|
|
851
853
|
// TODO(burdon): Pick properties from credentials if needed.
|
|
852
854
|
currentEpoch: space.automergeSpaceState.lastEpoch,
|
|
@@ -926,7 +928,7 @@ var findSystemServiceProvider = () => {
|
|
|
926
928
|
};
|
|
927
929
|
var findConfigs = () => {
|
|
928
930
|
const configs = import_tracing2.TRACE_PROCESSOR.findResourcesByAnnotation(import_config.ConfigResource);
|
|
929
|
-
return configs.map((r) => r.instance.deref()).filter(import_util2.
|
|
931
|
+
return configs.map((r) => r.instance.deref()).filter(import_util2.isNonNullable);
|
|
930
932
|
};
|
|
931
933
|
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/authenticator.ts";
|
|
932
934
|
var Credential = import_proto.schema.getCodecForType("dxos.halo.credentials.Credential");
|
|
@@ -1211,7 +1213,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1211
1213
|
this._remoteLength.clear();
|
|
1212
1214
|
}
|
|
1213
1215
|
async addFeed(feed) {
|
|
1214
|
-
import_log3.log
|
|
1216
|
+
(0, import_log3.log)("addFeed", {
|
|
1215
1217
|
key: feed.key,
|
|
1216
1218
|
connected: this._connected,
|
|
1217
1219
|
hasConnectionCtx: !!this._connectionCtx
|
|
@@ -1248,7 +1250,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1248
1250
|
}
|
|
1249
1251
|
async _sendMessage(message) {
|
|
1250
1252
|
if (!this._connectionCtx) {
|
|
1251
|
-
import_log3.log
|
|
1253
|
+
(0, import_log3.log)("message dropped because connection was disposed", void 0, {
|
|
1252
1254
|
F: __dxlog_file5,
|
|
1253
1255
|
L: 146,
|
|
1254
1256
|
S: this,
|
|
@@ -1257,7 +1259,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1257
1259
|
return;
|
|
1258
1260
|
}
|
|
1259
1261
|
if (message.type === "data") {
|
|
1260
|
-
import_log3.log
|
|
1262
|
+
(0, import_log3.log)("sending blocks", {
|
|
1261
1263
|
feedKey: message.feedKey,
|
|
1262
1264
|
blocks: message.blocks.map((b) => b.index)
|
|
1263
1265
|
}, {
|
|
@@ -1332,7 +1334,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1332
1334
|
feedKey
|
|
1333
1335
|
};
|
|
1334
1336
|
if (message.length > feed.length) {
|
|
1335
|
-
import_log3.log
|
|
1337
|
+
(0, import_log3.log)("requesting missing blocks", logMeta, {
|
|
1336
1338
|
F: __dxlog_file5,
|
|
1337
1339
|
L: 194,
|
|
1338
1340
|
S: this,
|
|
@@ -1347,7 +1349,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1347
1349
|
}
|
|
1348
1350
|
});
|
|
1349
1351
|
} else if (message.length < feed.length) {
|
|
1350
|
-
import_log3.log
|
|
1352
|
+
(0, import_log3.log)("pushing blocks to remote", logMeta, {
|
|
1351
1353
|
F: __dxlog_file5,
|
|
1352
1354
|
L: 202,
|
|
1353
1355
|
S: this,
|
|
@@ -1363,7 +1365,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1363
1365
|
}
|
|
1364
1366
|
}
|
|
1365
1367
|
case "data": {
|
|
1366
|
-
import_log3.log
|
|
1368
|
+
(0, import_log3.log)("received data", {
|
|
1367
1369
|
feed: message.feedKey,
|
|
1368
1370
|
blocks: message.blocks.map((b) => b.index)
|
|
1369
1371
|
}, {
|
|
@@ -1402,7 +1404,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1402
1404
|
});
|
|
1403
1405
|
}
|
|
1404
1406
|
async _pushBlocks(feed, from, to) {
|
|
1405
|
-
import_log3.log
|
|
1407
|
+
(0, import_log3.log)("pushing blocks", {
|
|
1406
1408
|
feed: feed.key.toHex(),
|
|
1407
1409
|
from,
|
|
1408
1410
|
to
|
|
@@ -1441,7 +1443,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1441
1443
|
this._remoteLength.set(feed.key, to);
|
|
1442
1444
|
}
|
|
1443
1445
|
async _integrateBlocks(feed, blocks) {
|
|
1444
|
-
import_log3.log
|
|
1446
|
+
(0, import_log3.log)("integrating blocks", {
|
|
1445
1447
|
feed: feed.key.toHex(),
|
|
1446
1448
|
blocks: blocks.length
|
|
1447
1449
|
}, {
|
|
@@ -2664,7 +2666,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2664
2666
|
});
|
|
2665
2667
|
dataSpace.postOpen.append(async () => {
|
|
2666
2668
|
const setting = dataSpace.getEdgeReplicationSetting();
|
|
2667
|
-
if (setting === import_metadata.EdgeReplicationSetting.ENABLED) {
|
|
2669
|
+
if (!setting || setting === import_metadata.EdgeReplicationSetting.ENABLED) {
|
|
2668
2670
|
await this._echoEdgeReplicator?.connectToSpace(dataSpace.id);
|
|
2669
2671
|
} else if (this._echoEdgeReplicator) {
|
|
2670
2672
|
(0, import_log8.log)("not connecting EchoEdgeReplicator because of EdgeReplicationSetting", {
|
|
@@ -2679,7 +2681,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2679
2681
|
});
|
|
2680
2682
|
dataSpace.preClose.append(async () => {
|
|
2681
2683
|
const setting = dataSpace.getEdgeReplicationSetting();
|
|
2682
|
-
if (setting === import_metadata.EdgeReplicationSetting.ENABLED) {
|
|
2684
|
+
if (!setting || setting === import_metadata.EdgeReplicationSetting.ENABLED) {
|
|
2683
2685
|
await this._echoEdgeReplicator?.disconnectFromSpace(dataSpace.id);
|
|
2684
2686
|
}
|
|
2685
2687
|
});
|
|
@@ -2784,7 +2786,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2784
2786
|
guestKeypair: invitation.guestKey ? {
|
|
2785
2787
|
publicKey: invitation.guestKey
|
|
2786
2788
|
} : void 0,
|
|
2787
|
-
lifetime: invitation.expiresOn ? invitation.expiresOn.getTime() - Date.now() : void 0,
|
|
2789
|
+
lifetime: invitation.expiresOn ? (invitation.expiresOn.getTime() - Date.now()) / 1e3 : void 0,
|
|
2788
2790
|
multiUse: invitation.multiUse,
|
|
2789
2791
|
delegationCredentialId: credentialId,
|
|
2790
2792
|
persistent: false
|
|
@@ -2856,7 +2858,7 @@ var SpacesServiceImpl = class {
|
|
|
2856
2858
|
const credentials = await (0, import_credentials13.createAdmissionCredentials)(identity.getIdentityCredentialSigner(), request.memberKey, space.key, space.genesisFeedKey, request.newRole, space.spaceState.membershipChainHeads);
|
|
2857
2859
|
(0, import_invariant8.invariant)(credentials[0].credential, void 0, {
|
|
2858
2860
|
F: __dxlog_file10,
|
|
2859
|
-
L:
|
|
2861
|
+
L: 111,
|
|
2860
2862
|
S: this,
|
|
2861
2863
|
A: [
|
|
2862
2864
|
"credentials[0].credential",
|
|
@@ -2866,7 +2868,7 @@ var SpacesServiceImpl = class {
|
|
|
2866
2868
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
2867
2869
|
(0, import_invariant8.invariant)((0, import_credentials13.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
2868
2870
|
F: __dxlog_file10,
|
|
2869
|
-
L:
|
|
2871
|
+
L: 113,
|
|
2870
2872
|
S: this,
|
|
2871
2873
|
A: [
|
|
2872
2874
|
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -2879,12 +2881,12 @@ var SpacesServiceImpl = class {
|
|
|
2879
2881
|
return new import_stream7.Stream(({ next, ctx }) => {
|
|
2880
2882
|
const scheduler = new import_async12.UpdateScheduler(ctx, async () => {
|
|
2881
2883
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
2882
|
-
const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space));
|
|
2884
|
+
const spaces = await Promise.all(Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space)));
|
|
2883
2885
|
(0, import_log9.log)("update", () => ({
|
|
2884
2886
|
ids: spaces.map((space) => space.id)
|
|
2885
2887
|
}), {
|
|
2886
2888
|
F: __dxlog_file10,
|
|
2887
|
-
L:
|
|
2889
|
+
L: 126,
|
|
2888
2890
|
S: this,
|
|
2889
2891
|
C: (f, a) => f(...a)
|
|
2890
2892
|
});
|
|
@@ -2976,7 +2978,7 @@ var SpacesServiceImpl = class {
|
|
|
2976
2978
|
} else {
|
|
2977
2979
|
(0, import_invariant8.invariant)(!credential.id, "Id on unsigned credentials is not allowed", {
|
|
2978
2980
|
F: __dxlog_file10,
|
|
2979
|
-
L:
|
|
2981
|
+
L: 224,
|
|
2980
2982
|
S: this,
|
|
2981
2983
|
A: [
|
|
2982
2984
|
"!credential.id",
|
|
@@ -2985,7 +2987,7 @@ var SpacesServiceImpl = class {
|
|
|
2985
2987
|
});
|
|
2986
2988
|
(0, import_invariant8.invariant)(this._identityManager.identity, "Identity is not available", {
|
|
2987
2989
|
F: __dxlog_file10,
|
|
2988
|
-
L:
|
|
2990
|
+
L: 225,
|
|
2989
2991
|
S: this,
|
|
2990
2992
|
A: [
|
|
2991
2993
|
"this._identityManager.identity",
|
|
@@ -2995,7 +2997,7 @@ var SpacesServiceImpl = class {
|
|
|
2995
2997
|
const signer = this._identityManager.identity.getIdentityCredentialSigner();
|
|
2996
2998
|
(0, import_invariant8.invariant)(credential.issuer.equals(signer.getIssuer()), void 0, {
|
|
2997
2999
|
F: __dxlog_file10,
|
|
2998
|
-
L:
|
|
3000
|
+
L: 227,
|
|
2999
3001
|
S: this,
|
|
3000
3002
|
A: [
|
|
3001
3003
|
"credential.issuer.equals(signer.getIssuer())",
|
|
@@ -3045,7 +3047,7 @@ var SpacesServiceImpl = class {
|
|
|
3045
3047
|
const assertion = (0, import_credentials13.getCredentialAssertion)(credential);
|
|
3046
3048
|
(0, import_invariant8.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
3047
3049
|
F: __dxlog_file10,
|
|
3048
|
-
L:
|
|
3050
|
+
L: 261,
|
|
3049
3051
|
S: this,
|
|
3050
3052
|
A: [
|
|
3051
3053
|
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -3055,7 +3057,7 @@ var SpacesServiceImpl = class {
|
|
|
3055
3057
|
const myIdentity = this._identityManager.identity;
|
|
3056
3058
|
(0, import_invariant8.invariant)(myIdentity && credential.subject.id.equals(myIdentity.identityKey), void 0, {
|
|
3057
3059
|
F: __dxlog_file10,
|
|
3058
|
-
L:
|
|
3060
|
+
L: 263,
|
|
3059
3061
|
S: this,
|
|
3060
3062
|
A: [
|
|
3061
3063
|
"myIdentity && credential.subject.id.equals(myIdentity.identityKey)",
|
|
@@ -3076,10 +3078,10 @@ var SpacesServiceImpl = class {
|
|
|
3076
3078
|
});
|
|
3077
3079
|
}
|
|
3078
3080
|
return {
|
|
3079
|
-
space: this._serializeSpace(dataSpace)
|
|
3081
|
+
space: await this._serializeSpace(dataSpace)
|
|
3080
3082
|
};
|
|
3081
3083
|
}
|
|
3082
|
-
_serializeSpace(space) {
|
|
3084
|
+
async _serializeSpace(space) {
|
|
3083
3085
|
return {
|
|
3084
3086
|
id: space.id,
|
|
3085
3087
|
spaceKey: space.key,
|
|
@@ -3099,7 +3101,7 @@ var SpacesServiceImpl = class {
|
|
|
3099
3101
|
totalDataTimeframe: void 0,
|
|
3100
3102
|
spaceRootUrl: space.databaseRoot?.url
|
|
3101
3103
|
},
|
|
3102
|
-
members: Array.from(space.inner.spaceState.members.values()).map((member) => {
|
|
3104
|
+
members: await Promise.all(Array.from(space.inner.spaceState.members.values()).map(async (member) => {
|
|
3103
3105
|
const peers = space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key));
|
|
3104
3106
|
const isMe = this._identityManager.identity?.identityKey.equals(member.key);
|
|
3105
3107
|
if (isMe) {
|
|
@@ -3107,6 +3109,7 @@ var SpacesServiceImpl = class {
|
|
|
3107
3109
|
}
|
|
3108
3110
|
return {
|
|
3109
3111
|
identity: {
|
|
3112
|
+
did: await (0, import_credentials13.createDidFromIdentityKey)(member.key),
|
|
3110
3113
|
identityKey: member.key,
|
|
3111
3114
|
profile: member.profile ?? {}
|
|
3112
3115
|
},
|
|
@@ -3114,7 +3117,7 @@ var SpacesServiceImpl = class {
|
|
|
3114
3117
|
presence: peers.length > 0 ? import_services7.SpaceMember.PresenceState.ONLINE : import_services7.SpaceMember.PresenceState.OFFLINE,
|
|
3115
3118
|
peerStates: peers
|
|
3116
3119
|
};
|
|
3117
|
-
}),
|
|
3120
|
+
})),
|
|
3118
3121
|
creator: space.inner.spaceState.creator?.key,
|
|
3119
3122
|
cache: space.cache,
|
|
3120
3123
|
metrics: space.metrics,
|
|
@@ -3157,13 +3160,14 @@ var Identity = class {
|
|
|
3157
3160
|
this.space = params.space;
|
|
3158
3161
|
this._signer = params.signer;
|
|
3159
3162
|
this._presence = params.presence;
|
|
3163
|
+
this.did = params.did;
|
|
3160
3164
|
this.identityKey = params.identityKey;
|
|
3161
3165
|
this.deviceKey = params.deviceKey;
|
|
3162
3166
|
import_log6.log.trace("dxos.halo.device", {
|
|
3163
3167
|
deviceKey: params.deviceKey
|
|
3164
3168
|
}, {
|
|
3165
3169
|
F: __dxlog_file11,
|
|
3166
|
-
L:
|
|
3170
|
+
L: 82,
|
|
3167
3171
|
S: this,
|
|
3168
3172
|
C: (f, a) => f(...a)
|
|
3169
3173
|
});
|
|
@@ -3265,7 +3269,7 @@ var Identity = class {
|
|
|
3265
3269
|
getIdentityCredentialSigner() {
|
|
3266
3270
|
(0, import_invariant6.invariant)(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.", {
|
|
3267
3271
|
F: __dxlog_file11,
|
|
3268
|
-
L:
|
|
3272
|
+
L: 198,
|
|
3269
3273
|
S: this,
|
|
3270
3274
|
A: [
|
|
3271
3275
|
"this._deviceStateMachine.deviceCredentialChain",
|
|
@@ -3309,7 +3313,7 @@ var Identity = class {
|
|
|
3309
3313
|
dataFeedKey
|
|
3310
3314
|
}, {
|
|
3311
3315
|
F: __dxlog_file11,
|
|
3312
|
-
L:
|
|
3316
|
+
L: 223,
|
|
3313
3317
|
S: this,
|
|
3314
3318
|
C: (f, a) => f(...a)
|
|
3315
3319
|
});
|
|
@@ -3392,7 +3396,7 @@ var IdentityManager = class {
|
|
|
3392
3396
|
id: traceId
|
|
3393
3397
|
}), {
|
|
3394
3398
|
F: __dxlog_file12,
|
|
3395
|
-
L:
|
|
3399
|
+
L: 116,
|
|
3396
3400
|
S: this,
|
|
3397
3401
|
C: (f, a) => f(...a)
|
|
3398
3402
|
});
|
|
@@ -3401,7 +3405,7 @@ var IdentityManager = class {
|
|
|
3401
3405
|
identityRecord
|
|
3402
3406
|
}, {
|
|
3403
3407
|
F: __dxlog_file12,
|
|
3404
|
-
L:
|
|
3408
|
+
L: 119,
|
|
3405
3409
|
S: this,
|
|
3406
3410
|
C: (f, a) => f(...a)
|
|
3407
3411
|
});
|
|
@@ -3414,7 +3418,7 @@ var IdentityManager = class {
|
|
|
3414
3418
|
displayName: this._identity.profileDocument?.displayName
|
|
3415
3419
|
}, {
|
|
3416
3420
|
F: __dxlog_file12,
|
|
3417
|
-
L:
|
|
3421
|
+
L: 124,
|
|
3418
3422
|
S: this,
|
|
3419
3423
|
C: (f, a) => f(...a)
|
|
3420
3424
|
});
|
|
@@ -3424,7 +3428,7 @@ var IdentityManager = class {
|
|
|
3424
3428
|
id: traceId
|
|
3425
3429
|
}), {
|
|
3426
3430
|
F: __dxlog_file12,
|
|
3427
|
-
L:
|
|
3431
|
+
L: 131,
|
|
3428
3432
|
S: this,
|
|
3429
3433
|
C: (f, a) => f(...a)
|
|
3430
3434
|
});
|
|
@@ -3432,13 +3436,13 @@ var IdentityManager = class {
|
|
|
3432
3436
|
async close() {
|
|
3433
3437
|
await this._identity?.close(new import_context8.Context(void 0, {
|
|
3434
3438
|
F: __dxlog_file12,
|
|
3435
|
-
L:
|
|
3439
|
+
L: 135
|
|
3436
3440
|
}));
|
|
3437
3441
|
}
|
|
3438
3442
|
async createIdentity({ displayName, deviceProfile } = {}) {
|
|
3439
3443
|
(0, import_invariant9.invariant)(!this._identity, "Identity already exists.", {
|
|
3440
3444
|
F: __dxlog_file12,
|
|
3441
|
-
L:
|
|
3445
|
+
L: 140,
|
|
3442
3446
|
S: this,
|
|
3443
3447
|
A: [
|
|
3444
3448
|
"!this._identity",
|
|
@@ -3447,7 +3451,7 @@ var IdentityManager = class {
|
|
|
3447
3451
|
});
|
|
3448
3452
|
(0, import_log10.log)("creating identity...", void 0, {
|
|
3449
3453
|
F: __dxlog_file12,
|
|
3450
|
-
L:
|
|
3454
|
+
L: 141,
|
|
3451
3455
|
S: this,
|
|
3452
3456
|
C: (f, a) => f(...a)
|
|
3453
3457
|
});
|
|
@@ -3465,13 +3469,13 @@ var IdentityManager = class {
|
|
|
3465
3469
|
const identity = await this._constructIdentity(identityRecord);
|
|
3466
3470
|
await identity.open(new import_context8.Context(void 0, {
|
|
3467
3471
|
F: __dxlog_file12,
|
|
3468
|
-
L:
|
|
3472
|
+
L: 156
|
|
3469
3473
|
}));
|
|
3470
3474
|
{
|
|
3471
3475
|
const generator = new import_credentials14.CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
|
|
3472
3476
|
(0, import_invariant9.invariant)(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.", {
|
|
3473
3477
|
F: __dxlog_file12,
|
|
3474
|
-
L:
|
|
3478
|
+
L: 160,
|
|
3475
3479
|
S: this,
|
|
3476
3480
|
A: [
|
|
3477
3481
|
"identityRecord.haloSpace.genesisFeedKey",
|
|
@@ -3480,7 +3484,7 @@ var IdentityManager = class {
|
|
|
3480
3484
|
});
|
|
3481
3485
|
(0, import_invariant9.invariant)(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.", {
|
|
3482
3486
|
F: __dxlog_file12,
|
|
3483
|
-
L:
|
|
3487
|
+
L: 161,
|
|
3484
3488
|
S: this,
|
|
3485
3489
|
A: [
|
|
3486
3490
|
"identityRecord.haloSpace.dataFeedKey",
|
|
@@ -3519,7 +3523,7 @@ var IdentityManager = class {
|
|
|
3519
3523
|
displayName: this._identity.profileDocument?.displayName
|
|
3520
3524
|
}, {
|
|
3521
3525
|
F: __dxlog_file12,
|
|
3522
|
-
L:
|
|
3526
|
+
L: 199,
|
|
3523
3527
|
S: this,
|
|
3524
3528
|
C: (f, a) => f(...a)
|
|
3525
3529
|
});
|
|
@@ -3530,7 +3534,7 @@ var IdentityManager = class {
|
|
|
3530
3534
|
profile: identity.profileDocument
|
|
3531
3535
|
}, {
|
|
3532
3536
|
F: __dxlog_file12,
|
|
3533
|
-
L:
|
|
3537
|
+
L: 205,
|
|
3534
3538
|
S: this,
|
|
3535
3539
|
C: (f, a) => f(...a)
|
|
3536
3540
|
});
|
|
@@ -3567,13 +3571,13 @@ var IdentityManager = class {
|
|
|
3567
3571
|
params
|
|
3568
3572
|
}, {
|
|
3569
3573
|
F: __dxlog_file12,
|
|
3570
|
-
L:
|
|
3574
|
+
L: 244,
|
|
3571
3575
|
S: this,
|
|
3572
3576
|
C: (f, a) => f(...a)
|
|
3573
3577
|
});
|
|
3574
3578
|
(0, import_invariant9.invariant)(!this._identity, "Identity already exists.", {
|
|
3575
3579
|
F: __dxlog_file12,
|
|
3576
|
-
L:
|
|
3580
|
+
L: 245,
|
|
3577
3581
|
S: this,
|
|
3578
3582
|
A: [
|
|
3579
3583
|
"!this._identity",
|
|
@@ -3594,7 +3598,7 @@ var IdentityManager = class {
|
|
|
3594
3598
|
const identity = await this._constructIdentity(identityRecord);
|
|
3595
3599
|
await identity.open(new import_context8.Context(void 0, {
|
|
3596
3600
|
F: __dxlog_file12,
|
|
3597
|
-
L:
|
|
3601
|
+
L: 259
|
|
3598
3602
|
}));
|
|
3599
3603
|
return {
|
|
3600
3604
|
identity,
|
|
@@ -3613,7 +3617,7 @@ var IdentityManager = class {
|
|
|
3613
3617
|
displayName: this._identity.profileDocument?.displayName
|
|
3614
3618
|
}, {
|
|
3615
3619
|
F: __dxlog_file12,
|
|
3616
|
-
L:
|
|
3620
|
+
L: 273,
|
|
3617
3621
|
S: this,
|
|
3618
3622
|
C: (f, a) => f(...a)
|
|
3619
3623
|
});
|
|
@@ -3627,7 +3631,7 @@ var IdentityManager = class {
|
|
|
3627
3631
|
deviceKey: identity.deviceKey
|
|
3628
3632
|
}, {
|
|
3629
3633
|
F: __dxlog_file12,
|
|
3630
|
-
L:
|
|
3634
|
+
L: 284,
|
|
3631
3635
|
S: this,
|
|
3632
3636
|
C: (f, a) => f(...a)
|
|
3633
3637
|
});
|
|
@@ -3638,7 +3642,7 @@ var IdentityManager = class {
|
|
|
3638
3642
|
async updateProfile(profile) {
|
|
3639
3643
|
(0, import_invariant9.invariant)(this._identity, "Identity not initialized.", {
|
|
3640
3644
|
F: __dxlog_file12,
|
|
3641
|
-
L:
|
|
3645
|
+
L: 291,
|
|
3642
3646
|
S: this,
|
|
3643
3647
|
A: [
|
|
3644
3648
|
"this._identity",
|
|
@@ -3669,7 +3673,7 @@ var IdentityManager = class {
|
|
|
3669
3673
|
async updateDeviceProfile(profile) {
|
|
3670
3674
|
(0, import_invariant9.invariant)(this._identity, "Identity not initialized.", {
|
|
3671
3675
|
F: __dxlog_file12,
|
|
3672
|
-
L:
|
|
3676
|
+
L: 308,
|
|
3673
3677
|
S: this,
|
|
3674
3678
|
A: [
|
|
3675
3679
|
"this._identity",
|
|
@@ -3702,48 +3706,10 @@ var IdentityManager = class {
|
|
|
3702
3706
|
profile
|
|
3703
3707
|
};
|
|
3704
3708
|
}
|
|
3705
|
-
async createRecoveryPhrase() {
|
|
3706
|
-
const identity = this._identity;
|
|
3707
|
-
(0, import_invariant9.invariant)(identity, void 0, {
|
|
3708
|
-
F: __dxlog_file12,
|
|
3709
|
-
L: 340,
|
|
3710
|
-
S: this,
|
|
3711
|
-
A: [
|
|
3712
|
-
"identity",
|
|
3713
|
-
""
|
|
3714
|
-
]
|
|
3715
|
-
});
|
|
3716
|
-
const seedphrase = (0, import_credentials14.generateSeedPhrase)();
|
|
3717
|
-
const keypair = (0, import_credentials14.keyPairFromSeedPhrase)(seedphrase);
|
|
3718
|
-
const recoveryKey = import_keys9.PublicKey.from(keypair.publicKey);
|
|
3719
|
-
const identityKey = identity.identityKey;
|
|
3720
|
-
const credential = await identity.getIdentityCredentialSigner().createCredential({
|
|
3721
|
-
subject: identityKey,
|
|
3722
|
-
assertion: {
|
|
3723
|
-
"@type": "dxos.halo.credentials.IdentityRecovery",
|
|
3724
|
-
recoveryKey,
|
|
3725
|
-
identityKey
|
|
3726
|
-
}
|
|
3727
|
-
});
|
|
3728
|
-
const receipt = await identity.controlPipeline.writer.write({
|
|
3729
|
-
credential: {
|
|
3730
|
-
credential
|
|
3731
|
-
}
|
|
3732
|
-
});
|
|
3733
|
-
await identity.controlPipeline.state.waitUntilTimeframe(new import_timeframe4.Timeframe([
|
|
3734
|
-
[
|
|
3735
|
-
receipt.feedKey,
|
|
3736
|
-
receipt.seq
|
|
3737
|
-
]
|
|
3738
|
-
]));
|
|
3739
|
-
return {
|
|
3740
|
-
seedphrase
|
|
3741
|
-
};
|
|
3742
|
-
}
|
|
3743
3709
|
async _constructIdentity(identityRecord) {
|
|
3744
3710
|
(0, import_invariant9.invariant)(!this._identity, void 0, {
|
|
3745
3711
|
F: __dxlog_file12,
|
|
3746
|
-
L:
|
|
3712
|
+
L: 334,
|
|
3747
3713
|
S: this,
|
|
3748
3714
|
A: [
|
|
3749
3715
|
"!this._identity",
|
|
@@ -3754,7 +3720,7 @@ var IdentityManager = class {
|
|
|
3754
3720
|
identityRecord
|
|
3755
3721
|
}, {
|
|
3756
3722
|
F: __dxlog_file12,
|
|
3757
|
-
L:
|
|
3723
|
+
L: 335,
|
|
3758
3724
|
S: this,
|
|
3759
3725
|
C: (f, a) => f(...a)
|
|
3760
3726
|
});
|
|
@@ -3769,7 +3735,7 @@ var IdentityManager = class {
|
|
|
3769
3735
|
});
|
|
3770
3736
|
(0, import_invariant9.invariant)(identityRecord.haloSpace.controlFeedKey, void 0, {
|
|
3771
3737
|
F: __dxlog_file12,
|
|
3772
|
-
L:
|
|
3738
|
+
L: 348,
|
|
3773
3739
|
S: this,
|
|
3774
3740
|
A: [
|
|
3775
3741
|
"identityRecord.haloSpace.controlFeedKey",
|
|
@@ -3781,7 +3747,7 @@ var IdentityManager = class {
|
|
|
3781
3747
|
});
|
|
3782
3748
|
(0, import_invariant9.invariant)(identityRecord.haloSpace.dataFeedKey, void 0, {
|
|
3783
3749
|
F: __dxlog_file12,
|
|
3784
|
-
L:
|
|
3750
|
+
L: 352,
|
|
3785
3751
|
S: this,
|
|
3786
3752
|
A: [
|
|
3787
3753
|
"identityRecord.haloSpace.dataFeedKey",
|
|
@@ -3805,10 +3771,12 @@ var IdentityManager = class {
|
|
|
3805
3771
|
});
|
|
3806
3772
|
await space.setControlFeed(controlFeed);
|
|
3807
3773
|
await space.setDataFeed(dataFeed);
|
|
3774
|
+
const did = await (0, import_credentials14.createDidFromIdentityKey)(identityRecord.identityKey);
|
|
3808
3775
|
const identity = new Identity({
|
|
3809
3776
|
space,
|
|
3810
3777
|
presence,
|
|
3811
3778
|
signer: this._keyring,
|
|
3779
|
+
did,
|
|
3812
3780
|
identityKey: identityRecord.identityKey,
|
|
3813
3781
|
deviceKey: identityRecord.deviceKey,
|
|
3814
3782
|
edgeConnection: this._edgeConnection,
|
|
@@ -3818,7 +3786,7 @@ var IdentityManager = class {
|
|
|
3818
3786
|
identityKey: identityRecord.identityKey
|
|
3819
3787
|
}, {
|
|
3820
3788
|
F: __dxlog_file12,
|
|
3821
|
-
L:
|
|
3789
|
+
L: 383,
|
|
3822
3790
|
S: this,
|
|
3823
3791
|
C: (f, a) => f(...a)
|
|
3824
3792
|
});
|
|
@@ -3843,7 +3811,7 @@ var IdentityManager = class {
|
|
|
3843
3811
|
onAuthFailure: () => {
|
|
3844
3812
|
import_log10.log.warn("auth failure", void 0, {
|
|
3845
3813
|
F: __dxlog_file12,
|
|
3846
|
-
L:
|
|
3814
|
+
L: 408,
|
|
3847
3815
|
S: this,
|
|
3848
3816
|
C: (f, a) => f(...a)
|
|
3849
3817
|
});
|
|
@@ -3896,7 +3864,7 @@ var IdentityServiceImpl = class extends import_context9.Resource {
|
|
|
3896
3864
|
const identity = this._identityManager.identity;
|
|
3897
3865
|
(0, import_invariant10.invariant)(identity, void 0, {
|
|
3898
3866
|
F: __dxlog_file13,
|
|
3899
|
-
L:
|
|
3867
|
+
L: 61,
|
|
3900
3868
|
S: this,
|
|
3901
3869
|
A: [
|
|
3902
3870
|
"identity",
|
|
@@ -3919,6 +3887,7 @@ var IdentityServiceImpl = class extends import_context9.Resource {
|
|
|
3919
3887
|
return void 0;
|
|
3920
3888
|
}
|
|
3921
3889
|
return {
|
|
3890
|
+
did: this._identityManager.identity.did,
|
|
3922
3891
|
identityKey: this._identityManager.identity.identityKey,
|
|
3923
3892
|
spaceKey: this._identityManager.identity.space.key,
|
|
3924
3893
|
profile: this._identityManager.identity.profileDocument
|
|
@@ -3927,7 +3896,7 @@ var IdentityServiceImpl = class extends import_context9.Resource {
|
|
|
3927
3896
|
async updateProfile(profile) {
|
|
3928
3897
|
(0, import_invariant10.invariant)(this._identityManager.identity, "Identity not initialized.", {
|
|
3929
3898
|
F: __dxlog_file13,
|
|
3930
|
-
L:
|
|
3899
|
+
L: 88,
|
|
3931
3900
|
S: this,
|
|
3932
3901
|
A: [
|
|
3933
3902
|
"this._identityManager.identity",
|
|
@@ -3938,18 +3907,29 @@ var IdentityServiceImpl = class extends import_context9.Resource {
|
|
|
3938
3907
|
await this._onProfileUpdate?.(this._identityManager.identity.profileDocument);
|
|
3939
3908
|
return this._getIdentity();
|
|
3940
3909
|
}
|
|
3941
|
-
async
|
|
3942
|
-
return this._recoveryManager.
|
|
3910
|
+
async createRecoveryCredential(request) {
|
|
3911
|
+
return this._recoveryManager.createRecoveryCredential(request);
|
|
3912
|
+
}
|
|
3913
|
+
async requestRecoveryChallenge() {
|
|
3914
|
+
return this._recoveryManager.requestRecoveryChallenge();
|
|
3943
3915
|
}
|
|
3944
3916
|
async recoverIdentity(request) {
|
|
3945
|
-
|
|
3917
|
+
if (request.recoveryCode) {
|
|
3918
|
+
await this._recoveryManager.recoverIdentity({
|
|
3919
|
+
recoveryCode: request.recoveryCode
|
|
3920
|
+
});
|
|
3921
|
+
} else if (request.external) {
|
|
3922
|
+
await this._recoveryManager.recoverIdentityWithExternalSignature(request.external);
|
|
3923
|
+
} else {
|
|
3924
|
+
throw new Error("Invalid request.");
|
|
3925
|
+
}
|
|
3946
3926
|
return this._getIdentity();
|
|
3947
3927
|
}
|
|
3948
3928
|
// TODO(burdon): Rename createPresentation?
|
|
3949
3929
|
async signPresentation({ presentation, nonce }) {
|
|
3950
3930
|
(0, import_invariant10.invariant)(this._identityManager.identity, "Identity not initialized.", {
|
|
3951
3931
|
F: __dxlog_file13,
|
|
3952
|
-
L:
|
|
3932
|
+
L: 116,
|
|
3953
3933
|
S: this,
|
|
3954
3934
|
A: [
|
|
3955
3935
|
"this._identityManager.identity",
|
|
@@ -3968,7 +3948,7 @@ var IdentityServiceImpl = class extends import_context9.Resource {
|
|
|
3968
3948
|
const identity = this._identityManager.identity;
|
|
3969
3949
|
(0, import_invariant10.invariant)(identity, "Identity not initialized.", {
|
|
3970
3950
|
F: __dxlog_file13,
|
|
3971
|
-
L:
|
|
3951
|
+
L: 130,
|
|
3972
3952
|
S: this,
|
|
3973
3953
|
A: [
|
|
3974
3954
|
"identity",
|
|
@@ -4006,7 +3986,7 @@ var IdentityServiceImpl = class extends import_context9.Resource {
|
|
|
4006
3986
|
duplicate: space.id
|
|
4007
3987
|
}, {
|
|
4008
3988
|
F: __dxlog_file13,
|
|
4009
|
-
L:
|
|
3989
|
+
L: 164,
|
|
4010
3990
|
S: this,
|
|
4011
3991
|
C: (f, a) => f(...a)
|
|
4012
3992
|
});
|
|
@@ -4020,7 +4000,7 @@ var IdentityServiceImpl = class extends import_context9.Resource {
|
|
|
4020
4000
|
}, (err) => {
|
|
4021
4001
|
import_log11.log.catch(err, void 0, {
|
|
4022
4002
|
F: __dxlog_file13,
|
|
4023
|
-
L:
|
|
4003
|
+
L: 175,
|
|
4024
4004
|
S: this,
|
|
4025
4005
|
C: (f, a) => f(...a)
|
|
4026
4006
|
});
|
|
@@ -4789,6 +4769,12 @@ var DeviceInvitationProtocol = class {
|
|
|
4789
4769
|
var stateToString = (state) => {
|
|
4790
4770
|
return Object.entries(import_services13.Invitation.State).find(([key, val]) => val === state)?.[0] ?? "unknown";
|
|
4791
4771
|
};
|
|
4772
|
+
var computeExpirationTime = (invitation) => {
|
|
4773
|
+
if (!invitation.lifetime) {
|
|
4774
|
+
return;
|
|
4775
|
+
}
|
|
4776
|
+
return new Date((invitation.created?.getTime() ?? Date.now()) + invitation.lifetime * 1e3);
|
|
4777
|
+
};
|
|
4792
4778
|
var tryAcquireBeforeContextDisposed = async (ctx, mutex) => {
|
|
4793
4779
|
let guard;
|
|
4794
4780
|
return (0, import_context11.cancelWithContext)(ctx, (async () => {
|
|
@@ -5765,18 +5751,19 @@ var InvitationsHandler = class {
|
|
|
5765
5751
|
});
|
|
5766
5752
|
return extension;
|
|
5767
5753
|
};
|
|
5768
|
-
|
|
5769
|
-
|
|
5754
|
+
const expiresOn = (0, import_client_protocol5.getExpirationTime)(invitation);
|
|
5755
|
+
if (expiresOn) {
|
|
5756
|
+
if (expiresOn.getTime() < Date.now()) {
|
|
5770
5757
|
import_log12.log.warn("invitation has already expired", void 0, {
|
|
5771
5758
|
F: __dxlog_file21,
|
|
5772
|
-
L:
|
|
5759
|
+
L: 194,
|
|
5773
5760
|
S: this,
|
|
5774
5761
|
C: (f, a) => f(...a)
|
|
5775
5762
|
});
|
|
5776
5763
|
guardedState.set(null, import_services11.Invitation.State.EXPIRED);
|
|
5777
5764
|
void ctx.dispose().catch((err) => import_log12.log.catch(err, void 0, {
|
|
5778
5765
|
F: __dxlog_file21,
|
|
5779
|
-
L:
|
|
5766
|
+
L: 196,
|
|
5780
5767
|
S: this,
|
|
5781
5768
|
C: (f, a) => f(...a)
|
|
5782
5769
|
}));
|
|
@@ -5787,7 +5774,7 @@ var InvitationsHandler = class {
|
|
|
5787
5774
|
guardedState.set(null, import_services11.Invitation.State.EXPIRED);
|
|
5788
5775
|
metrics.increment("dxos.invitation.expired");
|
|
5789
5776
|
await ctx.dispose();
|
|
5790
|
-
},
|
|
5777
|
+
}, expiresOn.getTime() - Date.now());
|
|
5791
5778
|
}
|
|
5792
5779
|
let swarmConnection;
|
|
5793
5780
|
(0, import_async15.scheduleTask)(ctx, async () => {
|
|
@@ -5803,7 +5790,7 @@ var InvitationsHandler = class {
|
|
|
5803
5790
|
type: invitation.type
|
|
5804
5791
|
}, {
|
|
5805
5792
|
F: __dxlog_file21,
|
|
5806
|
-
L:
|
|
5793
|
+
L: 227,
|
|
5807
5794
|
S: this,
|
|
5808
5795
|
C: (f, a) => f(...a)
|
|
5809
5796
|
});
|
|
@@ -5811,7 +5798,7 @@ var InvitationsHandler = class {
|
|
|
5811
5798
|
if (deviceProfile) {
|
|
5812
5799
|
(0, import_invariant12.invariant)(invitation.kind === import_services11.Invitation.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
|
|
5813
5800
|
F: __dxlog_file21,
|
|
5814
|
-
L:
|
|
5801
|
+
L: 236,
|
|
5815
5802
|
S: this,
|
|
5816
5803
|
A: [
|
|
5817
5804
|
"invitation.kind === Invitation.Kind.DEVICE",
|
|
@@ -5829,7 +5816,7 @@ var InvitationsHandler = class {
|
|
|
5829
5816
|
triedPeers: triedPeersIds.size
|
|
5830
5817
|
}, {
|
|
5831
5818
|
F: __dxlog_file21,
|
|
5832
|
-
L:
|
|
5819
|
+
L: 244,
|
|
5833
5820
|
S: this,
|
|
5834
5821
|
C: (f, a) => f(...a)
|
|
5835
5822
|
});
|
|
@@ -5856,7 +5843,7 @@ var InvitationsHandler = class {
|
|
|
5856
5843
|
currentState: guardedState.current.state
|
|
5857
5844
|
}, {
|
|
5858
5845
|
F: __dxlog_file21,
|
|
5859
|
-
L:
|
|
5846
|
+
L: 272,
|
|
5860
5847
|
S: this,
|
|
5861
5848
|
C: (f, a) => f(...a)
|
|
5862
5849
|
});
|
|
@@ -5874,7 +5861,7 @@ var InvitationsHandler = class {
|
|
|
5874
5861
|
id: traceId
|
|
5875
5862
|
}), {
|
|
5876
5863
|
F: __dxlog_file21,
|
|
5877
|
-
L:
|
|
5864
|
+
L: 284,
|
|
5878
5865
|
S: this,
|
|
5879
5866
|
C: (f, a) => f(...a)
|
|
5880
5867
|
});
|
|
@@ -5886,7 +5873,7 @@ var InvitationsHandler = class {
|
|
|
5886
5873
|
...protocol.toJSON()
|
|
5887
5874
|
}, {
|
|
5888
5875
|
F: __dxlog_file21,
|
|
5889
|
-
L:
|
|
5876
|
+
L: 295,
|
|
5890
5877
|
S: this,
|
|
5891
5878
|
C: (f, a) => f(...a)
|
|
5892
5879
|
});
|
|
@@ -5896,7 +5883,7 @@ var InvitationsHandler = class {
|
|
|
5896
5883
|
...protocol.toJSON()
|
|
5897
5884
|
}, {
|
|
5898
5885
|
F: __dxlog_file21,
|
|
5899
|
-
L:
|
|
5886
|
+
L: 299,
|
|
5900
5887
|
S: this,
|
|
5901
5888
|
C: (f, a) => f(...a)
|
|
5902
5889
|
});
|
|
@@ -5910,7 +5897,7 @@ var InvitationsHandler = class {
|
|
|
5910
5897
|
authMethod: introductionResponse.authMethod
|
|
5911
5898
|
}, {
|
|
5912
5899
|
F: __dxlog_file21,
|
|
5913
|
-
L:
|
|
5900
|
+
L: 307,
|
|
5914
5901
|
S: this,
|
|
5915
5902
|
C: (f, a) => f(...a)
|
|
5916
5903
|
});
|
|
@@ -5932,7 +5919,7 @@ var InvitationsHandler = class {
|
|
|
5932
5919
|
...protocol.toJSON()
|
|
5933
5920
|
}, {
|
|
5934
5921
|
F: __dxlog_file21,
|
|
5935
|
-
L:
|
|
5922
|
+
L: 337,
|
|
5936
5923
|
S: this,
|
|
5937
5924
|
C: (f, a) => f(...a)
|
|
5938
5925
|
});
|
|
@@ -5945,7 +5932,7 @@ var InvitationsHandler = class {
|
|
|
5945
5932
|
...protocol.toJSON()
|
|
5946
5933
|
}, {
|
|
5947
5934
|
F: __dxlog_file21,
|
|
5948
|
-
L:
|
|
5935
|
+
L: 351,
|
|
5949
5936
|
S: this,
|
|
5950
5937
|
C: (f, a) => f(...a)
|
|
5951
5938
|
});
|
|
@@ -5958,7 +5945,7 @@ var InvitationsHandler = class {
|
|
|
5958
5945
|
id: traceId
|
|
5959
5946
|
}), {
|
|
5960
5947
|
F: __dxlog_file21,
|
|
5961
|
-
L:
|
|
5948
|
+
L: 360,
|
|
5962
5949
|
S: this,
|
|
5963
5950
|
C: (f, a) => f(...a)
|
|
5964
5951
|
});
|
|
@@ -5968,7 +5955,7 @@ var InvitationsHandler = class {
|
|
|
5968
5955
|
...protocol.toJSON()
|
|
5969
5956
|
}, {
|
|
5970
5957
|
F: __dxlog_file21,
|
|
5971
|
-
L:
|
|
5958
|
+
L: 363,
|
|
5972
5959
|
S: this,
|
|
5973
5960
|
C: (f, a) => f(...a)
|
|
5974
5961
|
});
|
|
@@ -5976,7 +5963,7 @@ var InvitationsHandler = class {
|
|
|
5976
5963
|
} else {
|
|
5977
5964
|
import_log12.log.verbose("auth failed", err, {
|
|
5978
5965
|
F: __dxlog_file21,
|
|
5979
|
-
L:
|
|
5966
|
+
L: 366,
|
|
5980
5967
|
S: this,
|
|
5981
5968
|
C: (f, a) => f(...a)
|
|
5982
5969
|
});
|
|
@@ -5988,7 +5975,7 @@ var InvitationsHandler = class {
|
|
|
5988
5975
|
error: err
|
|
5989
5976
|
}), {
|
|
5990
5977
|
F: __dxlog_file21,
|
|
5991
|
-
L:
|
|
5978
|
+
L: 370,
|
|
5992
5979
|
S: this,
|
|
5993
5980
|
C: (f, a) => f(...a)
|
|
5994
5981
|
});
|
|
@@ -6004,7 +5991,7 @@ var InvitationsHandler = class {
|
|
|
6004
5991
|
...protocol.toJSON()
|
|
6005
5992
|
}, {
|
|
6006
5993
|
F: __dxlog_file21,
|
|
6007
|
-
L:
|
|
5994
|
+
L: 379,
|
|
6008
5995
|
S: this,
|
|
6009
5996
|
C: (f, a) => f(...a)
|
|
6010
5997
|
});
|
|
@@ -6012,7 +5999,7 @@ var InvitationsHandler = class {
|
|
|
6012
5999
|
} else {
|
|
6013
6000
|
import_log12.log.verbose("auth failed", err, {
|
|
6014
6001
|
F: __dxlog_file21,
|
|
6015
|
-
L:
|
|
6002
|
+
L: 382,
|
|
6016
6003
|
S: this,
|
|
6017
6004
|
C: (f, a) => f(...a)
|
|
6018
6005
|
});
|
|
@@ -6029,7 +6016,7 @@ var InvitationsHandler = class {
|
|
|
6029
6016
|
...protocol.toJSON()
|
|
6030
6017
|
}, {
|
|
6031
6018
|
F: __dxlog_file21,
|
|
6032
|
-
L:
|
|
6019
|
+
L: 394,
|
|
6033
6020
|
S: this,
|
|
6034
6021
|
C: (f, a) => f(...a)
|
|
6035
6022
|
});
|
|
@@ -6042,14 +6029,14 @@ var InvitationsHandler = class {
|
|
|
6042
6029
|
});
|
|
6043
6030
|
edgeInvitationHandler.handle(ctx, guardedState, protocol, deviceProfile);
|
|
6044
6031
|
(0, import_async15.scheduleTask)(ctx, async () => {
|
|
6045
|
-
const error =
|
|
6032
|
+
const error = checkInvitation(protocol, invitation);
|
|
6046
6033
|
if (error) {
|
|
6047
6034
|
stream.error(error);
|
|
6048
6035
|
await ctx.dispose();
|
|
6049
6036
|
} else {
|
|
6050
6037
|
(0, import_invariant12.invariant)(invitation.swarmKey, void 0, {
|
|
6051
6038
|
F: __dxlog_file21,
|
|
6052
|
-
L:
|
|
6039
|
+
L: 406,
|
|
6053
6040
|
S: this,
|
|
6054
6041
|
A: [
|
|
6055
6042
|
"invitation.swarmKey",
|
|
@@ -6093,7 +6080,7 @@ var InvitationsHandler = class {
|
|
|
6093
6080
|
for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
|
|
6094
6081
|
(0, import_log12.log)("guest waiting for authentication code...", void 0, {
|
|
6095
6082
|
F: __dxlog_file21,
|
|
6096
|
-
L:
|
|
6083
|
+
L: 458,
|
|
6097
6084
|
S: this,
|
|
6098
6085
|
C: (f, a) => f(...a)
|
|
6099
6086
|
});
|
|
@@ -6101,7 +6088,7 @@ var InvitationsHandler = class {
|
|
|
6101
6088
|
const authCode = await authenticated.wait(options);
|
|
6102
6089
|
(0, import_log12.log)("sending authentication request", void 0, {
|
|
6103
6090
|
F: __dxlog_file21,
|
|
6104
|
-
L:
|
|
6091
|
+
L: 462,
|
|
6105
6092
|
S: this,
|
|
6106
6093
|
C: (f, a) => f(...a)
|
|
6107
6094
|
});
|
|
@@ -6120,7 +6107,7 @@ var InvitationsHandler = class {
|
|
|
6120
6107
|
attempt
|
|
6121
6108
|
}, {
|
|
6122
6109
|
F: __dxlog_file21,
|
|
6123
|
-
L:
|
|
6110
|
+
L: 473,
|
|
6124
6111
|
S: this,
|
|
6125
6112
|
C: (f, a) => f(...a)
|
|
6126
6113
|
});
|
|
@@ -6138,7 +6125,7 @@ var InvitationsHandler = class {
|
|
|
6138
6125
|
}
|
|
6139
6126
|
(0, import_log12.log)("sending authentication request", void 0, {
|
|
6140
6127
|
F: __dxlog_file21,
|
|
6141
|
-
L:
|
|
6128
|
+
L: 492,
|
|
6142
6129
|
S: this,
|
|
6143
6130
|
C: (f, a) => f(...a)
|
|
6144
6131
|
});
|
|
@@ -6151,6 +6138,13 @@ var InvitationsHandler = class {
|
|
|
6151
6138
|
}
|
|
6152
6139
|
}
|
|
6153
6140
|
};
|
|
6141
|
+
var checkInvitation = (protocol, invitation) => {
|
|
6142
|
+
const expiresOn = (0, import_client_protocol5.getExpirationTime)(invitation);
|
|
6143
|
+
if (expiresOn && expiresOn.getTime() < Date.now()) {
|
|
6144
|
+
return new import_protocols9.InvalidInvitationError("Invitation already expired.");
|
|
6145
|
+
}
|
|
6146
|
+
return protocol.checkInvitation(invitation);
|
|
6147
|
+
};
|
|
6154
6148
|
var createAdmissionKeypair = () => {
|
|
6155
6149
|
const keypair = (0, import_crypto.createKeyPair)();
|
|
6156
6150
|
return {
|
|
@@ -6285,7 +6279,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6285
6279
|
getInvitationContext() {
|
|
6286
6280
|
(0, import_invariant17.invariant)(this._spaceKey, void 0, {
|
|
6287
6281
|
F: __dxlog_file22,
|
|
6288
|
-
L:
|
|
6282
|
+
L: 65,
|
|
6289
6283
|
S: this,
|
|
6290
6284
|
A: [
|
|
6291
6285
|
"this._spaceKey",
|
|
@@ -6295,7 +6289,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6295
6289
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
6296
6290
|
(0, import_invariant17.invariant)(space, void 0, {
|
|
6297
6291
|
F: __dxlog_file22,
|
|
6298
|
-
L:
|
|
6292
|
+
L: 67,
|
|
6299
6293
|
S: this,
|
|
6300
6294
|
A: [
|
|
6301
6295
|
"space",
|
|
@@ -6311,7 +6305,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6311
6305
|
async admit(invitation, request, guestProfile) {
|
|
6312
6306
|
(0, import_invariant17.invariant)(this._spaceKey && request.space, void 0, {
|
|
6313
6307
|
F: __dxlog_file22,
|
|
6314
|
-
L:
|
|
6308
|
+
L: 80,
|
|
6315
6309
|
S: this,
|
|
6316
6310
|
A: [
|
|
6317
6311
|
"this._spaceKey && request.space",
|
|
@@ -6323,7 +6317,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6323
6317
|
guest: request.space.deviceKey
|
|
6324
6318
|
}, {
|
|
6325
6319
|
F: __dxlog_file22,
|
|
6326
|
-
L:
|
|
6320
|
+
L: 81,
|
|
6327
6321
|
S: this,
|
|
6328
6322
|
C: (f, a) => f(...a)
|
|
6329
6323
|
});
|
|
@@ -6345,7 +6339,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6345
6339
|
async delegate(invitation) {
|
|
6346
6340
|
(0, import_invariant17.invariant)(this._spaceKey, void 0, {
|
|
6347
6341
|
F: __dxlog_file22,
|
|
6348
|
-
L:
|
|
6342
|
+
L: 101,
|
|
6349
6343
|
S: this,
|
|
6350
6344
|
A: [
|
|
6351
6345
|
"this._spaceKey",
|
|
@@ -6355,7 +6349,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6355
6349
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
6356
6350
|
(0, import_invariant17.invariant)(space, void 0, {
|
|
6357
6351
|
F: __dxlog_file22,
|
|
6358
|
-
L:
|
|
6352
|
+
L: 103,
|
|
6359
6353
|
S: this,
|
|
6360
6354
|
A: [
|
|
6361
6355
|
"space",
|
|
@@ -6365,7 +6359,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6365
6359
|
if (invitation.authMethod === import_services17.Invitation.AuthMethod.KNOWN_PUBLIC_KEY) {
|
|
6366
6360
|
(0, import_invariant17.invariant)(invitation.guestKeypair?.publicKey, void 0, {
|
|
6367
6361
|
F: __dxlog_file22,
|
|
6368
|
-
L:
|
|
6362
|
+
L: 105,
|
|
6369
6363
|
S: this,
|
|
6370
6364
|
A: [
|
|
6371
6365
|
"invitation.guestKeypair?.publicKey",
|
|
@@ -6378,7 +6372,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6378
6372
|
id: invitation.invitationId
|
|
6379
6373
|
}, {
|
|
6380
6374
|
F: __dxlog_file22,
|
|
6381
|
-
L:
|
|
6375
|
+
L: 108,
|
|
6382
6376
|
S: this,
|
|
6383
6377
|
C: (f, a) => f(...a)
|
|
6384
6378
|
});
|
|
@@ -6387,13 +6381,13 @@ var SpaceInvitationProtocol = class {
|
|
|
6387
6381
|
authMethod: invitation.authMethod,
|
|
6388
6382
|
swarmKey: invitation.swarmKey,
|
|
6389
6383
|
role: invitation.role ?? import_credentials19.SpaceMember.Role.ADMIN,
|
|
6390
|
-
expiresOn:
|
|
6384
|
+
expiresOn: computeExpirationTime(invitation),
|
|
6391
6385
|
multiUse: invitation.multiUse ?? false,
|
|
6392
6386
|
guestKey: invitation.authMethod === import_services17.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? invitation.guestKeypair.publicKey : void 0
|
|
6393
6387
|
});
|
|
6394
6388
|
(0, import_invariant17.invariant)(credential.credential, void 0, {
|
|
6395
6389
|
F: __dxlog_file22,
|
|
6396
|
-
L:
|
|
6390
|
+
L: 126,
|
|
6397
6391
|
S: this,
|
|
6398
6392
|
A: [
|
|
6399
6393
|
"credential.credential",
|
|
@@ -6408,7 +6402,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6408
6402
|
async cancelDelegation(invitation) {
|
|
6409
6403
|
(0, import_invariant17.invariant)(this._spaceKey, void 0, {
|
|
6410
6404
|
F: __dxlog_file22,
|
|
6411
|
-
L:
|
|
6405
|
+
L: 132,
|
|
6412
6406
|
S: this,
|
|
6413
6407
|
A: [
|
|
6414
6408
|
"this._spaceKey",
|
|
@@ -6417,7 +6411,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6417
6411
|
});
|
|
6418
6412
|
(0, import_invariant17.invariant)(invitation.type === import_services17.Invitation.Type.DELEGATED && invitation.delegationCredentialId, void 0, {
|
|
6419
6413
|
F: __dxlog_file22,
|
|
6420
|
-
L:
|
|
6414
|
+
L: 133,
|
|
6421
6415
|
S: this,
|
|
6422
6416
|
A: [
|
|
6423
6417
|
"invitation.type === Invitation.Type.DELEGATED && invitation.delegationCredentialId",
|
|
@@ -6427,7 +6421,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6427
6421
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
6428
6422
|
(0, import_invariant17.invariant)(space, void 0, {
|
|
6429
6423
|
F: __dxlog_file22,
|
|
6430
|
-
L:
|
|
6424
|
+
L: 135,
|
|
6431
6425
|
S: this,
|
|
6432
6426
|
A: [
|
|
6433
6427
|
"space",
|
|
@@ -6439,14 +6433,14 @@ var SpaceInvitationProtocol = class {
|
|
|
6439
6433
|
id: invitation.invitationId
|
|
6440
6434
|
}, {
|
|
6441
6435
|
F: __dxlog_file22,
|
|
6442
|
-
L:
|
|
6436
|
+
L: 137,
|
|
6443
6437
|
S: this,
|
|
6444
6438
|
C: (f, a) => f(...a)
|
|
6445
6439
|
});
|
|
6446
6440
|
const credential = await (0, import_credentials18.createCancelDelegatedSpaceInvitationCredential)(this._signingContext.credentialSigner, space.key, invitation.delegationCredentialId);
|
|
6447
6441
|
(0, import_invariant17.invariant)(credential.credential, void 0, {
|
|
6448
6442
|
F: __dxlog_file22,
|
|
6449
|
-
L:
|
|
6443
|
+
L: 144,
|
|
6450
6444
|
S: this,
|
|
6451
6445
|
A: [
|
|
6452
6446
|
"credential.credential",
|
|
@@ -6485,7 +6479,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6485
6479
|
async accept(response) {
|
|
6486
6480
|
(0, import_invariant17.invariant)(response.space, void 0, {
|
|
6487
6481
|
F: __dxlog_file22,
|
|
6488
|
-
L:
|
|
6482
|
+
L: 179,
|
|
6489
6483
|
S: this,
|
|
6490
6484
|
A: [
|
|
6491
6485
|
"response.space",
|
|
@@ -6496,7 +6490,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6496
6490
|
const assertion = (0, import_credentials18.getCredentialAssertion)(credential);
|
|
6497
6491
|
(0, import_invariant17.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
6498
6492
|
F: __dxlog_file22,
|
|
6499
|
-
L:
|
|
6493
|
+
L: 182,
|
|
6500
6494
|
S: this,
|
|
6501
6495
|
A: [
|
|
6502
6496
|
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -6505,7 +6499,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6505
6499
|
});
|
|
6506
6500
|
(0, import_invariant17.invariant)(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
|
|
6507
6501
|
F: __dxlog_file22,
|
|
6508
|
-
L:
|
|
6502
|
+
L: 183,
|
|
6509
6503
|
S: this,
|
|
6510
6504
|
A: [
|
|
6511
6505
|
"credential.subject.id.equals(this._signingContext.identityKey)",
|
|
@@ -6729,7 +6723,7 @@ var InvitationsManager = class {
|
|
|
6729
6723
|
}
|
|
6730
6724
|
}
|
|
6731
6725
|
_createInvitation(protocol, _options) {
|
|
6732
|
-
const { invitationId = import_keys14.PublicKey.random().toHex(), type = import_services18.Invitation.Type.INTERACTIVE, authMethod = import_services18.Invitation.AuthMethod.SHARED_SECRET, state = import_services18.Invitation.State.INIT, timeout = import_client_protocol6.INVITATION_TIMEOUT, swarmKey = import_keys14.PublicKey.random(), persistent = _options?.authMethod !== import_services18.Invitation.AuthMethod.KNOWN_PUBLIC_KEY, created = /* @__PURE__ */ new Date(), guestKeypair = void 0, role = import_credentials21.SpaceMember.Role.ADMIN, lifetime = 86400, multiUse = false, ...options } = _options ?? {};
|
|
6726
|
+
const { invitationId = import_keys14.PublicKey.random().toHex(), type = import_services18.Invitation.Type.INTERACTIVE, authMethod = import_services18.Invitation.AuthMethod.SHARED_SECRET, state = import_services18.Invitation.State.INIT, timeout = import_client_protocol6.INVITATION_TIMEOUT, swarmKey = import_keys14.PublicKey.random(), persistent = _options?.authMethod !== import_services18.Invitation.AuthMethod.KNOWN_PUBLIC_KEY, created = /* @__PURE__ */ new Date(), guestKeypair = void 0, role = import_credentials21.SpaceMember.Role.ADMIN, lifetime = 86400 * 7, multiUse = false, ...options } = _options ?? {};
|
|
6733
6727
|
const authCode = options?.authCode ?? (authMethod === import_services18.Invitation.AuthMethod.SHARED_SECRET ? (0, import_credentials20.generatePasscode)(import_client_protocol6.AUTHENTICATION_CODE_LENGTH) : void 0);
|
|
6734
6728
|
return {
|
|
6735
6729
|
invitationId,
|
|
@@ -7068,6 +7062,18 @@ var EdgeAgentManager = class extends import_context15.Resource {
|
|
|
7068
7062
|
haloSpaceKey: this._identity.haloSpaceKey.toHex()
|
|
7069
7063
|
});
|
|
7070
7064
|
const deviceKey = import_keys15.PublicKey.fromHex(response.deviceKey);
|
|
7065
|
+
if (await this._identity.authorizedDeviceKeys.has(deviceKey)) {
|
|
7066
|
+
import_log21.log.info("agent was already added to HALO, ignoring response", {
|
|
7067
|
+
response
|
|
7068
|
+
}, {
|
|
7069
|
+
F: __dxlog_file25,
|
|
7070
|
+
L: 67,
|
|
7071
|
+
S: this,
|
|
7072
|
+
C: (f, a) => f(...a)
|
|
7073
|
+
});
|
|
7074
|
+
this._updateStatus(import_protocols14.EdgeAgentStatus.ACTIVE, deviceKey);
|
|
7075
|
+
return;
|
|
7076
|
+
}
|
|
7071
7077
|
await this._identity.admitDevice({
|
|
7072
7078
|
deviceKey,
|
|
7073
7079
|
controlFeedKey: import_keys15.PublicKey.fromHex(response.feedKey),
|
|
@@ -7076,7 +7082,7 @@ var EdgeAgentManager = class extends import_context15.Resource {
|
|
|
7076
7082
|
});
|
|
7077
7083
|
(0, import_log21.log)("agent created", response, {
|
|
7078
7084
|
F: __dxlog_file25,
|
|
7079
|
-
L:
|
|
7085
|
+
L: 79,
|
|
7080
7086
|
S: this,
|
|
7081
7087
|
C: (f, a) => f(...a)
|
|
7082
7088
|
});
|
|
@@ -7088,7 +7094,7 @@ var EdgeAgentManager = class extends import_context15.Resource {
|
|
|
7088
7094
|
isEnabled
|
|
7089
7095
|
}, {
|
|
7090
7096
|
F: __dxlog_file25,
|
|
7091
|
-
L:
|
|
7097
|
+
L: 87,
|
|
7092
7098
|
S: this,
|
|
7093
7099
|
C: (f, a) => f(...a)
|
|
7094
7100
|
});
|
|
@@ -7121,7 +7127,7 @@ var EdgeAgentManager = class extends import_context15.Resource {
|
|
|
7121
7127
|
async _fetchAgentStatus() {
|
|
7122
7128
|
(0, import_invariant20.invariant)(this._edgeHttpClient, void 0, {
|
|
7123
7129
|
F: __dxlog_file25,
|
|
7124
|
-
L:
|
|
7130
|
+
L: 121,
|
|
7125
7131
|
S: this,
|
|
7126
7132
|
A: [
|
|
7127
7133
|
"this._edgeHttpClient",
|
|
@@ -7131,7 +7137,7 @@ var EdgeAgentManager = class extends import_context15.Resource {
|
|
|
7131
7137
|
try {
|
|
7132
7138
|
(0, import_log21.log)("fetching agent status", void 0, {
|
|
7133
7139
|
F: __dxlog_file25,
|
|
7134
|
-
L:
|
|
7140
|
+
L: 123,
|
|
7135
7141
|
S: this,
|
|
7136
7142
|
C: (f, a) => f(...a)
|
|
7137
7143
|
});
|
|
@@ -7150,7 +7156,7 @@ var EdgeAgentManager = class extends import_context15.Resource {
|
|
|
7150
7156
|
err
|
|
7151
7157
|
}, {
|
|
7152
7158
|
F: __dxlog_file25,
|
|
7153
|
-
L:
|
|
7159
|
+
L: 133,
|
|
7154
7160
|
S: this,
|
|
7155
7161
|
C: (f, a) => f(...a)
|
|
7156
7162
|
});
|
|
@@ -7163,7 +7169,7 @@ var EdgeAgentManager = class extends import_context15.Resource {
|
|
|
7163
7169
|
retryAfterMs
|
|
7164
7170
|
}, {
|
|
7165
7171
|
F: __dxlog_file25,
|
|
7166
|
-
L:
|
|
7172
|
+
L: 138,
|
|
7167
7173
|
S: this,
|
|
7168
7174
|
C: (f, a) => f(...a)
|
|
7169
7175
|
});
|
|
@@ -7199,7 +7205,7 @@ var EdgeAgentManager = class extends import_context15.Resource {
|
|
|
7199
7205
|
spaceId: space.id
|
|
7200
7206
|
}, {
|
|
7201
7207
|
F: __dxlog_file25,
|
|
7202
|
-
L:
|
|
7208
|
+
L: 165,
|
|
7203
7209
|
S: this,
|
|
7204
7210
|
C: (f, a) => f(...a)
|
|
7205
7211
|
});
|
|
@@ -7219,7 +7225,7 @@ var EdgeAgentManager = class extends import_context15.Resource {
|
|
|
7219
7225
|
status
|
|
7220
7226
|
}, {
|
|
7221
7227
|
F: __dxlog_file25,
|
|
7222
|
-
L:
|
|
7228
|
+
L: 181,
|
|
7223
7229
|
S: this,
|
|
7224
7230
|
C: (f, a) => f(...a)
|
|
7225
7231
|
});
|
|
@@ -7292,27 +7298,41 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7292
7298
|
this._identityProvider = _identityProvider;
|
|
7293
7299
|
this._acceptRecoveredIdentity = _acceptRecoveredIdentity;
|
|
7294
7300
|
}
|
|
7295
|
-
async
|
|
7301
|
+
async createRecoveryCredential({ data }) {
|
|
7296
7302
|
const identity = this._identityProvider();
|
|
7297
7303
|
(0, import_invariant22.invariant)(identity, void 0, {
|
|
7298
7304
|
F: __dxlog_file26,
|
|
7299
|
-
L:
|
|
7305
|
+
L: 37,
|
|
7300
7306
|
S: this,
|
|
7301
7307
|
A: [
|
|
7302
7308
|
"identity",
|
|
7303
7309
|
""
|
|
7304
7310
|
]
|
|
7305
7311
|
});
|
|
7306
|
-
|
|
7307
|
-
|
|
7308
|
-
|
|
7312
|
+
let recoveryKey;
|
|
7313
|
+
let lookupKey;
|
|
7314
|
+
let algorithm;
|
|
7315
|
+
let recoveryCode;
|
|
7316
|
+
if (data) {
|
|
7317
|
+
recoveryKey = data.recoveryKey;
|
|
7318
|
+
lookupKey = data.lookupKey;
|
|
7319
|
+
algorithm = data.algorithm;
|
|
7320
|
+
} else {
|
|
7321
|
+
recoveryCode = (0, import_credentials23.generateSeedPhrase)();
|
|
7322
|
+
const keypair = (0, import_credentials23.keyPairFromSeedPhrase)(recoveryCode);
|
|
7323
|
+
recoveryKey = import_keys17.PublicKey.from(keypair.publicKey);
|
|
7324
|
+
lookupKey = import_keys17.PublicKey.from(keypair.publicKey);
|
|
7325
|
+
algorithm = "ED25519";
|
|
7326
|
+
}
|
|
7309
7327
|
const identityKey = identity.identityKey;
|
|
7310
7328
|
const credential = await identity.getIdentityCredentialSigner().createCredential({
|
|
7311
7329
|
subject: identityKey,
|
|
7312
7330
|
assertion: {
|
|
7313
7331
|
"@type": "dxos.halo.credentials.IdentityRecovery",
|
|
7314
7332
|
recoveryKey,
|
|
7315
|
-
identityKey
|
|
7333
|
+
identityKey,
|
|
7334
|
+
algorithm,
|
|
7335
|
+
lookupKey
|
|
7316
7336
|
}
|
|
7317
7337
|
});
|
|
7318
7338
|
const receipt = await identity.controlPipeline.writer.write({
|
|
@@ -7327,25 +7347,86 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7327
7347
|
]
|
|
7328
7348
|
]));
|
|
7329
7349
|
return {
|
|
7330
|
-
|
|
7350
|
+
recoveryCode
|
|
7331
7351
|
};
|
|
7332
7352
|
}
|
|
7333
|
-
async
|
|
7353
|
+
async requestRecoveryChallenge() {
|
|
7334
7354
|
(0, import_invariant22.invariant)(this._edgeClient, "Not connected to EDGE.", {
|
|
7335
7355
|
F: __dxlog_file26,
|
|
7336
|
-
L:
|
|
7356
|
+
L: 74,
|
|
7357
|
+
S: this,
|
|
7358
|
+
A: [
|
|
7359
|
+
"this._edgeClient",
|
|
7360
|
+
"'Not connected to EDGE.'"
|
|
7361
|
+
]
|
|
7362
|
+
});
|
|
7363
|
+
const deviceKey = await this._keyring.createKey();
|
|
7364
|
+
const controlFeedKey = await this._keyring.createKey();
|
|
7365
|
+
const request = {
|
|
7366
|
+
deviceKey: deviceKey.toHex(),
|
|
7367
|
+
controlFeedKey: controlFeedKey.toHex()
|
|
7368
|
+
};
|
|
7369
|
+
try {
|
|
7370
|
+
await this._edgeClient.recoverIdentity(request);
|
|
7371
|
+
throw new Error("No challenge received.");
|
|
7372
|
+
} catch (error) {
|
|
7373
|
+
if (!(error instanceof import_protocols17.EdgeAuthChallengeError)) {
|
|
7374
|
+
throw error;
|
|
7375
|
+
}
|
|
7376
|
+
return {
|
|
7377
|
+
deviceKey,
|
|
7378
|
+
controlFeedKey,
|
|
7379
|
+
challenge: error.challenge
|
|
7380
|
+
};
|
|
7381
|
+
}
|
|
7382
|
+
}
|
|
7383
|
+
async recoverIdentityWithExternalSignature({ lookupKey, deviceKey, controlFeedKey, signature, clientDataJson, authenticatorData }) {
|
|
7384
|
+
(0, import_invariant22.invariant)(this._edgeClient, "Not connected to EDGE.", {
|
|
7385
|
+
F: __dxlog_file26,
|
|
7386
|
+
L: 106,
|
|
7387
|
+
S: this,
|
|
7388
|
+
A: [
|
|
7389
|
+
"this._edgeClient",
|
|
7390
|
+
"'Not connected to EDGE.'"
|
|
7391
|
+
]
|
|
7392
|
+
});
|
|
7393
|
+
const request = {
|
|
7394
|
+
lookupKey: lookupKey.toHex(),
|
|
7395
|
+
deviceKey: deviceKey.toHex(),
|
|
7396
|
+
controlFeedKey: controlFeedKey.toHex(),
|
|
7397
|
+
signature: clientDataJson && authenticatorData ? {
|
|
7398
|
+
signature: Buffer.from(signature).toString("base64"),
|
|
7399
|
+
clientDataJson: Buffer.from(clientDataJson).toString("base64"),
|
|
7400
|
+
authenticatorData: Buffer.from(authenticatorData).toString("base64")
|
|
7401
|
+
} : Buffer.from(signature).toString("base64")
|
|
7402
|
+
};
|
|
7403
|
+
const response = await this._edgeClient.recoverIdentity(request);
|
|
7404
|
+
await this._acceptRecoveredIdentity({
|
|
7405
|
+
authorizedDeviceCredential: decodeCredential(response.deviceAuthCredential),
|
|
7406
|
+
haloGenesisFeedKey: import_keys17.PublicKey.fromHex(response.genesisFeedKey),
|
|
7407
|
+
haloSpaceKey: import_keys17.PublicKey.fromHex(response.haloSpaceKey),
|
|
7408
|
+
identityKey: import_keys17.PublicKey.fromHex(response.identityKey),
|
|
7409
|
+
deviceKey,
|
|
7410
|
+
controlFeedKey,
|
|
7411
|
+
dataFeedKey: await this._keyring.createKey()
|
|
7412
|
+
});
|
|
7413
|
+
}
|
|
7414
|
+
async recoverIdentity({ recoveryCode }) {
|
|
7415
|
+
(0, import_invariant22.invariant)(this._edgeClient, "Not connected to EDGE.", {
|
|
7416
|
+
F: __dxlog_file26,
|
|
7417
|
+
L: 136,
|
|
7337
7418
|
S: this,
|
|
7338
7419
|
A: [
|
|
7339
7420
|
"this._edgeClient",
|
|
7340
7421
|
"'Not connected to EDGE.'"
|
|
7341
7422
|
]
|
|
7342
7423
|
});
|
|
7343
|
-
const recoveryKeypair = (0, import_credentials23.keyPairFromSeedPhrase)(
|
|
7424
|
+
const recoveryKeypair = (0, import_credentials23.keyPairFromSeedPhrase)(recoveryCode);
|
|
7344
7425
|
const recoveryKey = import_keys17.PublicKey.from(recoveryKeypair.publicKey);
|
|
7345
7426
|
const deviceKey = await this._keyring.createKey();
|
|
7346
7427
|
const controlFeedKey = await this._keyring.createKey();
|
|
7347
7428
|
const request = {
|
|
7348
|
-
|
|
7429
|
+
lookupKey: recoveryKey.toHex(),
|
|
7349
7430
|
deviceKey: deviceKey.toHex(),
|
|
7350
7431
|
controlFeedKey: controlFeedKey.toHex()
|
|
7351
7432
|
};
|
|
@@ -7364,7 +7445,7 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7364
7445
|
}
|
|
7365
7446
|
import_log23.log.info("recovering identity", response, {
|
|
7366
7447
|
F: __dxlog_file26,
|
|
7367
|
-
L:
|
|
7448
|
+
L: 162,
|
|
7368
7449
|
S: this,
|
|
7369
7450
|
C: (f, a) => f(...a)
|
|
7370
7451
|
});
|
|
@@ -8893,4 +8974,4 @@ ClientServicesHost = _ts_decorate11([
|
|
|
8893
8974
|
subscribeToSpaces,
|
|
8894
8975
|
subscribeToSwarmInfo
|
|
8895
8976
|
});
|
|
8896
|
-
//# sourceMappingURL=chunk-
|
|
8977
|
+
//# sourceMappingURL=chunk-FQ5WZIGO.cjs.map
|