@dxos/client-services 0.3.2-main.4164ba3 → 0.3.2-main.428886c

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.
Files changed (27) hide show
  1. package/dist/lib/browser/{chunk-TI3I2ZZI.mjs → chunk-7ILC5J66.mjs} +141 -78
  2. package/dist/lib/browser/chunk-7ILC5J66.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +1 -1
  4. package/dist/lib/browser/meta.json +1 -1
  5. package/dist/lib/browser/packlets/testing/index.mjs +1 -1
  6. package/dist/lib/node/index.cjs +200 -137
  7. package/dist/lib/node/index.cjs.map +3 -3
  8. package/dist/lib/node/meta.json +1 -1
  9. package/dist/lib/node/packlets/testing/index.cjs +174 -111
  10. package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
  11. package/dist/types/src/packlets/devices/devices-service.d.ts +1 -1
  12. package/dist/types/src/packlets/devices/devices-service.d.ts.map +1 -1
  13. package/dist/types/src/packlets/identity/identity-manager.d.ts +4 -0
  14. package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
  15. package/dist/types/src/packlets/identity/identity.d.ts +2 -2
  16. package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
  17. package/dist/types/src/packlets/invitations/invitations-service.d.ts.map +1 -1
  18. package/dist/types/src/version.d.ts +1 -1
  19. package/package.json +35 -35
  20. package/src/packlets/devices/devices-service.ts +16 -3
  21. package/src/packlets/identity/identity-manager.test.ts +11 -0
  22. package/src/packlets/identity/identity-manager.ts +20 -0
  23. package/src/packlets/identity/identity.test.ts +2 -2
  24. package/src/packlets/identity/identity.ts +5 -3
  25. package/src/packlets/invitations/invitations-service.ts +0 -2
  26. package/src/version.ts +1 -1
  27. package/dist/lib/browser/chunk-TI3I2ZZI.mjs.map +0 -7
@@ -460,9 +460,11 @@ import { DeviceStateMachine, createCredentialSignerWithKey, createCredentialSign
460
460
  import { failUndefined } from "@dxos/debug";
461
461
  import { writeMessages } from "@dxos/feed-store";
462
462
  import { invariant } from "@dxos/invariant";
463
+ import { PublicKey as PublicKey3 } from "@dxos/keys";
463
464
  import { log as log2 } from "@dxos/log";
464
465
  import { AdmittedFeed } from "@dxos/protocols/proto/dxos/halo/credentials";
465
466
  import { trace } from "@dxos/tracing";
467
+ import { ComplexSet } from "@dxos/util";
466
468
  function _ts_decorate(decorators, target, key, desc) {
467
469
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
468
470
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -481,6 +483,14 @@ var Identity = class Identity2 {
481
483
  this._signer = signer;
482
484
  this.identityKey = identityKey;
483
485
  this.deviceKey = deviceKey;
486
+ log2.trace("dxos.halo.device", {
487
+ deviceKey
488
+ }, {
489
+ F: __dxlog_file2,
490
+ L: 60,
491
+ S: this,
492
+ C: (f, a) => f(...a)
493
+ });
484
494
  this._deviceStateMachine = new DeviceStateMachine({
485
495
  identityKey: this.identityKey,
486
496
  deviceKey: this.deviceKey,
@@ -491,7 +501,7 @@ var Identity = class Identity2 {
491
501
  onUpdate: () => this.stateUpdate.emit()
492
502
  });
493
503
  this.authVerifier = new TrustedKeySetAuthVerifier({
494
- trustedKeysProvider: () => this.authorizedDeviceKeys,
504
+ trustedKeysProvider: () => new ComplexSet(PublicKey3.hash, this.authorizedDeviceKeys.keys()),
495
505
  update: this.stateUpdate,
496
506
  authTimeout: AUTH_TIMEOUT
497
507
  });
@@ -549,7 +559,7 @@ var Identity = class Identity2 {
549
559
  getIdentityCredentialSigner() {
550
560
  invariant(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.", {
551
561
  F: __dxlog_file2,
552
- L: 139,
562
+ L: 141,
553
563
  S: this,
554
564
  A: [
555
565
  "this._deviceStateMachine.deviceCredentialChain",
@@ -573,7 +583,7 @@ var Identity = class Identity2 {
573
583
  dataFeedKey
574
584
  }, {
575
585
  F: __dxlog_file2,
576
- L: 155,
586
+ L: 157,
577
587
  S: this,
578
588
  C: (f, a) => f(...a)
579
589
  });
@@ -629,7 +639,7 @@ import { Event as Event2 } from "@dxos/async";
629
639
  import { Context as Context3 } from "@dxos/context";
630
640
  import { createCredentialSignerWithKey as createCredentialSignerWithKey2, CredentialGenerator } from "@dxos/credentials";
631
641
  import { invariant as invariant2 } from "@dxos/invariant";
632
- import { PublicKey as PublicKey3 } from "@dxos/keys";
642
+ import { PublicKey as PublicKey4 } from "@dxos/keys";
633
643
  import { log as log3 } from "@dxos/log";
634
644
  import { trace as trace2 } from "@dxos/protocols";
635
645
  import { AdmittedFeed as AdmittedFeed2 } from "@dxos/protocols/proto/dxos/halo/credentials";
@@ -661,7 +671,7 @@ var IdentityManager = class IdentityManager2 {
661
671
  return this._identity;
662
672
  }
663
673
  async open(ctx) {
664
- const traceId = PublicKey3.random().toHex();
674
+ const traceId = PublicKey4.random().toHex();
665
675
  log3.trace("dxos.halo.identity-manager.open", trace2.begin({
666
676
  id: traceId
667
677
  }), {
@@ -891,10 +901,51 @@ var IdentityManager = class IdentityManager2 {
891
901
  this.stateUpdate.emit();
892
902
  return profile;
893
903
  }
904
+ async updateDevice({ deviceKey, profile }) {
905
+ invariant2(this._identity, "Identity not initialized.", {
906
+ F: __dxlog_file3,
907
+ L: 216,
908
+ S: this,
909
+ A: [
910
+ "this._identity",
911
+ "'Identity not initialized.'"
912
+ ]
913
+ });
914
+ invariant2(this._identity.authorizedDeviceKeys.has(deviceKey), "Device not authorized.", {
915
+ F: __dxlog_file3,
916
+ L: 218,
917
+ S: this,
918
+ A: [
919
+ "this._identity.authorizedDeviceKeys.has(deviceKey)",
920
+ "'Device not authorized.'"
921
+ ]
922
+ });
923
+ const credential = await this._identity.getIdentityCredentialSigner().createCredential({
924
+ subject: this._identity.identityKey,
925
+ assertion: {
926
+ "@type": "dxos.halo.credentials.DeviceProfile",
927
+ deviceKey,
928
+ profile
929
+ }
930
+ });
931
+ const receipt = await this._identity.controlPipeline.writer.write({
932
+ credential: {
933
+ credential
934
+ }
935
+ });
936
+ await this._identity.controlPipeline.state.waitUntilTimeframe(new Timeframe([
937
+ [
938
+ receipt.feedKey,
939
+ receipt.seq
940
+ ]
941
+ ]));
942
+ this.stateUpdate.emit();
943
+ return profile;
944
+ }
894
945
  async _constructIdentity(identityRecord) {
895
946
  invariant2(!this._identity, void 0, {
896
947
  F: __dxlog_file3,
897
- L: 216,
948
+ L: 236,
898
949
  S: this,
899
950
  A: [
900
951
  "!this._identity",
@@ -905,13 +956,13 @@ var IdentityManager = class IdentityManager2 {
905
956
  identityRecord
906
957
  }, {
907
958
  F: __dxlog_file3,
908
- L: 217,
959
+ L: 237,
909
960
  S: this,
910
961
  C: (f, a) => f(...a)
911
962
  });
912
963
  invariant2(identityRecord.haloSpace.controlFeedKey, void 0, {
913
964
  F: __dxlog_file3,
914
- L: 220,
965
+ L: 240,
915
966
  S: this,
916
967
  A: [
917
968
  "identityRecord.haloSpace.controlFeedKey",
@@ -923,7 +974,7 @@ var IdentityManager = class IdentityManager2 {
923
974
  });
924
975
  invariant2(identityRecord.haloSpace.dataFeedKey, void 0, {
925
976
  F: __dxlog_file3,
926
- L: 224,
977
+ L: 244,
927
978
  S: this,
928
979
  A: [
929
980
  "identityRecord.haloSpace.dataFeedKey",
@@ -955,7 +1006,7 @@ var IdentityManager = class IdentityManager2 {
955
1006
  identityKey: identityRecord.identityKey
956
1007
  }, {
957
1008
  F: __dxlog_file3,
958
- L: 248,
1009
+ L: 268,
959
1010
  S: this,
960
1011
  C: (f, a) => f(...a)
961
1012
  });
@@ -976,7 +1027,7 @@ var IdentityManager = class IdentityManager2 {
976
1027
  onAuthFailure: () => {
977
1028
  log3.warn("auth failure", void 0, {
978
1029
  F: __dxlog_file3,
979
- L: 267,
1030
+ L: 287,
980
1031
  S: this,
981
1032
  C: (f, a) => f(...a)
982
1033
  });
@@ -1161,7 +1212,7 @@ import { AuthenticatingInvitation, AUTHENTICATION_CODE_LENGTH, CancellableInvita
1161
1212
  import { Context as Context5 } from "@dxos/context";
1162
1213
  import { generatePasscode } from "@dxos/credentials";
1163
1214
  import { invariant as invariant6 } from "@dxos/invariant";
1164
- import { PublicKey as PublicKey5 } from "@dxos/keys";
1215
+ import { PublicKey as PublicKey6 } from "@dxos/keys";
1165
1216
  import { log as log5 } from "@dxos/log";
1166
1217
  import { createTeleportProtocolFactory, StarTopology } from "@dxos/network-manager";
1167
1218
  import { InvalidInvitationExtensionRoleError as InvalidInvitationExtensionRoleError2, trace as trace4 } from "@dxos/protocols";
@@ -1172,7 +1223,7 @@ import { AuthenticationResponse as AuthenticationResponse2 } from "@dxos/protoco
1172
1223
  import { Trigger as Trigger2 } from "@dxos/async";
1173
1224
  import { cancelWithContext, Context as Context4 } from "@dxos/context";
1174
1225
  import { invariant as invariant5 } from "@dxos/invariant";
1175
- import { PublicKey as PublicKey4 } from "@dxos/keys";
1226
+ import { PublicKey as PublicKey5 } from "@dxos/keys";
1176
1227
  import { log as log4 } from "@dxos/log";
1177
1228
  import { InvalidInvitationExtensionRoleError, schema as schema2, trace as trace3 } from "@dxos/protocols";
1178
1229
  import { Invitation as Invitation2 } from "@dxos/protocols/proto/dxos/client/services";
@@ -1220,7 +1271,7 @@ var InvitationHostExtension = class extends RpcExtension {
1220
1271
  },
1221
1272
  introduce: async (request) => {
1222
1273
  const { profile, invitationId } = request;
1223
- const traceId = PublicKey4.random().toHex();
1274
+ const traceId = PublicKey5.random().toHex();
1224
1275
  log4.trace("dxos.sdk.invitation-handler.host.introduce", trace3.begin({
1225
1276
  id: traceId
1226
1277
  }), {
@@ -1272,7 +1323,7 @@ var InvitationHostExtension = class extends RpcExtension {
1272
1323
  };
1273
1324
  },
1274
1325
  authenticate: async ({ authCode: code }) => {
1275
- const traceId = PublicKey4.random().toHex();
1326
+ const traceId = PublicKey5.random().toHex();
1276
1327
  log4.trace("dxos.sdk.invitation-handler.host.authenticate", trace3.begin({
1277
1328
  id: traceId
1278
1329
  }), {
@@ -1352,7 +1403,7 @@ var InvitationHostExtension = class extends RpcExtension {
1352
1403
  };
1353
1404
  },
1354
1405
  admit: async (request) => {
1355
- const traceId = PublicKey4.random().toHex();
1406
+ const traceId = PublicKey5.random().toHex();
1356
1407
  log4.trace("dxos.sdk.invitation-handler.host.admit", trace3.begin({
1357
1408
  id: traceId
1358
1409
  }), {
@@ -1518,7 +1569,7 @@ var InvitationsHandler = class {
1518
1569
  this._networkManager = _networkManager;
1519
1570
  }
1520
1571
  createInvitation(protocol, options) {
1521
- const { invitationId = PublicKey5.random().toHex(), type = Invitation3.Type.INTERACTIVE, authMethod = Invitation3.AuthMethod.SHARED_SECRET, state = Invitation3.State.INIT, timeout = INVITATION_TIMEOUT, swarmKey = PublicKey5.random() } = options ?? {};
1572
+ const { invitationId = PublicKey6.random().toHex(), type = Invitation3.Type.INTERACTIVE, authMethod = Invitation3.AuthMethod.SHARED_SECRET, state = Invitation3.State.INIT, timeout = INVITATION_TIMEOUT, swarmKey = PublicKey6.random() } = options ?? {};
1522
1573
  const authCode = options?.authCode ?? (authMethod === Invitation3.AuthMethod.SHARED_SECRET ? generatePasscode(AUTHENTICATION_CODE_LENGTH) : void 0);
1523
1574
  invariant6(protocol, void 0, {
1524
1575
  F: __dxlog_file7,
@@ -1593,7 +1644,7 @@ var InvitationsHandler = class {
1593
1644
  },
1594
1645
  onOpen: () => {
1595
1646
  scheduleTask2(ctx, async () => {
1596
- const traceId = PublicKey5.random().toHex();
1647
+ const traceId = PublicKey6.random().toHex();
1597
1648
  try {
1598
1649
  log5.trace("dxos.sdk.invitations-handler.host.onOpen", trace4.begin({
1599
1650
  id: traceId
@@ -1826,7 +1877,7 @@ var InvitationsHandler = class {
1826
1877
  }
1827
1878
  });
1828
1879
  scheduleTask2(ctx, async () => {
1829
- const traceId = PublicKey5.random().toHex();
1880
+ const traceId = PublicKey6.random().toHex();
1830
1881
  try {
1831
1882
  log5.trace("dxos.sdk.invitations-handler.guest.onOpen", trace4.begin({
1832
1883
  id: traceId
@@ -2033,7 +2084,7 @@ var InvitationsHandler = class {
2033
2084
  const topic = invitation.swarmKey;
2034
2085
  const swarmConnection = await this._networkManager.joinSwarm({
2035
2086
  topic,
2036
- peerId: PublicKey5.random(),
2087
+ peerId: PublicKey6.random(),
2037
2088
  protocolProvider: createTeleportProtocolFactory(async (teleport) => {
2038
2089
  teleport.addExtension("dxos.halo.invitations", createExtension());
2039
2090
  }),
@@ -2190,15 +2241,6 @@ var InvitationsServiceImpl = class {
2190
2241
  await accepted.cancel();
2191
2242
  this._acceptInvitations.delete(invitationId);
2192
2243
  this._removedAccepted.emit(accepted.get());
2193
- } else {
2194
- log6.warn("invalid invitation", {
2195
- invitationId
2196
- }, {
2197
- F: __dxlog_file8,
2198
- L: 132,
2199
- S: this,
2200
- C: (f, a) => f(...a)
2201
- });
2202
2244
  }
2203
2245
  }
2204
2246
  queryInvitations() {
@@ -2498,7 +2540,7 @@ var getPlatform = () => {
2498
2540
  };
2499
2541
 
2500
2542
  // packages/sdk/client-services/src/version.ts
2501
- var DXOS_VERSION = "0.3.2-main.4164ba3";
2543
+ var DXOS_VERSION = "0.3.2-main.428886c";
2502
2544
 
2503
2545
  // packages/sdk/client-services/src/packlets/services/diagnostics.ts
2504
2546
  var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
@@ -2624,24 +2666,24 @@ import { AUTH_TIMEOUT as AUTH_TIMEOUT2 } from "@dxos/client-protocol";
2624
2666
  import { cancelWithContext as cancelWithContext2, Context as Context7 } from "@dxos/context";
2625
2667
  import { timed } from "@dxos/debug";
2626
2668
  import { createMappedFeedWriter } from "@dxos/echo-pipeline";
2627
- import { PublicKey as PublicKey7 } from "@dxos/keys";
2669
+ import { PublicKey as PublicKey8 } from "@dxos/keys";
2628
2670
  import { log as log10 } from "@dxos/log";
2629
2671
  import { CancelledError, SystemError } from "@dxos/protocols";
2630
2672
  import { SpaceState } from "@dxos/protocols/proto/dxos/client/services";
2631
2673
  import { AdmittedFeed as AdmittedFeed3 } from "@dxos/protocols/proto/dxos/halo/credentials";
2632
2674
  import { Timeframe as Timeframe2 } from "@dxos/timeframe";
2633
2675
  import { trace as trace5 } from "@dxos/tracing";
2634
- import { ComplexSet as ComplexSet2 } from "@dxos/util";
2676
+ import { ComplexSet as ComplexSet3 } from "@dxos/util";
2635
2677
 
2636
2678
  // packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts
2637
2679
  import { DeferredTask, Event as Event4, scheduleTask as scheduleTask3, sleep, TimeoutError as TimeoutError2, Trigger as Trigger4 } from "@dxos/async";
2638
2680
  import { Context as Context6, rejectOnDispose } from "@dxos/context";
2639
2681
  import { invariant as invariant10 } from "@dxos/invariant";
2640
- import { PublicKey as PublicKey6 } from "@dxos/keys";
2682
+ import { PublicKey as PublicKey7 } from "@dxos/keys";
2641
2683
  import { log as log9 } from "@dxos/log";
2642
2684
  import { schema as schema3 } from "@dxos/protocols";
2643
2685
  import { RpcExtension as RpcExtension2 } from "@dxos/teleport";
2644
- import { ComplexMap as ComplexMap2, ComplexSet, entry } from "@dxos/util";
2686
+ import { ComplexMap as ComplexMap2, ComplexSet as ComplexSet2, entry } from "@dxos/util";
2645
2687
  var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
2646
2688
  var DEFAULT_RETRY_TIMEOUT = 1e3;
2647
2689
  var DEFAULT_SUCCESS_DELAY = 1e3;
@@ -2652,8 +2694,8 @@ var NotarizationPlugin = class {
2652
2694
  this._ctx = new Context6();
2653
2695
  this._extensionOpened = new Event4();
2654
2696
  this._extensions = /* @__PURE__ */ new Set();
2655
- this._processedCredentials = new ComplexSet(PublicKey6.hash);
2656
- this._processCredentialsTriggers = new ComplexMap2(PublicKey6.hash);
2697
+ this._processedCredentials = new ComplexSet2(PublicKey7.hash);
2698
+ this._processCredentialsTriggers = new ComplexMap2(PublicKey7.hash);
2657
2699
  }
2658
2700
  get hasWriter() {
2659
2701
  return !!this._writer;
@@ -2935,7 +2977,7 @@ var DataSpace = class DataSpace2 {
2935
2977
  this._signingContext = params.signingContext;
2936
2978
  this._callbacks = params.callbacks ?? {};
2937
2979
  this.authVerifier = new TrustedKeySetAuthVerifier({
2938
- trustedKeysProvider: () => new ComplexSet2(PublicKey7.hash, Array.from(this._inner.spaceState.members.values()).filter((member) => !member.removed).map((member) => member.key)),
2980
+ trustedKeysProvider: () => new ComplexSet3(PublicKey8.hash, Array.from(this._inner.spaceState.members.values()).filter((member) => !member.removed).map((member) => member.key)),
2939
2981
  update: this._inner.stateUpdate,
2940
2982
  authTimeout: AUTH_TIMEOUT2
2941
2983
  });
@@ -3268,7 +3310,7 @@ import { Event as Event6, synchronized as synchronized2, trackLeaks as trackLeak
3268
3310
  import { cancelWithContext as cancelWithContext3, Context as Context8 } from "@dxos/context";
3269
3311
  import { getCredentialAssertion as getCredentialAssertion2 } from "@dxos/credentials";
3270
3312
  import { invariant as invariant11 } from "@dxos/invariant";
3271
- import { PublicKey as PublicKey8 } from "@dxos/keys";
3313
+ import { PublicKey as PublicKey9 } from "@dxos/keys";
3272
3314
  import { log as log11 } from "@dxos/log";
3273
3315
  import { trace as trace6 } from "@dxos/protocols";
3274
3316
  import { SpaceState as SpaceState2 } from "@dxos/protocols/proto/dxos/client/services";
@@ -3366,9 +3408,9 @@ var DataSpaceManager = class DataSpaceManager2 {
3366
3408
  this._feedStore = _feedStore;
3367
3409
  this._ctx = new Context8();
3368
3410
  this.updated = new Event6();
3369
- this._spaces = new ComplexMap3(PublicKey8.hash);
3411
+ this._spaces = new ComplexMap3(PublicKey9.hash);
3370
3412
  this._isOpen = false;
3371
- this._instanceId = PublicKey8.random().toHex();
3413
+ this._instanceId = PublicKey9.random().toHex();
3372
3414
  }
3373
3415
  // TODO(burdon): Remove.
3374
3416
  get spaces() {
@@ -3907,7 +3949,7 @@ import { valueEncoding, MetadataStore, SpaceManager, DataServiceSubscriptions, S
3907
3949
  import { FeedFactory, FeedStore } from "@dxos/feed-store";
3908
3950
  import { invariant as invariant13 } from "@dxos/invariant";
3909
3951
  import { Keyring } from "@dxos/keyring";
3910
- import { PublicKey as PublicKey9 } from "@dxos/keys";
3952
+ import { PublicKey as PublicKey10 } from "@dxos/keys";
3911
3953
  import { log as log13 } from "@dxos/log";
3912
3954
  import { InvalidStorageVersionError, STORAGE_VERSION as STORAGE_VERSION2, trace as trace7 } from "@dxos/protocols";
3913
3955
  import { Invitation as Invitation6 } from "@dxos/protocols/proto/dxos/client/services";
@@ -3934,7 +3976,7 @@ var ServiceContext = class ServiceContext2 {
3934
3976
  this.initialized = new Trigger5();
3935
3977
  this.dataServiceSubscriptions = new DataServiceSubscriptions();
3936
3978
  this._handlerFactories = /* @__PURE__ */ new Map();
3937
- this._instanceId = PublicKey9.random().toHex();
3979
+ this._instanceId = PublicKey10.random().toHex();
3938
3980
  this.metadataStore = new MetadataStore(storage.createDirectory("metadata"));
3939
3981
  this.snapshotStore = new SnapshotStore(storage.createDirectory("snapshots"));
3940
3982
  this.blobStore = new BlobStore(storage.createDirectory("blobs"));
@@ -4363,8 +4405,8 @@ import { Context as Context10 } from "@dxos/context";
4363
4405
  import { DocumentModel as DocumentModel2 } from "@dxos/document-model";
4364
4406
  import { DataServiceImpl } from "@dxos/echo-pipeline";
4365
4407
  import { base } from "@dxos/echo-schema";
4366
- import { invariant as invariant14 } from "@dxos/invariant";
4367
- import { PublicKey as PublicKey10 } from "@dxos/keys";
4408
+ import { invariant as invariant15 } from "@dxos/invariant";
4409
+ import { PublicKey as PublicKey11 } from "@dxos/keys";
4368
4410
  import { log as log16 } from "@dxos/log";
4369
4411
  import { WebsocketSignalManager } from "@dxos/messaging";
4370
4412
  import { ModelFactory } from "@dxos/model-factory";
@@ -4378,13 +4420,33 @@ import { WebsocketRpcClient } from "@dxos/websocket-rpc";
4378
4420
  // packages/sdk/client-services/src/packlets/devices/devices-service.ts
4379
4421
  import { EventSubscriptions as EventSubscriptions3 } from "@dxos/async";
4380
4422
  import { Stream as Stream11 } from "@dxos/codec-protobuf";
4423
+ import { invariant as invariant14 } from "@dxos/invariant";
4381
4424
  import { DeviceKind } from "@dxos/protocols/proto/dxos/client/services";
4425
+ var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
4382
4426
  var DevicesServiceImpl = class {
4383
4427
  constructor(_identityManager) {
4384
4428
  this._identityManager = _identityManager;
4385
4429
  }
4386
- updateDevice(request) {
4387
- throw new Error("Method not implemented.");
4430
+ async updateDevice(profile) {
4431
+ invariant14(this._identityManager.identity, "Identity not initialized", {
4432
+ F: __dxlog_file17,
4433
+ L: 17,
4434
+ S: this,
4435
+ A: [
4436
+ "this._identityManager.identity",
4437
+ "'Identity not initialized'"
4438
+ ]
4439
+ });
4440
+ const deviceKey = this._identityManager.identity.deviceKey;
4441
+ await this._identityManager.updateDevice({
4442
+ deviceKey,
4443
+ profile
4444
+ });
4445
+ return {
4446
+ deviceKey,
4447
+ kind: DeviceKind.CURRENT,
4448
+ profile
4449
+ };
4388
4450
  }
4389
4451
  queryDevices() {
4390
4452
  return new Stream11(({ next }) => {
@@ -4396,9 +4458,10 @@ var DevicesServiceImpl = class {
4396
4458
  });
4397
4459
  } else {
4398
4460
  next({
4399
- devices: Array.from(deviceKeys.values()).map((key) => ({
4461
+ devices: Array.from(deviceKeys.entries()).map(([key, profile]) => ({
4400
4462
  deviceKey: key,
4401
- kind: this._identityManager.identity?.deviceKey.equals(key) ? DeviceKind.CURRENT : DeviceKind.TRUSTED
4463
+ kind: this._identityManager.identity?.deviceKey.equals(key) ? DeviceKind.CURRENT : DeviceKind.TRUSTED,
4464
+ profile
4402
4465
  }))
4403
4466
  });
4404
4467
  }
@@ -4632,7 +4695,7 @@ function _ts_decorate7(decorators, target, key, desc) {
4632
4695
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4633
4696
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4634
4697
  }
4635
- var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
4698
+ var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
4636
4699
  var createDefaultModelFactory = () => {
4637
4700
  return new ModelFactory().registerModel(DocumentModel2).registerModel(TextModel);
4638
4701
  };
@@ -4732,8 +4795,8 @@ var ClientServicesHost = class ClientServicesHost2 {
4732
4795
  * Can only be called once.
4733
4796
  */
4734
4797
  initialize({ config, ...options }) {
4735
- invariant14(!this._open, "service host is open", {
4736
- F: __dxlog_file17,
4798
+ invariant15(!this._open, "service host is open", {
4799
+ F: __dxlog_file18,
4737
4800
  L: 201,
4738
4801
  S: this,
4739
4802
  A: [
@@ -4742,14 +4805,14 @@ var ClientServicesHost = class ClientServicesHost2 {
4742
4805
  ]
4743
4806
  });
4744
4807
  log16("initializing...", void 0, {
4745
- F: __dxlog_file17,
4808
+ F: __dxlog_file18,
4746
4809
  L: 202,
4747
4810
  S: this,
4748
4811
  C: (f, a) => f(...a)
4749
4812
  });
4750
4813
  if (config) {
4751
- invariant14(!this._config, "config already set", {
4752
- F: __dxlog_file17,
4814
+ invariant15(!this._config, "config already set", {
4815
+ F: __dxlog_file18,
4753
4816
  L: 205,
4754
4817
  S: this,
4755
4818
  A: [
@@ -4766,8 +4829,8 @@ var ClientServicesHost = class ClientServicesHost2 {
4766
4829
  iceServers: this._config?.get("runtime.services.ice")
4767
4830
  }), signalManager = new WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
4768
4831
  this._signalManager = signalManager;
4769
- invariant14(!this._networkManager, "network manager already set", {
4770
- F: __dxlog_file17,
4832
+ invariant15(!this._networkManager, "network manager already set", {
4833
+ F: __dxlog_file18,
4771
4834
  L: 221,
4772
4835
  S: this,
4773
4836
  A: [
@@ -4781,7 +4844,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4781
4844
  signalManager
4782
4845
  });
4783
4846
  log16("initialized", void 0, {
4784
- F: __dxlog_file17,
4847
+ F: __dxlog_file18,
4785
4848
  L: 228,
4786
4849
  S: this,
4787
4850
  C: (f, a) => f(...a)
@@ -4791,17 +4854,17 @@ var ClientServicesHost = class ClientServicesHost2 {
4791
4854
  if (this._open) {
4792
4855
  return;
4793
4856
  }
4794
- const traceId = PublicKey10.random().toHex();
4857
+ const traceId = PublicKey11.random().toHex();
4795
4858
  log16.trace("dxos.client-services.host.open", trace8.begin({
4796
4859
  id: traceId
4797
4860
  }), {
4798
- F: __dxlog_file17,
4861
+ F: __dxlog_file18,
4799
4862
  L: 239,
4800
4863
  S: this,
4801
4864
  C: (f, a) => f(...a)
4802
4865
  });
4803
- invariant14(this._config, "config not set", {
4804
- F: __dxlog_file17,
4866
+ invariant15(this._config, "config not set", {
4867
+ F: __dxlog_file18,
4805
4868
  L: 241,
4806
4869
  S: this,
4807
4870
  A: [
@@ -4809,8 +4872,8 @@ var ClientServicesHost = class ClientServicesHost2 {
4809
4872
  "'config not set'"
4810
4873
  ]
4811
4874
  });
4812
- invariant14(this._storage, "storage not set", {
4813
- F: __dxlog_file17,
4875
+ invariant15(this._storage, "storage not set", {
4876
+ F: __dxlog_file18,
4814
4877
  L: 242,
4815
4878
  S: this,
4816
4879
  A: [
@@ -4818,8 +4881,8 @@ var ClientServicesHost = class ClientServicesHost2 {
4818
4881
  "'storage not set'"
4819
4882
  ]
4820
4883
  });
4821
- invariant14(this._signalManager, "signal manager not set", {
4822
- F: __dxlog_file17,
4884
+ invariant15(this._signalManager, "signal manager not set", {
4885
+ F: __dxlog_file18,
4823
4886
  L: 243,
4824
4887
  S: this,
4825
4888
  A: [
@@ -4827,8 +4890,8 @@ var ClientServicesHost = class ClientServicesHost2 {
4827
4890
  "'signal manager not set'"
4828
4891
  ]
4829
4892
  });
4830
- invariant14(this._networkManager, "network manager not set", {
4831
- F: __dxlog_file17,
4893
+ invariant15(this._networkManager, "network manager not set", {
4894
+ F: __dxlog_file18,
4832
4895
  L: 244,
4833
4896
  S: this,
4834
4897
  A: [
@@ -4840,7 +4903,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4840
4903
  log16("opening...", {
4841
4904
  lockKey: this._resourceLock?.lockKey
4842
4905
  }, {
4843
- F: __dxlog_file17,
4906
+ F: __dxlog_file18,
4844
4907
  L: 247,
4845
4908
  S: this,
4846
4909
  C: (f, a) => f(...a)
@@ -4886,7 +4949,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4886
4949
  log16("opened", {
4887
4950
  deviceKey
4888
4951
  }, {
4889
- F: __dxlog_file17,
4952
+ F: __dxlog_file18,
4890
4953
  L: 316,
4891
4954
  S: this,
4892
4955
  C: (f, a) => f(...a)
@@ -4894,7 +4957,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4894
4957
  log16.trace("dxos.client-services.host.open", trace8.end({
4895
4958
  id: traceId
4896
4959
  }), {
4897
- F: __dxlog_file17,
4960
+ F: __dxlog_file18,
4898
4961
  L: 317,
4899
4962
  S: this,
4900
4963
  C: (f, a) => f(...a)
@@ -4908,7 +4971,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4908
4971
  log16("closing...", {
4909
4972
  deviceKey
4910
4973
  }, {
4911
- F: __dxlog_file17,
4974
+ F: __dxlog_file18,
4912
4975
  L: 328,
4913
4976
  S: this,
4914
4977
  C: (f, a) => f(...a)
@@ -4924,24 +4987,24 @@ var ClientServicesHost = class ClientServicesHost2 {
4924
4987
  log16("closed", {
4925
4988
  deviceKey
4926
4989
  }, {
4927
- F: __dxlog_file17,
4990
+ F: __dxlog_file18,
4928
4991
  L: 335,
4929
4992
  S: this,
4930
4993
  C: (f, a) => f(...a)
4931
4994
  });
4932
4995
  }
4933
4996
  async reset() {
4934
- const traceId = PublicKey10.random().toHex();
4997
+ const traceId = PublicKey11.random().toHex();
4935
4998
  log16.trace("dxos.sdk.client-services-host.reset", trace8.begin({
4936
4999
  id: traceId
4937
5000
  }), {
4938
- F: __dxlog_file17,
5001
+ F: __dxlog_file18,
4939
5002
  L: 340,
4940
5003
  S: this,
4941
5004
  C: (f, a) => f(...a)
4942
5005
  });
4943
5006
  log16("resetting...", void 0, {
4944
- F: __dxlog_file17,
5007
+ F: __dxlog_file18,
4945
5008
  L: 342,
4946
5009
  S: this,
4947
5010
  C: (f, a) => f(...a)
@@ -4949,7 +5012,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4949
5012
  await this._serviceContext?.close();
4950
5013
  await this._storage.reset();
4951
5014
  log16("reset", void 0, {
4952
- F: __dxlog_file17,
5015
+ F: __dxlog_file18,
4953
5016
  L: 345,
4954
5017
  S: this,
4955
5018
  C: (f, a) => f(...a)
@@ -4957,7 +5020,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4957
5020
  log16.trace("dxos.sdk.client-services-host.reset", trace8.end({
4958
5021
  id: traceId
4959
5022
  }), {
4960
- F: __dxlog_file17,
5023
+ F: __dxlog_file18,
4961
5024
  L: 346,
4962
5025
  S: this,
4963
5026
  C: (f, a) => f(...a)
@@ -5035,4 +5098,4 @@ export {
5035
5098
  createDefaultModelFactory,
5036
5099
  ClientServicesHost
5037
5100
  };
5038
- //# sourceMappingURL=chunk-TI3I2ZZI.mjs.map
5101
+ //# sourceMappingURL=chunk-7ILC5J66.mjs.map