@dxos/client-services 0.1.56-main.538bda2 → 0.1.56-main.5db35f4
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-Y4AYNWBO.mjs → chunk-FVGGGXU6.mjs} +83 -36
- package/dist/lib/browser/chunk-FVGGGXU6.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +1 -1
- package/dist/lib/node/index.cjs +82 -35
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +82 -35
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- package/dist/types/src/packlets/identity/identity-manager.d.ts +5 -0
- package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-service.d.ts +7 -3
- package/dist/types/src/packlets/identity/identity-service.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +34 -34
- package/src/packlets/identity/identity-manager.test.ts +11 -0
- package/src/packlets/identity/identity-manager.ts +18 -1
- package/src/packlets/identity/identity-service.test.ts +15 -1
- package/src/packlets/identity/identity-service.ts +23 -14
- package/src/packlets/services/service-host.ts +5 -1
- package/src/packlets/spaces/data-space-manager.test.ts +80 -22
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-Y4AYNWBO.mjs.map +0 -7
package/dist/lib/node/index.cjs
CHANGED
|
@@ -692,6 +692,7 @@ var import_keys4 = require("@dxos/keys");
|
|
|
692
692
|
var import_log3 = require("@dxos/log");
|
|
693
693
|
var import_protocols2 = require("@dxos/protocols");
|
|
694
694
|
var import_credentials5 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
695
|
+
var import_timeframe = require("@dxos/timeframe");
|
|
695
696
|
var import_tracing2 = require("@dxos/tracing");
|
|
696
697
|
var import_util2 = require("@dxos/util");
|
|
697
698
|
function _ts_decorate2(decorators, target, key, desc) {
|
|
@@ -916,10 +917,42 @@ var IdentityManager = class IdentityManager2 {
|
|
|
916
917
|
});
|
|
917
918
|
return identity;
|
|
918
919
|
}
|
|
920
|
+
/**
|
|
921
|
+
* Update the profile document of an existing identity.
|
|
922
|
+
*/
|
|
923
|
+
async updateProfile(profile) {
|
|
924
|
+
(0, import_invariant2.invariant)(this._identity, "Identity not initialized.", {
|
|
925
|
+
F: __dxlog_file3,
|
|
926
|
+
L: 200,
|
|
927
|
+
S: this,
|
|
928
|
+
A: [
|
|
929
|
+
"this._identity",
|
|
930
|
+
"'Identity not initialized.'"
|
|
931
|
+
]
|
|
932
|
+
});
|
|
933
|
+
const credential = await this._identity.getIdentityCredentialSigner().createCredential({
|
|
934
|
+
subject: this._identity.identityKey,
|
|
935
|
+
assertion: {
|
|
936
|
+
"@type": "dxos.halo.credentials.IdentityProfile",
|
|
937
|
+
profile
|
|
938
|
+
}
|
|
939
|
+
});
|
|
940
|
+
const receipt = await this._identity.controlPipeline.writer.write({
|
|
941
|
+
credential: {
|
|
942
|
+
credential
|
|
943
|
+
}
|
|
944
|
+
});
|
|
945
|
+
await this._identity.controlPipeline.state.waitUntilTimeframe(new import_timeframe.Timeframe([
|
|
946
|
+
[
|
|
947
|
+
receipt.feedKey,
|
|
948
|
+
receipt.seq
|
|
949
|
+
]
|
|
950
|
+
]));
|
|
951
|
+
}
|
|
919
952
|
async _constructIdentity(identityRecord) {
|
|
920
953
|
(0, import_invariant2.invariant)(!this._identity, void 0, {
|
|
921
954
|
F: __dxlog_file3,
|
|
922
|
-
L:
|
|
955
|
+
L: 214,
|
|
923
956
|
S: this,
|
|
924
957
|
A: [
|
|
925
958
|
"!this._identity",
|
|
@@ -930,13 +963,13 @@ var IdentityManager = class IdentityManager2 {
|
|
|
930
963
|
identityRecord
|
|
931
964
|
}, {
|
|
932
965
|
F: __dxlog_file3,
|
|
933
|
-
L:
|
|
966
|
+
L: 215,
|
|
934
967
|
S: this,
|
|
935
968
|
C: (f, a) => f(...a)
|
|
936
969
|
});
|
|
937
970
|
(0, import_invariant2.invariant)(identityRecord.haloSpace.controlFeedKey, void 0, {
|
|
938
971
|
F: __dxlog_file3,
|
|
939
|
-
L:
|
|
972
|
+
L: 218,
|
|
940
973
|
S: this,
|
|
941
974
|
A: [
|
|
942
975
|
"identityRecord.haloSpace.controlFeedKey",
|
|
@@ -948,7 +981,7 @@ var IdentityManager = class IdentityManager2 {
|
|
|
948
981
|
});
|
|
949
982
|
(0, import_invariant2.invariant)(identityRecord.haloSpace.dataFeedKey, void 0, {
|
|
950
983
|
F: __dxlog_file3,
|
|
951
|
-
L:
|
|
984
|
+
L: 222,
|
|
952
985
|
S: this,
|
|
953
986
|
A: [
|
|
954
987
|
"identityRecord.haloSpace.dataFeedKey",
|
|
@@ -980,7 +1013,7 @@ var IdentityManager = class IdentityManager2 {
|
|
|
980
1013
|
identityKey: identityRecord.identityKey
|
|
981
1014
|
}, {
|
|
982
1015
|
F: __dxlog_file3,
|
|
983
|
-
L:
|
|
1016
|
+
L: 246,
|
|
984
1017
|
S: this,
|
|
985
1018
|
C: (f, a) => f(...a)
|
|
986
1019
|
});
|
|
@@ -1001,7 +1034,7 @@ var IdentityManager = class IdentityManager2 {
|
|
|
1001
1034
|
onAuthFailure: () => {
|
|
1002
1035
|
import_log3.log.warn("auth failure", void 0, {
|
|
1003
1036
|
F: __dxlog_file3,
|
|
1004
|
-
L:
|
|
1037
|
+
L: 265,
|
|
1005
1038
|
S: this,
|
|
1006
1039
|
C: (f, a) => f(...a)
|
|
1007
1040
|
});
|
|
@@ -1024,12 +1057,13 @@ var import_debug2 = require("@dxos/debug");
|
|
|
1024
1057
|
var import_invariant3 = require("@dxos/invariant");
|
|
1025
1058
|
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-service.ts";
|
|
1026
1059
|
var IdentityServiceImpl = class {
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
this.
|
|
1060
|
+
constructor(_createIdentity, _identityManager, _keyring) {
|
|
1061
|
+
this._createIdentity = _createIdentity;
|
|
1062
|
+
this._identityManager = _identityManager;
|
|
1063
|
+
this._keyring = _keyring;
|
|
1030
1064
|
}
|
|
1031
1065
|
async createIdentity(request) {
|
|
1032
|
-
await this.
|
|
1066
|
+
await this._createIdentity(request);
|
|
1033
1067
|
return this._getIdentity();
|
|
1034
1068
|
}
|
|
1035
1069
|
async recoverIdentity(request) {
|
|
@@ -1041,34 +1075,47 @@ var IdentityServiceImpl = class {
|
|
|
1041
1075
|
identity: this._getIdentity()
|
|
1042
1076
|
});
|
|
1043
1077
|
emitNext();
|
|
1044
|
-
return this.
|
|
1078
|
+
return this._identityManager.stateUpdate.on(emitNext);
|
|
1045
1079
|
});
|
|
1046
1080
|
}
|
|
1047
1081
|
_getIdentity() {
|
|
1048
|
-
if (!this.
|
|
1082
|
+
if (!this._identityManager.identity) {
|
|
1049
1083
|
return void 0;
|
|
1050
1084
|
}
|
|
1051
1085
|
return {
|
|
1052
|
-
identityKey: this.
|
|
1053
|
-
spaceKey: this.
|
|
1054
|
-
profile: this.
|
|
1086
|
+
identityKey: this._identityManager.identity.identityKey,
|
|
1087
|
+
spaceKey: this._identityManager.identity.space.key,
|
|
1088
|
+
profile: this._identityManager.identity.profileDocument
|
|
1055
1089
|
};
|
|
1056
1090
|
}
|
|
1091
|
+
async updateProfile(profile) {
|
|
1092
|
+
(0, import_invariant3.invariant)(this._identityManager.identity, "Identity not initialized.", {
|
|
1093
|
+
F: __dxlog_file4,
|
|
1094
|
+
L: 59,
|
|
1095
|
+
S: this,
|
|
1096
|
+
A: [
|
|
1097
|
+
"this._identityManager.identity",
|
|
1098
|
+
"'Identity not initialized.'"
|
|
1099
|
+
]
|
|
1100
|
+
});
|
|
1101
|
+
await this._identityManager.updateProfile(profile);
|
|
1102
|
+
return this._getIdentity();
|
|
1103
|
+
}
|
|
1057
1104
|
async signPresentation({ presentation, nonce }) {
|
|
1058
|
-
(0, import_invariant3.invariant)(this.
|
|
1105
|
+
(0, import_invariant3.invariant)(this._identityManager.identity, "Identity not initialized.", {
|
|
1059
1106
|
F: __dxlog_file4,
|
|
1060
|
-
L:
|
|
1107
|
+
L: 65,
|
|
1061
1108
|
S: this,
|
|
1062
1109
|
A: [
|
|
1063
|
-
"this.
|
|
1110
|
+
"this._identityManager.identity",
|
|
1064
1111
|
"'Identity not initialized.'"
|
|
1065
1112
|
]
|
|
1066
1113
|
});
|
|
1067
1114
|
return await (0, import_credentials6.signPresentation)({
|
|
1068
1115
|
presentation,
|
|
1069
|
-
signer: this.
|
|
1070
|
-
signerKey: this.
|
|
1071
|
-
chain: this.
|
|
1116
|
+
signer: this._keyring,
|
|
1117
|
+
signerKey: this._identityManager.identity.deviceKey,
|
|
1118
|
+
chain: this._identityManager.identity.deviceCredentialChain,
|
|
1072
1119
|
nonce
|
|
1073
1120
|
});
|
|
1074
1121
|
}
|
|
@@ -2472,7 +2519,7 @@ var import_protocols5 = require("@dxos/protocols");
|
|
|
2472
2519
|
var import_services6 = require("@dxos/protocols/proto/dxos/client/services");
|
|
2473
2520
|
|
|
2474
2521
|
// packages/sdk/client-services/src/version.ts
|
|
2475
|
-
var DXOS_VERSION = "0.1.56-main.
|
|
2522
|
+
var DXOS_VERSION = "0.1.56-main.5db35f4";
|
|
2476
2523
|
|
|
2477
2524
|
// packages/sdk/client-services/src/packlets/services/platform.ts
|
|
2478
2525
|
var getPlatform = () => {
|
|
@@ -2660,7 +2707,7 @@ var import_keys8 = require("@dxos/keys");
|
|
|
2660
2707
|
var import_log10 = require("@dxos/log");
|
|
2661
2708
|
var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
|
|
2662
2709
|
var import_credentials10 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
2663
|
-
var
|
|
2710
|
+
var import_timeframe2 = require("@dxos/timeframe");
|
|
2664
2711
|
var import_util4 = require("@dxos/util");
|
|
2665
2712
|
|
|
2666
2713
|
// packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts
|
|
@@ -3168,7 +3215,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3168
3215
|
})
|
|
3169
3216
|
}
|
|
3170
3217
|
});
|
|
3171
|
-
await this.inner.controlPipeline.state.waitUntilTimeframe(new
|
|
3218
|
+
await this.inner.controlPipeline.state.waitUntilTimeframe(new import_timeframe2.Timeframe([
|
|
3172
3219
|
[
|
|
3173
3220
|
receipt.feedKey,
|
|
3174
3221
|
receipt.seq
|
|
@@ -3225,7 +3272,7 @@ DataSpace = _ts_decorate3([
|
|
|
3225
3272
|
var import_credentials11 = require("@dxos/credentials");
|
|
3226
3273
|
var import_debug5 = require("@dxos/debug");
|
|
3227
3274
|
var import_credentials12 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
3228
|
-
var
|
|
3275
|
+
var import_timeframe3 = require("@dxos/timeframe");
|
|
3229
3276
|
var spaceGenesis = async (keyring, signingContext, space) => {
|
|
3230
3277
|
const credentials = [
|
|
3231
3278
|
await (0, import_credentials11.createCredential)({
|
|
@@ -3275,7 +3322,7 @@ var spaceGenesis = async (keyring, signingContext, space) => {
|
|
|
3275
3322
|
"@type": "dxos.halo.credentials.Epoch",
|
|
3276
3323
|
number: 0,
|
|
3277
3324
|
previousId: void 0,
|
|
3278
|
-
timeframe: new
|
|
3325
|
+
timeframe: new import_timeframe3.Timeframe(),
|
|
3279
3326
|
snapshotCid: void 0
|
|
3280
3327
|
}
|
|
3281
3328
|
})
|
|
@@ -4656,7 +4703,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4656
4703
|
this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._modelFactory);
|
|
4657
4704
|
this._serviceRegistry.setServices({
|
|
4658
4705
|
SystemService: this._systemService,
|
|
4659
|
-
IdentityService: new IdentityServiceImpl(this._serviceContext),
|
|
4706
|
+
IdentityService: new IdentityServiceImpl((params) => this._serviceContext.createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring),
|
|
4660
4707
|
InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitations, (invitation) => this._serviceContext.getInvitationHandler(invitation)),
|
|
4661
4708
|
DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
|
|
4662
4709
|
SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, this._serviceContext.dataServiceSubscriptions, async () => {
|
|
@@ -4683,7 +4730,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4683
4730
|
deviceKey
|
|
4684
4731
|
}, {
|
|
4685
4732
|
F: __dxlog_file17,
|
|
4686
|
-
L:
|
|
4733
|
+
L: 284,
|
|
4687
4734
|
S: this,
|
|
4688
4735
|
C: (f, a) => f(...a)
|
|
4689
4736
|
});
|
|
@@ -4691,7 +4738,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4691
4738
|
id: traceId
|
|
4692
4739
|
}), {
|
|
4693
4740
|
F: __dxlog_file17,
|
|
4694
|
-
L:
|
|
4741
|
+
L: 285,
|
|
4695
4742
|
S: this,
|
|
4696
4743
|
C: (f, a) => f(...a)
|
|
4697
4744
|
});
|
|
@@ -4705,7 +4752,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4705
4752
|
deviceKey
|
|
4706
4753
|
}, {
|
|
4707
4754
|
F: __dxlog_file17,
|
|
4708
|
-
L:
|
|
4755
|
+
L: 296,
|
|
4709
4756
|
S: this,
|
|
4710
4757
|
C: (f, a) => f(...a)
|
|
4711
4758
|
});
|
|
@@ -4720,7 +4767,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4720
4767
|
deviceKey
|
|
4721
4768
|
}, {
|
|
4722
4769
|
F: __dxlog_file17,
|
|
4723
|
-
L:
|
|
4770
|
+
L: 302,
|
|
4724
4771
|
S: this,
|
|
4725
4772
|
C: (f, a) => f(...a)
|
|
4726
4773
|
});
|
|
@@ -4731,13 +4778,13 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4731
4778
|
id: traceId
|
|
4732
4779
|
}), {
|
|
4733
4780
|
F: __dxlog_file17,
|
|
4734
|
-
L:
|
|
4781
|
+
L: 307,
|
|
4735
4782
|
S: this,
|
|
4736
4783
|
C: (f, a) => f(...a)
|
|
4737
4784
|
});
|
|
4738
4785
|
(0, import_log16.log)("resetting...", void 0, {
|
|
4739
4786
|
F: __dxlog_file17,
|
|
4740
|
-
L:
|
|
4787
|
+
L: 309,
|
|
4741
4788
|
S: this,
|
|
4742
4789
|
C: (f, a) => f(...a)
|
|
4743
4790
|
});
|
|
@@ -4745,7 +4792,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4745
4792
|
await this._storage.reset();
|
|
4746
4793
|
(0, import_log16.log)("reset", void 0, {
|
|
4747
4794
|
F: __dxlog_file17,
|
|
4748
|
-
L:
|
|
4795
|
+
L: 312,
|
|
4749
4796
|
S: this,
|
|
4750
4797
|
C: (f, a) => f(...a)
|
|
4751
4798
|
});
|
|
@@ -4753,7 +4800,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4753
4800
|
id: traceId
|
|
4754
4801
|
}), {
|
|
4755
4802
|
F: __dxlog_file17,
|
|
4756
|
-
L:
|
|
4803
|
+
L: 313,
|
|
4757
4804
|
S: this,
|
|
4758
4805
|
C: (f, a) => f(...a)
|
|
4759
4806
|
});
|