@dxos/client-services 0.7.5-labs.e27f9b9 → 0.7.5-labs.ea4b4c2
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-X65X3DJU.mjs} +104 -20
- package/dist/lib/browser/chunk-X65X3DJU.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-2XAKPWJ6.cjs} +107 -23
- package/dist/lib/node/chunk-2XAKPWJ6.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-UCFK27SP.mjs} +104 -20
- package/dist/lib/node-esm/chunk-UCFK27SP.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/identity/identity-recovery-manager.d.ts +10 -1
- package/dist/types/src/packlets/identity/identity-recovery-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-service.d.ts +5 -0
- package/dist/types/src/packlets/identity/identity-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-manager.ts +6 -0
- package/src/packlets/identity/identity-recovery-manager.ts +64 -2
- package/src/packlets/identity/identity-service.ts +12 -1
- package/src/packlets/spaces/data-space-manager.ts +2 -2
- 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
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
InvitationsManager,
|
|
7
7
|
ServiceContext,
|
|
8
8
|
SpaceInvitationProtocol
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-X65X3DJU.mjs";
|
|
10
10
|
|
|
11
11
|
// packages/sdk/client-services/src/packlets/testing/credential-utils.ts
|
|
12
12
|
import { createCredential } from "@dxos/credentials";
|
|
@@ -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_2XAKPWJ6_exports = {};
|
|
30
|
+
__export(chunk_2XAKPWJ6_exports, {
|
|
31
31
|
ClientRpcServer: () => ClientRpcServer,
|
|
32
32
|
ClientServicesHost: () => ClientServicesHost,
|
|
33
33
|
DataSpace: () => DataSpace,
|
|
@@ -72,7 +72,7 @@ __export(chunk_X3IYGB6Q_exports, {
|
|
|
72
72
|
subscribeToSpaces: () => subscribeToSpaces,
|
|
73
73
|
subscribeToSwarmInfo: () => subscribeToSwarmInfo
|
|
74
74
|
});
|
|
75
|
-
module.exports = __toCommonJS(
|
|
75
|
+
module.exports = __toCommonJS(chunk_2XAKPWJ6_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-labs.
|
|
738
|
+
var DXOS_VERSION = "0.7.5-labs.ea4b4c2";
|
|
739
739
|
var getPlatform = () => {
|
|
740
740
|
if (process.browser) {
|
|
741
741
|
if (typeof window !== "undefined") {
|
|
@@ -2666,7 +2666,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2666
2666
|
});
|
|
2667
2667
|
dataSpace.postOpen.append(async () => {
|
|
2668
2668
|
const setting = dataSpace.getEdgeReplicationSetting();
|
|
2669
|
-
if (setting === import_metadata.EdgeReplicationSetting.ENABLED) {
|
|
2669
|
+
if (!setting || setting === import_metadata.EdgeReplicationSetting.ENABLED) {
|
|
2670
2670
|
await this._echoEdgeReplicator?.connectToSpace(dataSpace.id);
|
|
2671
2671
|
} else if (this._echoEdgeReplicator) {
|
|
2672
2672
|
(0, import_log8.log)("not connecting EchoEdgeReplicator because of EdgeReplicationSetting", {
|
|
@@ -2681,7 +2681,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2681
2681
|
});
|
|
2682
2682
|
dataSpace.preClose.append(async () => {
|
|
2683
2683
|
const setting = dataSpace.getEdgeReplicationSetting();
|
|
2684
|
-
if (setting === import_metadata.EdgeReplicationSetting.ENABLED) {
|
|
2684
|
+
if (!setting || setting === import_metadata.EdgeReplicationSetting.ENABLED) {
|
|
2685
2685
|
await this._echoEdgeReplicator?.disconnectFromSpace(dataSpace.id);
|
|
2686
2686
|
}
|
|
2687
2687
|
});
|
|
@@ -3910,15 +3910,26 @@ var IdentityServiceImpl = class extends import_context9.Resource {
|
|
|
3910
3910
|
async createRecoveryCredential(request) {
|
|
3911
3911
|
return this._recoveryManager.createRecoveryCredential(request);
|
|
3912
3912
|
}
|
|
3913
|
+
async requestRecoveryChallenge() {
|
|
3914
|
+
return this._recoveryManager.requestRecoveryChallenge();
|
|
3915
|
+
}
|
|
3913
3916
|
async recoverIdentity(request) {
|
|
3914
|
-
|
|
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
|
+
}
|
|
3915
3926
|
return this._getIdentity();
|
|
3916
3927
|
}
|
|
3917
3928
|
// TODO(burdon): Rename createPresentation?
|
|
3918
3929
|
async signPresentation({ presentation, nonce }) {
|
|
3919
3930
|
(0, import_invariant10.invariant)(this._identityManager.identity, "Identity not initialized.", {
|
|
3920
3931
|
F: __dxlog_file13,
|
|
3921
|
-
L:
|
|
3932
|
+
L: 116,
|
|
3922
3933
|
S: this,
|
|
3923
3934
|
A: [
|
|
3924
3935
|
"this._identityManager.identity",
|
|
@@ -3937,7 +3948,7 @@ var IdentityServiceImpl = class extends import_context9.Resource {
|
|
|
3937
3948
|
const identity = this._identityManager.identity;
|
|
3938
3949
|
(0, import_invariant10.invariant)(identity, "Identity not initialized.", {
|
|
3939
3950
|
F: __dxlog_file13,
|
|
3940
|
-
L:
|
|
3951
|
+
L: 130,
|
|
3941
3952
|
S: this,
|
|
3942
3953
|
A: [
|
|
3943
3954
|
"identity",
|
|
@@ -3975,7 +3986,7 @@ var IdentityServiceImpl = class extends import_context9.Resource {
|
|
|
3975
3986
|
duplicate: space.id
|
|
3976
3987
|
}, {
|
|
3977
3988
|
F: __dxlog_file13,
|
|
3978
|
-
L:
|
|
3989
|
+
L: 164,
|
|
3979
3990
|
S: this,
|
|
3980
3991
|
C: (f, a) => f(...a)
|
|
3981
3992
|
});
|
|
@@ -3989,7 +4000,7 @@ var IdentityServiceImpl = class extends import_context9.Resource {
|
|
|
3989
4000
|
}, (err) => {
|
|
3990
4001
|
import_log11.log.catch(err, void 0, {
|
|
3991
4002
|
F: __dxlog_file13,
|
|
3992
|
-
L:
|
|
4003
|
+
L: 175,
|
|
3993
4004
|
S: this,
|
|
3994
4005
|
C: (f, a) => f(...a)
|
|
3995
4006
|
});
|
|
@@ -7051,6 +7062,18 @@ var EdgeAgentManager = class extends import_context15.Resource {
|
|
|
7051
7062
|
haloSpaceKey: this._identity.haloSpaceKey.toHex()
|
|
7052
7063
|
});
|
|
7053
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
|
+
}
|
|
7054
7077
|
await this._identity.admitDevice({
|
|
7055
7078
|
deviceKey,
|
|
7056
7079
|
controlFeedKey: import_keys15.PublicKey.fromHex(response.feedKey),
|
|
@@ -7059,7 +7082,7 @@ var EdgeAgentManager = class extends import_context15.Resource {
|
|
|
7059
7082
|
});
|
|
7060
7083
|
(0, import_log21.log)("agent created", response, {
|
|
7061
7084
|
F: __dxlog_file25,
|
|
7062
|
-
L:
|
|
7085
|
+
L: 79,
|
|
7063
7086
|
S: this,
|
|
7064
7087
|
C: (f, a) => f(...a)
|
|
7065
7088
|
});
|
|
@@ -7071,7 +7094,7 @@ var EdgeAgentManager = class extends import_context15.Resource {
|
|
|
7071
7094
|
isEnabled
|
|
7072
7095
|
}, {
|
|
7073
7096
|
F: __dxlog_file25,
|
|
7074
|
-
L:
|
|
7097
|
+
L: 87,
|
|
7075
7098
|
S: this,
|
|
7076
7099
|
C: (f, a) => f(...a)
|
|
7077
7100
|
});
|
|
@@ -7104,7 +7127,7 @@ var EdgeAgentManager = class extends import_context15.Resource {
|
|
|
7104
7127
|
async _fetchAgentStatus() {
|
|
7105
7128
|
(0, import_invariant20.invariant)(this._edgeHttpClient, void 0, {
|
|
7106
7129
|
F: __dxlog_file25,
|
|
7107
|
-
L:
|
|
7130
|
+
L: 121,
|
|
7108
7131
|
S: this,
|
|
7109
7132
|
A: [
|
|
7110
7133
|
"this._edgeHttpClient",
|
|
@@ -7114,7 +7137,7 @@ var EdgeAgentManager = class extends import_context15.Resource {
|
|
|
7114
7137
|
try {
|
|
7115
7138
|
(0, import_log21.log)("fetching agent status", void 0, {
|
|
7116
7139
|
F: __dxlog_file25,
|
|
7117
|
-
L:
|
|
7140
|
+
L: 123,
|
|
7118
7141
|
S: this,
|
|
7119
7142
|
C: (f, a) => f(...a)
|
|
7120
7143
|
});
|
|
@@ -7133,7 +7156,7 @@ var EdgeAgentManager = class extends import_context15.Resource {
|
|
|
7133
7156
|
err
|
|
7134
7157
|
}, {
|
|
7135
7158
|
F: __dxlog_file25,
|
|
7136
|
-
L:
|
|
7159
|
+
L: 133,
|
|
7137
7160
|
S: this,
|
|
7138
7161
|
C: (f, a) => f(...a)
|
|
7139
7162
|
});
|
|
@@ -7146,7 +7169,7 @@ var EdgeAgentManager = class extends import_context15.Resource {
|
|
|
7146
7169
|
retryAfterMs
|
|
7147
7170
|
}, {
|
|
7148
7171
|
F: __dxlog_file25,
|
|
7149
|
-
L:
|
|
7172
|
+
L: 138,
|
|
7150
7173
|
S: this,
|
|
7151
7174
|
C: (f, a) => f(...a)
|
|
7152
7175
|
});
|
|
@@ -7182,7 +7205,7 @@ var EdgeAgentManager = class extends import_context15.Resource {
|
|
|
7182
7205
|
spaceId: space.id
|
|
7183
7206
|
}, {
|
|
7184
7207
|
F: __dxlog_file25,
|
|
7185
|
-
L:
|
|
7208
|
+
L: 165,
|
|
7186
7209
|
S: this,
|
|
7187
7210
|
C: (f, a) => f(...a)
|
|
7188
7211
|
});
|
|
@@ -7202,7 +7225,7 @@ var EdgeAgentManager = class extends import_context15.Resource {
|
|
|
7202
7225
|
status
|
|
7203
7226
|
}, {
|
|
7204
7227
|
F: __dxlog_file25,
|
|
7205
|
-
L:
|
|
7228
|
+
L: 181,
|
|
7206
7229
|
S: this,
|
|
7207
7230
|
C: (f, a) => f(...a)
|
|
7208
7231
|
});
|
|
@@ -7291,7 +7314,7 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7291
7314
|
recoveryCode = (0, import_credentials23.generateSeedPhrase)();
|
|
7292
7315
|
const keypair = (0, import_credentials23.keyPairFromSeedPhrase)(recoveryCode);
|
|
7293
7316
|
recoveryKey = import_keys17.PublicKey.from(keypair.publicKey);
|
|
7294
|
-
algorithm =
|
|
7317
|
+
algorithm = "ED25519";
|
|
7295
7318
|
}
|
|
7296
7319
|
(0, import_invariant22.invariant)(algorithm, "Algorithm is required.", {
|
|
7297
7320
|
F: __dxlog_file26,
|
|
@@ -7327,7 +7350,7 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7327
7350
|
recoveryCode
|
|
7328
7351
|
};
|
|
7329
7352
|
}
|
|
7330
|
-
async
|
|
7353
|
+
async requestRecoveryChallenge() {
|
|
7331
7354
|
(0, import_invariant22.invariant)(this._edgeClient, "Not connected to EDGE.", {
|
|
7332
7355
|
F: __dxlog_file26,
|
|
7333
7356
|
L: 66,
|
|
@@ -7337,6 +7360,67 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7337
7360
|
"'Not connected to EDGE.'"
|
|
7338
7361
|
]
|
|
7339
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({ identityDid, deviceKey, controlFeedKey, signature, clientDataJson, authenticatorData }) {
|
|
7384
|
+
(0, import_invariant22.invariant)(this._edgeClient, "Not connected to EDGE.", {
|
|
7385
|
+
F: __dxlog_file26,
|
|
7386
|
+
L: 98,
|
|
7387
|
+
S: this,
|
|
7388
|
+
A: [
|
|
7389
|
+
"this._edgeClient",
|
|
7390
|
+
"'Not connected to EDGE.'"
|
|
7391
|
+
]
|
|
7392
|
+
});
|
|
7393
|
+
const request = {
|
|
7394
|
+
identityDid,
|
|
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: 128,
|
|
7418
|
+
S: this,
|
|
7419
|
+
A: [
|
|
7420
|
+
"this._edgeClient",
|
|
7421
|
+
"'Not connected to EDGE.'"
|
|
7422
|
+
]
|
|
7423
|
+
});
|
|
7340
7424
|
const recoveryKeypair = (0, import_credentials23.keyPairFromSeedPhrase)(recoveryCode);
|
|
7341
7425
|
const recoveryKey = import_keys17.PublicKey.from(recoveryKeypair.publicKey);
|
|
7342
7426
|
const deviceKey = await this._keyring.createKey();
|
|
@@ -7361,7 +7445,7 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7361
7445
|
}
|
|
7362
7446
|
import_log23.log.info("recovering identity", response, {
|
|
7363
7447
|
F: __dxlog_file26,
|
|
7364
|
-
L:
|
|
7448
|
+
L: 154,
|
|
7365
7449
|
S: this,
|
|
7366
7450
|
C: (f, a) => f(...a)
|
|
7367
7451
|
});
|
|
@@ -8890,4 +8974,4 @@ ClientServicesHost = _ts_decorate11([
|
|
|
8890
8974
|
subscribeToSpaces,
|
|
8891
8975
|
subscribeToSwarmInfo
|
|
8892
8976
|
});
|
|
8893
|
-
//# sourceMappingURL=chunk-
|
|
8977
|
+
//# sourceMappingURL=chunk-2XAKPWJ6.cjs.map
|