@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
|
@@ -397,7 +397,7 @@ 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-labs.
|
|
400
|
+
var DXOS_VERSION = "0.7.5-labs.ea4b4c2";
|
|
401
401
|
|
|
402
402
|
// packages/sdk/client-services/src/packlets/services/platform.ts
|
|
403
403
|
import { Platform } from "@dxos/protocols/proto/dxos/client/services";
|
|
@@ -2530,7 +2530,7 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
2530
2530
|
});
|
|
2531
2531
|
dataSpace.postOpen.append(async () => {
|
|
2532
2532
|
const setting = dataSpace.getEdgeReplicationSetting();
|
|
2533
|
-
if (setting === EdgeReplicationSetting.ENABLED) {
|
|
2533
|
+
if (!setting || setting === EdgeReplicationSetting.ENABLED) {
|
|
2534
2534
|
await this._echoEdgeReplicator?.connectToSpace(dataSpace.id);
|
|
2535
2535
|
} else if (this._echoEdgeReplicator) {
|
|
2536
2536
|
log7("not connecting EchoEdgeReplicator because of EdgeReplicationSetting", {
|
|
@@ -2545,7 +2545,7 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
2545
2545
|
});
|
|
2546
2546
|
dataSpace.preClose.append(async () => {
|
|
2547
2547
|
const setting = dataSpace.getEdgeReplicationSetting();
|
|
2548
|
-
if (setting === EdgeReplicationSetting.ENABLED) {
|
|
2548
|
+
if (!setting || setting === EdgeReplicationSetting.ENABLED) {
|
|
2549
2549
|
await this._echoEdgeReplicator?.disconnectFromSpace(dataSpace.id);
|
|
2550
2550
|
}
|
|
2551
2551
|
});
|
|
@@ -3814,15 +3814,26 @@ var IdentityServiceImpl = class extends Resource5 {
|
|
|
3814
3814
|
async createRecoveryCredential(request) {
|
|
3815
3815
|
return this._recoveryManager.createRecoveryCredential(request);
|
|
3816
3816
|
}
|
|
3817
|
+
async requestRecoveryChallenge() {
|
|
3818
|
+
return this._recoveryManager.requestRecoveryChallenge();
|
|
3819
|
+
}
|
|
3817
3820
|
async recoverIdentity(request) {
|
|
3818
|
-
|
|
3821
|
+
if (request.recoveryCode) {
|
|
3822
|
+
await this._recoveryManager.recoverIdentity({
|
|
3823
|
+
recoveryCode: request.recoveryCode
|
|
3824
|
+
});
|
|
3825
|
+
} else if (request.external) {
|
|
3826
|
+
await this._recoveryManager.recoverIdentityWithExternalSignature(request.external);
|
|
3827
|
+
} else {
|
|
3828
|
+
throw new Error("Invalid request.");
|
|
3829
|
+
}
|
|
3819
3830
|
return this._getIdentity();
|
|
3820
3831
|
}
|
|
3821
3832
|
// TODO(burdon): Rename createPresentation?
|
|
3822
3833
|
async signPresentation({ presentation, nonce }) {
|
|
3823
3834
|
invariant9(this._identityManager.identity, "Identity not initialized.", {
|
|
3824
3835
|
F: __dxlog_file14,
|
|
3825
|
-
L:
|
|
3836
|
+
L: 116,
|
|
3826
3837
|
S: this,
|
|
3827
3838
|
A: [
|
|
3828
3839
|
"this._identityManager.identity",
|
|
@@ -3841,7 +3852,7 @@ var IdentityServiceImpl = class extends Resource5 {
|
|
|
3841
3852
|
const identity = this._identityManager.identity;
|
|
3842
3853
|
invariant9(identity, "Identity not initialized.", {
|
|
3843
3854
|
F: __dxlog_file14,
|
|
3844
|
-
L:
|
|
3855
|
+
L: 130,
|
|
3845
3856
|
S: this,
|
|
3846
3857
|
A: [
|
|
3847
3858
|
"identity",
|
|
@@ -3879,7 +3890,7 @@ var IdentityServiceImpl = class extends Resource5 {
|
|
|
3879
3890
|
duplicate: space.id
|
|
3880
3891
|
}, {
|
|
3881
3892
|
F: __dxlog_file14,
|
|
3882
|
-
L:
|
|
3893
|
+
L: 164,
|
|
3883
3894
|
S: this,
|
|
3884
3895
|
C: (f, a) => f(...a)
|
|
3885
3896
|
});
|
|
@@ -3893,7 +3904,7 @@ var IdentityServiceImpl = class extends Resource5 {
|
|
|
3893
3904
|
}, (err) => {
|
|
3894
3905
|
log11.catch(err, void 0, {
|
|
3895
3906
|
F: __dxlog_file14,
|
|
3896
|
-
L:
|
|
3907
|
+
L: 175,
|
|
3897
3908
|
S: this,
|
|
3898
3909
|
C: (f, a) => f(...a)
|
|
3899
3910
|
});
|
|
@@ -7148,6 +7159,18 @@ var EdgeAgentManager = class extends Resource6 {
|
|
|
7148
7159
|
haloSpaceKey: this._identity.haloSpaceKey.toHex()
|
|
7149
7160
|
});
|
|
7150
7161
|
const deviceKey = PublicKey13.fromHex(response.deviceKey);
|
|
7162
|
+
if (await this._identity.authorizedDeviceKeys.has(deviceKey)) {
|
|
7163
|
+
log22.info("agent was already added to HALO, ignoring response", {
|
|
7164
|
+
response
|
|
7165
|
+
}, {
|
|
7166
|
+
F: __dxlog_file26,
|
|
7167
|
+
L: 67,
|
|
7168
|
+
S: this,
|
|
7169
|
+
C: (f, a) => f(...a)
|
|
7170
|
+
});
|
|
7171
|
+
this._updateStatus(EdgeAgentStatus.ACTIVE, deviceKey);
|
|
7172
|
+
return;
|
|
7173
|
+
}
|
|
7151
7174
|
await this._identity.admitDevice({
|
|
7152
7175
|
deviceKey,
|
|
7153
7176
|
controlFeedKey: PublicKey13.fromHex(response.feedKey),
|
|
@@ -7156,7 +7179,7 @@ var EdgeAgentManager = class extends Resource6 {
|
|
|
7156
7179
|
});
|
|
7157
7180
|
log22("agent created", response, {
|
|
7158
7181
|
F: __dxlog_file26,
|
|
7159
|
-
L:
|
|
7182
|
+
L: 79,
|
|
7160
7183
|
S: this,
|
|
7161
7184
|
C: (f, a) => f(...a)
|
|
7162
7185
|
});
|
|
@@ -7168,7 +7191,7 @@ var EdgeAgentManager = class extends Resource6 {
|
|
|
7168
7191
|
isEnabled
|
|
7169
7192
|
}, {
|
|
7170
7193
|
F: __dxlog_file26,
|
|
7171
|
-
L:
|
|
7194
|
+
L: 87,
|
|
7172
7195
|
S: this,
|
|
7173
7196
|
C: (f, a) => f(...a)
|
|
7174
7197
|
});
|
|
@@ -7201,7 +7224,7 @@ var EdgeAgentManager = class extends Resource6 {
|
|
|
7201
7224
|
async _fetchAgentStatus() {
|
|
7202
7225
|
invariant18(this._edgeHttpClient, void 0, {
|
|
7203
7226
|
F: __dxlog_file26,
|
|
7204
|
-
L:
|
|
7227
|
+
L: 121,
|
|
7205
7228
|
S: this,
|
|
7206
7229
|
A: [
|
|
7207
7230
|
"this._edgeHttpClient",
|
|
@@ -7211,7 +7234,7 @@ var EdgeAgentManager = class extends Resource6 {
|
|
|
7211
7234
|
try {
|
|
7212
7235
|
log22("fetching agent status", void 0, {
|
|
7213
7236
|
F: __dxlog_file26,
|
|
7214
|
-
L:
|
|
7237
|
+
L: 123,
|
|
7215
7238
|
S: this,
|
|
7216
7239
|
C: (f, a) => f(...a)
|
|
7217
7240
|
});
|
|
@@ -7230,7 +7253,7 @@ var EdgeAgentManager = class extends Resource6 {
|
|
|
7230
7253
|
err
|
|
7231
7254
|
}, {
|
|
7232
7255
|
F: __dxlog_file26,
|
|
7233
|
-
L:
|
|
7256
|
+
L: 133,
|
|
7234
7257
|
S: this,
|
|
7235
7258
|
C: (f, a) => f(...a)
|
|
7236
7259
|
});
|
|
@@ -7243,7 +7266,7 @@ var EdgeAgentManager = class extends Resource6 {
|
|
|
7243
7266
|
retryAfterMs
|
|
7244
7267
|
}, {
|
|
7245
7268
|
F: __dxlog_file26,
|
|
7246
|
-
L:
|
|
7269
|
+
L: 138,
|
|
7247
7270
|
S: this,
|
|
7248
7271
|
C: (f, a) => f(...a)
|
|
7249
7272
|
});
|
|
@@ -7279,7 +7302,7 @@ var EdgeAgentManager = class extends Resource6 {
|
|
|
7279
7302
|
spaceId: space.id
|
|
7280
7303
|
}, {
|
|
7281
7304
|
F: __dxlog_file26,
|
|
7282
|
-
L:
|
|
7305
|
+
L: 165,
|
|
7283
7306
|
S: this,
|
|
7284
7307
|
C: (f, a) => f(...a)
|
|
7285
7308
|
});
|
|
@@ -7299,7 +7322,7 @@ var EdgeAgentManager = class extends Resource6 {
|
|
|
7299
7322
|
status
|
|
7300
7323
|
}, {
|
|
7301
7324
|
F: __dxlog_file26,
|
|
7302
|
-
L:
|
|
7325
|
+
L: 181,
|
|
7303
7326
|
S: this,
|
|
7304
7327
|
C: (f, a) => f(...a)
|
|
7305
7328
|
});
|
|
@@ -7421,7 +7444,7 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7421
7444
|
recoveryCode = generateSeedPhrase();
|
|
7422
7445
|
const keypair = keyPairFromSeedPhrase(recoveryCode);
|
|
7423
7446
|
recoveryKey = PublicKey14.from(keypair.publicKey);
|
|
7424
|
-
algorithm =
|
|
7447
|
+
algorithm = "ED25519";
|
|
7425
7448
|
}
|
|
7426
7449
|
invariant19(algorithm, "Algorithm is required.", {
|
|
7427
7450
|
F: __dxlog_file27,
|
|
@@ -7457,7 +7480,7 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7457
7480
|
recoveryCode
|
|
7458
7481
|
};
|
|
7459
7482
|
}
|
|
7460
|
-
async
|
|
7483
|
+
async requestRecoveryChallenge() {
|
|
7461
7484
|
invariant19(this._edgeClient, "Not connected to EDGE.", {
|
|
7462
7485
|
F: __dxlog_file27,
|
|
7463
7486
|
L: 66,
|
|
@@ -7467,6 +7490,67 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7467
7490
|
"'Not connected to EDGE.'"
|
|
7468
7491
|
]
|
|
7469
7492
|
});
|
|
7493
|
+
const deviceKey = await this._keyring.createKey();
|
|
7494
|
+
const controlFeedKey = await this._keyring.createKey();
|
|
7495
|
+
const request = {
|
|
7496
|
+
deviceKey: deviceKey.toHex(),
|
|
7497
|
+
controlFeedKey: controlFeedKey.toHex()
|
|
7498
|
+
};
|
|
7499
|
+
try {
|
|
7500
|
+
await this._edgeClient.recoverIdentity(request);
|
|
7501
|
+
throw new Error("No challenge received.");
|
|
7502
|
+
} catch (error) {
|
|
7503
|
+
if (!(error instanceof EdgeAuthChallengeError2)) {
|
|
7504
|
+
throw error;
|
|
7505
|
+
}
|
|
7506
|
+
return {
|
|
7507
|
+
deviceKey,
|
|
7508
|
+
controlFeedKey,
|
|
7509
|
+
challenge: error.challenge
|
|
7510
|
+
};
|
|
7511
|
+
}
|
|
7512
|
+
}
|
|
7513
|
+
async recoverIdentityWithExternalSignature({ identityDid, deviceKey, controlFeedKey, signature, clientDataJson, authenticatorData }) {
|
|
7514
|
+
invariant19(this._edgeClient, "Not connected to EDGE.", {
|
|
7515
|
+
F: __dxlog_file27,
|
|
7516
|
+
L: 98,
|
|
7517
|
+
S: this,
|
|
7518
|
+
A: [
|
|
7519
|
+
"this._edgeClient",
|
|
7520
|
+
"'Not connected to EDGE.'"
|
|
7521
|
+
]
|
|
7522
|
+
});
|
|
7523
|
+
const request = {
|
|
7524
|
+
identityDid,
|
|
7525
|
+
deviceKey: deviceKey.toHex(),
|
|
7526
|
+
controlFeedKey: controlFeedKey.toHex(),
|
|
7527
|
+
signature: clientDataJson && authenticatorData ? {
|
|
7528
|
+
signature: Buffer.from(signature).toString("base64"),
|
|
7529
|
+
clientDataJson: Buffer.from(clientDataJson).toString("base64"),
|
|
7530
|
+
authenticatorData: Buffer.from(authenticatorData).toString("base64")
|
|
7531
|
+
} : Buffer.from(signature).toString("base64")
|
|
7532
|
+
};
|
|
7533
|
+
const response = await this._edgeClient.recoverIdentity(request);
|
|
7534
|
+
await this._acceptRecoveredIdentity({
|
|
7535
|
+
authorizedDeviceCredential: decodeCredential(response.deviceAuthCredential),
|
|
7536
|
+
haloGenesisFeedKey: PublicKey14.fromHex(response.genesisFeedKey),
|
|
7537
|
+
haloSpaceKey: PublicKey14.fromHex(response.haloSpaceKey),
|
|
7538
|
+
identityKey: PublicKey14.fromHex(response.identityKey),
|
|
7539
|
+
deviceKey,
|
|
7540
|
+
controlFeedKey,
|
|
7541
|
+
dataFeedKey: await this._keyring.createKey()
|
|
7542
|
+
});
|
|
7543
|
+
}
|
|
7544
|
+
async recoverIdentity({ recoveryCode }) {
|
|
7545
|
+
invariant19(this._edgeClient, "Not connected to EDGE.", {
|
|
7546
|
+
F: __dxlog_file27,
|
|
7547
|
+
L: 128,
|
|
7548
|
+
S: this,
|
|
7549
|
+
A: [
|
|
7550
|
+
"this._edgeClient",
|
|
7551
|
+
"'Not connected to EDGE.'"
|
|
7552
|
+
]
|
|
7553
|
+
});
|
|
7470
7554
|
const recoveryKeypair = keyPairFromSeedPhrase(recoveryCode);
|
|
7471
7555
|
const recoveryKey = PublicKey14.from(recoveryKeypair.publicKey);
|
|
7472
7556
|
const deviceKey = await this._keyring.createKey();
|
|
@@ -7491,7 +7575,7 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7491
7575
|
}
|
|
7492
7576
|
log23.info("recovering identity", response, {
|
|
7493
7577
|
F: __dxlog_file27,
|
|
7494
|
-
L:
|
|
7578
|
+
L: 154,
|
|
7495
7579
|
S: this,
|
|
7496
7580
|
C: (f, a) => f(...a)
|
|
7497
7581
|
});
|
|
@@ -9093,4 +9177,4 @@ export {
|
|
|
9093
9177
|
importProfileData,
|
|
9094
9178
|
ClientServicesHost
|
|
9095
9179
|
};
|
|
9096
|
-
//# sourceMappingURL=chunk-
|
|
9180
|
+
//# sourceMappingURL=chunk-X65X3DJU.mjs.map
|