@dxos/client-services 0.4.7-main.e015b9e → 0.4.7-main.e0789ae
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-M3HBHYHU.mjs → chunk-LQJ2ANWZ.mjs} +214 -140
- package/dist/lib/browser/chunk-LQJ2ANWZ.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +4 -2
- package/dist/lib/browser/index.mjs.map +2 -2
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +4 -2
- package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
- package/dist/lib/node/{chunk-UPGNRF2T.cjs → chunk-6B7VIDBN.cjs} +207 -133
- package/dist/lib/node/chunk-6B7VIDBN.cjs.map +7 -0
- package/dist/lib/node/index.cjs +40 -38
- package/dist/lib/node/index.cjs.map +2 -2
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +11 -9
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- package/dist/types/src/packlets/devices/devices-service.d.ts +1 -1
- package/dist/types/src/packlets/devices/devices-service.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-manager.d.ts +8 -2
- package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity.d.ts +5 -1
- package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts +7 -3
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts +4 -2
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts +7 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/shared-worker-connection.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +35 -35
- package/src/packlets/devices/devices-service.test.ts +8 -4
- package/src/packlets/devices/devices-service.ts +47 -11
- package/src/packlets/identity/identity-manager.ts +48 -6
- package/src/packlets/identity/identity.ts +9 -1
- package/src/packlets/services/automerge-host.test.ts +1 -1
- package/src/packlets/services/service-context.ts +24 -4
- package/src/packlets/services/service-host.ts +8 -3
- package/src/packlets/spaces/data-space-manager.ts +18 -3
- package/src/packlets/spaces/spaces-service.ts +1 -3
- package/src/packlets/testing/test-builder.ts +1 -1
- package/src/packlets/vault/shared-worker-connection.ts +2 -0
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-M3HBHYHU.mjs.map +0 -7
- package/dist/lib/node/chunk-UPGNRF2T.cjs.map +0 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/packlets/testing/credential-utils.ts", "../../../../../src/packlets/testing/invitation-utils.ts", "../../../../../src/packlets/testing/test-builder.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { createCredential } from '@dxos/credentials';\nimport { type Signer } from '@dxos/crypto';\nimport { PublicKey } from '@dxos/keys';\nimport { type Credential } from '@dxos/protocols/proto/dxos/halo/credentials';\n\nexport const createMockCredential = async ({\n signer,\n issuer,\n}: {\n signer: Signer;\n issuer: PublicKey;\n}): Promise<Credential> =>\n createCredential({\n signer,\n issuer,\n subject: new PublicKey(Buffer.from('test')),\n assertion: {\n '@type': 'example.testing.rpc.MessageWithAny',\n payload: {\n '@type': 'google.protobuf.Any',\n value: Buffer.from('test'),\n },\n },\n });\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { Trigger } from '@dxos/async';\nimport { InvitationEncoder, type AuthenticatingInvitation, type CancellableInvitation } from '@dxos/client-protocol';\nimport { invariant } from '@dxos/invariant';\nimport { Invitation } from '@dxos/protocols/proto/dxos/client/services';\nimport { type DeviceProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';\n\nimport { ServiceContext } from '../services';\n\n/**\n * Strip secrets from invitation before giving it to the peer.\n */\nexport const sanitizeInvitation = (invitation: Invitation): Invitation => {\n return InvitationEncoder.decode(InvitationEncoder.encode(invitation));\n};\n\nexport type InvitationHost = {\n share(options?: Partial<Invitation>): CancellableInvitation;\n};\n\nexport type InvitationGuest = {\n join(invitation: Invitation | string, deviceProfile?: DeviceProfileDocument): AuthenticatingInvitation;\n};\n\nexport type PerformInvitationCallbacks<T> = {\n onConnecting?: (value: T) => boolean | void;\n onConnected?: (value: T) => boolean | void;\n onReady?: (value: T) => boolean | void;\n onAuthenticating?: (value: T) => boolean | void;\n onSuccess?: (value: T) => boolean | void;\n onCancelled?: (value: T) => boolean | void;\n onTimeout?: (value: T) => boolean | void;\n onError?: (value: T) => boolean | void;\n};\n\nexport type PerformInvitationParams = {\n host: ServiceContext | InvitationHost;\n guest: ServiceContext | InvitationGuest;\n options?: Partial<Invitation>;\n hooks?: {\n host?: PerformInvitationCallbacks<CancellableInvitation>;\n guest?: PerformInvitationCallbacks<AuthenticatingInvitation>;\n };\n guestDeviceProfile?: DeviceProfileDocument;\n};\n\nexport type Result = { invitation?: Invitation; error?: Error };\n\nexport const performInvitation = ({\n host,\n guest,\n options,\n hooks,\n guestDeviceProfile,\n}: PerformInvitationParams): [Promise<Result>, Promise<Result>] => {\n const hostComplete = new Trigger<Result>();\n const guestComplete = new Trigger<Result>();\n const authCode = new Trigger<string>();\n\n const hostObservable = createInvitation(host, options);\n hostObservable.subscribe(\n async (hostInvitation: Invitation) => {\n switch (hostInvitation.state) {\n case Invitation.State.CONNECTING: {\n if (hooks?.host?.onConnecting?.(hostObservable)) {\n break;\n }\n const guestObservable = acceptInvitation(guest, hostInvitation, guestDeviceProfile);\n guestObservable.subscribe(\n async (guestInvitation: Invitation) => {\n switch (guestInvitation.state) {\n case Invitation.State.CONNECTING: {\n if (hooks?.guest?.onConnecting?.(guestObservable)) {\n break;\n }\n invariant(hostInvitation.swarmKey!.equals(guestInvitation.swarmKey!));\n break;\n }\n\n case Invitation.State.CONNECTED: {\n hooks?.guest?.onConnected?.(guestObservable);\n break;\n }\n\n case Invitation.State.READY_FOR_AUTHENTICATION: {\n if (hooks?.guest?.onReady?.(guestObservable)) {\n break;\n }\n await guestObservable.authenticate(await authCode.wait());\n break;\n }\n\n case Invitation.State.AUTHENTICATING: {\n hooks?.guest?.onAuthenticating?.(guestObservable);\n break;\n }\n\n case Invitation.State.SUCCESS: {\n if (hooks?.guest?.onSuccess?.(guestObservable)) {\n break;\n }\n guestComplete.wake({ invitation: guestInvitation });\n break;\n }\n\n case Invitation.State.CANCELLED: {\n if (hooks?.guest?.onCancelled?.(guestObservable)) {\n break;\n }\n guestComplete.wake({ invitation: guestInvitation });\n break;\n }\n\n case Invitation.State.TIMEOUT: {\n if (hooks?.guest?.onTimeout?.(guestObservable)) {\n return;\n }\n guestComplete.wake({ invitation: guestInvitation });\n }\n }\n },\n (error: Error) => {\n if (hooks?.guest?.onError?.(guestObservable)) {\n return;\n }\n guestComplete.wake({ error });\n },\n );\n break;\n }\n\n case Invitation.State.CONNECTED: {\n hooks?.host?.onConnected?.(hostObservable);\n break;\n }\n\n case Invitation.State.READY_FOR_AUTHENTICATION: {\n if (hooks?.host?.onReady?.(hostObservable)) {\n break;\n }\n if (hostInvitation.authCode) {\n authCode.wake(hostInvitation.authCode);\n }\n break;\n }\n\n case Invitation.State.AUTHENTICATING: {\n hooks?.host?.onAuthenticating?.(hostObservable);\n break;\n }\n\n case Invitation.State.SUCCESS: {\n if (hooks?.host?.onSuccess?.(hostObservable)) {\n break;\n }\n hostComplete.wake({ invitation: hostInvitation });\n break;\n }\n\n case Invitation.State.CANCELLED: {\n if (hooks?.host?.onCancelled?.(hostObservable)) {\n break;\n }\n hostComplete.wake({ invitation: hostInvitation });\n break;\n }\n\n case Invitation.State.TIMEOUT: {\n if (hooks?.host?.onTimeout?.(hostObservable)) {\n break;\n }\n hostComplete.wake({ invitation: hostInvitation });\n break;\n }\n }\n },\n (error: Error) => {\n if (hooks?.host?.onError?.(hostObservable)) {\n return;\n }\n hostComplete.wake({ error });\n },\n );\n\n return [hostComplete.wait(), guestComplete.wait()];\n};\n\nconst createInvitation = (\n host: ServiceContext | InvitationHost,\n options?: Partial<Invitation>,\n): CancellableInvitation => {\n options ??= {\n authMethod: Invitation.AuthMethod.NONE,\n ...(options ?? {}),\n };\n\n if (host instanceof ServiceContext) {\n const hostHandler = host.getInvitationHandler({ kind: Invitation.Kind.SPACE, ...options });\n return host.invitations.createInvitation(hostHandler, options);\n }\n\n return host.share(options);\n};\n\nconst acceptInvitation = (\n guest: ServiceContext | InvitationGuest,\n invitation: Invitation,\n guestDeviceProfile?: DeviceProfileDocument,\n): AuthenticatingInvitation => {\n invitation = sanitizeInvitation(invitation);\n\n if (guest instanceof ServiceContext) {\n const guestHandler = guest.getInvitationHandler({ kind: invitation.kind });\n return guest.invitations.acceptInvitation(guestHandler, invitation, guestDeviceProfile);\n }\n\n return guest.join(invitation, guestDeviceProfile);\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { type Config } from '@dxos/config';\nimport { Context } from '@dxos/context';\nimport { createCredentialSignerWithChain, CredentialGenerator } from '@dxos/credentials';\nimport { failUndefined } from '@dxos/debug';\nimport {\n SnapshotStore,\n type DataPipeline,\n MetadataStore,\n SpaceManager,\n valueEncoding,\n DataServiceSubscriptions,\n AutomergeHost,\n} from '@dxos/echo-pipeline';\nimport { testLocalDatabase } from '@dxos/echo-pipeline/testing';\nimport { FeedFactory, FeedStore } from '@dxos/feed-store';\nimport { Keyring } from '@dxos/keyring';\nimport { MemorySignalManager, MemorySignalManagerContext } from '@dxos/messaging';\nimport { MemoryTransportFactory, NetworkManager } from '@dxos/network-manager';\nimport { createStorage, type Storage, StorageType } from '@dxos/random-access-storage';\nimport { BlobStore } from '@dxos/teleport-extension-object-sync';\n\nimport { ClientServicesHost, createDefaultModelFactory, ServiceContext } from '../services';\nimport { DataSpaceManager, type SigningContext } from '../spaces';\n\n//\n// TODO(burdon): Replace with test builder.\n//\n\nexport const createServiceHost = (config: Config, signalManagerContext: MemorySignalManagerContext) => {\n return new ClientServicesHost({\n config,\n signalManager: new MemorySignalManager(signalManagerContext),\n transportFactory: MemoryTransportFactory,\n });\n};\n\nexport const createServiceContext = ({\n signalContext = new MemorySignalManagerContext(),\n storage = createStorage({ type: StorageType.RAM }),\n}: {\n signalContext?: MemorySignalManagerContext;\n storage?: Storage;\n} = {}) => {\n const signalManager = new MemorySignalManager(signalContext);\n const networkManager = new NetworkManager({\n signalManager,\n transportFactory: MemoryTransportFactory,\n });\n\n const modelFactory = createDefaultModelFactory();\n return new ServiceContext(storage, networkManager, signalManager, modelFactory);\n};\n\nexport const createPeers = async (numPeers: number) => {\n const signalContext = new MemorySignalManagerContext();\n\n return await Promise.all(\n Array.from(Array(numPeers)).map(async () => {\n const peer = createServiceContext({ signalContext });\n await peer.open(new Context());\n return peer;\n }),\n );\n};\n\nexport const createIdentity = async (peer: ServiceContext) => {\n await peer.createIdentity();\n return peer;\n};\n\n// TODO(burdon): Remove @dxos/client-testing.\n// TODO(burdon): Create builder and make configurable.\nexport const syncItemsLocal = async (db1: DataPipeline, db2: DataPipeline) => {\n await testLocalDatabase(db1, db2);\n await testLocalDatabase(db2, db1);\n};\n\nexport class TestBuilder {\n public readonly signalContext = new MemorySignalManagerContext();\n private readonly _ctx = new Context();\n\n createPeer(peerOptions?: TestPeerOpts): TestPeer {\n const peer = new TestPeer(this.signalContext, peerOptions);\n this._ctx.onDispose(async () => peer.destroy());\n return peer;\n }\n\n async destroy() {\n await this._ctx.dispose();\n }\n}\n\nexport type TestPeerOpts = {\n dataStore?: StorageType;\n};\n\nexport type TestPeerProps = {\n storage?: Storage;\n feedStore?: FeedStore<any>;\n metadataStore?: MetadataStore;\n keyring?: Keyring;\n networkManager?: NetworkManager;\n spaceManager?: SpaceManager;\n dataSpaceManager?: DataSpaceManager;\n snapshotStore?: SnapshotStore;\n signingContext?: SigningContext;\n blobStore?: BlobStore;\n automergeHost?: AutomergeHost;\n};\n\nexport class TestPeer {\n private _props: TestPeerProps = {};\n\n constructor(\n private readonly signalContext: MemorySignalManagerContext,\n private readonly opts: TestPeerOpts = { dataStore: StorageType.RAM },\n ) {}\n\n get props() {\n return this._props;\n }\n\n get storage() {\n return (this._props.storage ??= createStorage({ type: this.opts.dataStore }));\n }\n\n get keyring() {\n return (this._props.keyring ??= new Keyring(this.storage.createDirectory('keyring')));\n }\n\n get feedStore() {\n return (this._props.feedStore ??= new FeedStore({\n factory: new FeedFactory({\n root: this.storage.createDirectory('feeds'),\n signer: this.keyring,\n hypercore: {\n valueEncoding,\n },\n }),\n }));\n }\n\n get metadataStore() {\n return (this._props.metadataStore ??= new MetadataStore(this.storage.createDirectory('metadata')));\n }\n\n get blobStore() {\n return (this._props.blobStore ??= new BlobStore(this.storage.createDirectory('blobs')));\n }\n\n get snapshotStore() {\n return (this._props.snapshotStore ??= new SnapshotStore(this.storage.createDirectory('snapshots')));\n }\n\n get networkManager() {\n return (this._props.networkManager ??= new NetworkManager({\n signalManager: new MemorySignalManager(this.signalContext),\n transportFactory: MemoryTransportFactory,\n }));\n }\n\n get spaceManager() {\n return (this._props.spaceManager ??= new SpaceManager({\n feedStore: this.feedStore,\n networkManager: this.networkManager,\n metadataStore: this.metadataStore,\n modelFactory: createDefaultModelFactory(),\n snapshotStore: this.snapshotStore,\n blobStore: this.blobStore,\n }));\n }\n\n get identity() {\n return this._props.signingContext ?? failUndefined();\n }\n\n get automergeHost() {\n return (this._props.automergeHost ??= new AutomergeHost(this.storage.createDirectory('automerge')));\n }\n\n get dataSpaceManager() {\n return (this._props.dataSpaceManager ??= new DataSpaceManager(\n this.spaceManager,\n this.metadataStore,\n new DataServiceSubscriptions(),\n this.keyring,\n this.identity,\n this.feedStore,\n this.automergeHost,\n ));\n }\n\n async createIdentity() {\n this._props.signingContext ??= await createSigningContext(this.keyring);\n }\n\n async destroy() {\n await this.storage.reset();\n }\n}\n\nexport const createSigningContext = async (keyring: Keyring): Promise<SigningContext> => {\n const identityKey = await keyring.createKey();\n const deviceKey = await keyring.createKey();\n\n return {\n identityKey,\n deviceKey,\n credentialSigner: createCredentialSignerWithChain(\n keyring,\n {\n credential: await new CredentialGenerator(keyring, identityKey, deviceKey).createDeviceAuthorization(deviceKey),\n },\n deviceKey,\n ),\n recordCredential: async () => {}, // No-op.\n getProfile: () => undefined,\n };\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,yBAAiC;AAEjC,kBAA0B;ACF1B,mBAAwB;AACxB,6BAA6F;AAC7F,uBAA0B;AAC1B,sBAA2B;ACF3B,qBAAwB;AACxB,IAAAA,sBAAqE;AACrE,mBAA8B;AAC9B,2BAQO;AACP,qBAAkC;AAClC,wBAAuC;AACvC,qBAAwB;AACxB,uBAAgE;AAChE,6BAAuD;AACvD,mCAAyD;AACzD,4CAA0B;AFdnB,IAAMC,uBAAuB,OAAO,EACzCC,QACAC,OAAM,UAKNC,qCAAiB;EACfF;EACAC;EACAE,SAAS,IAAIC,sBAAUC,OAAOC,KAAK,MAAA,CAAA;EACnCC,WAAW;IACT,SAAS;IACTC,SAAS;MACP,SAAS;MACTC,OAAOJ,OAAOC,KAAK,MAAA;IACrB;EACF;AACF,CAAA;;ACZK,IAAMI,qBAAqB,CAACC,eAAAA;AACjC,SAAOC,yCAAkBC,OAAOD,yCAAkBE,OAAOH,UAAAA,CAAAA;AAC3D;AAkCO,IAAMI,oBAAoB,CAAC,EAChCC,MACAC,OACAC,SACAC,OACAC,mBAAkB,MACM;AACxB,QAAMC,eAAe,IAAIC,qBAAAA;AACzB,QAAMC,gBAAgB,IAAID,qBAAAA;AAC1B,QAAME,WAAW,IAAIF,qBAAAA;AAErB,QAAMG,iBAAiBC,iBAAiBV,MAAME,OAAAA;AAC9CO,iBAAeE,UACb,OAAOC,mBAAAA;AACL,YAAQA,eAAeC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;EAC3E;EAEA,IAAIC,YAAY;AACd,WAAQ,KAAKL,OAAOK,cAAc,IAAIC,4BAAU;MAC9CC,SAAS,IAAIC,8BAAY;QACvBC,MAAM,KAAK3C,QAAQsC,gBAAgB,OAAA;QACnCvH,QAAQ,KAAKqH;QACbQ,WAAW;UACTC;QACF;MACF,CAAA;IACF,CAAA;EACF;EAEA,IAAIC,gBAAgB;AAClB,WAAQ,KAAKZ,OAAOY,kBAAkB,IAAIC,mCAAc,KAAK/C,QAAQsC,gBAAgB,UAAA,CAAA;EACvF;EAEA,IAAIU,YAAY;AACd,WAAQ,KAAKd,OAAOc,cAAc,IAAIC,gDAAU,KAAKjD,QAAQsC,gBAAgB,OAAA,CAAA;EAC/E;EAEA,IAAIY,gBAAgB;AAClB,WAAQ,KAAKhB,OAAOgB,kBAAkB,IAAIC,mCAAc,KAAKnD,QAAQsC,gBAAgB,WAAA,CAAA;EACvF;EAEA,IAAIjC,iBAAiB;AACnB,WAAQ,KAAK6B,OAAO7B,mBAAmB,IAAIC,sCAAe;MACxDb,eAAe,IAAIC,qCAAoB,KAAKI,aAAa;MACzDH,kBAAkBC;IACpB,CAAA;EACF;EAEA,IAAIwD,eAAe;AACjB,WAAQ,KAAKlB,OAAOkB,iBAAiB,IAAIC,kCAAa;MACpDd,WAAW,KAAKA;MAChBlC,gBAAgB,KAAKA;MACrByC,eAAe,KAAKA;MACpBvC,kBAAcC,iDAAAA;MACd0C,eAAe,KAAKA;MACpBF,WAAW,KAAKA;IAClB,CAAA;EACF;EAEA,IAAIM,WAAW;AACb,WAAO,KAAKpB,OAAOqB,sBAAkBC,4BAAAA;EACvC;EAEA,IAAIC,gBAAgB;AAClB,WAAQ,KAAKvB,OAAOuB,kBAAkB,IAAIC,mCAAc,
|
|
6
|
-
"names": ["import_credentials", "createMockCredential", "signer", "issuer", "createCredential", "subject", "PublicKey", "Buffer", "from", "assertion", "payload", "value", "sanitizeInvitation", "invitation", "InvitationEncoder", "decode", "encode", "performInvitation", "host", "guest", "options", "hooks", "guestDeviceProfile", "hostComplete", "Trigger", "guestComplete", "authCode", "hostObservable", "createInvitation", "subscribe", "hostInvitation", "state", "Invitation", "State", "CONNECTING", "onConnecting", "guestObservable", "acceptInvitation", "guestInvitation", "invariant", "swarmKey", "equals", "CONNECTED", "onConnected", "READY_FOR_AUTHENTICATION", "onReady", "authenticate", "wait", "AUTHENTICATING", "onAuthenticating", "SUCCESS", "onSuccess", "wake", "CANCELLED", "onCancelled", "TIMEOUT", "onTimeout", "error", "onError", "authMethod", "AuthMethod", "NONE", "ServiceContext", "hostHandler", "getInvitationHandler", "kind", "Kind", "SPACE", "invitations", "share", "guestHandler", "join", "createServiceHost", "config", "signalManagerContext", "ClientServicesHost", "signalManager", "MemorySignalManager", "transportFactory", "MemoryTransportFactory", "createServiceContext", "signalContext", "MemorySignalManagerContext", "storage", "createStorage", "type", "StorageType", "RAM", "networkManager", "NetworkManager", "modelFactory", "createDefaultModelFactory", "createPeers", "numPeers", "Promise", "all", "Array", "map", "peer", "open", "Context", "createIdentity", "syncItemsLocal", "db1", "db2", "testLocalDatabase", "TestBuilder", "_ctx", "createPeer", "peerOptions", "TestPeer", "onDispose", "destroy", "dispose", "constructor", "opts", "dataStore", "_props", "props", "keyring", "Keyring", "createDirectory", "feedStore", "FeedStore", "factory", "FeedFactory", "root", "hypercore", "valueEncoding", "metadataStore", "MetadataStore", "blobStore", "BlobStore", "snapshotStore", "SnapshotStore", "spaceManager", "SpaceManager", "identity", "signingContext", "failUndefined", "automergeHost", "AutomergeHost", "dataSpaceManager", "DataSpaceManager", "DataServiceSubscriptions", "createSigningContext", "reset", "identityKey", "createKey", "deviceKey", "credentialSigner", "createCredentialSignerWithChain", "credential", "CredentialGenerator", "createDeviceAuthorization", "recordCredential", "getProfile", "undefined"]
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { createCredential } from '@dxos/credentials';\nimport { type Signer } from '@dxos/crypto';\nimport { PublicKey } from '@dxos/keys';\nimport { type Credential } from '@dxos/protocols/proto/dxos/halo/credentials';\n\nexport const createMockCredential = async ({\n signer,\n issuer,\n}: {\n signer: Signer;\n issuer: PublicKey;\n}): Promise<Credential> =>\n createCredential({\n signer,\n issuer,\n subject: new PublicKey(Buffer.from('test')),\n assertion: {\n '@type': 'example.testing.rpc.MessageWithAny',\n payload: {\n '@type': 'google.protobuf.Any',\n value: Buffer.from('test'),\n },\n },\n });\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { Trigger } from '@dxos/async';\nimport { InvitationEncoder, type AuthenticatingInvitation, type CancellableInvitation } from '@dxos/client-protocol';\nimport { invariant } from '@dxos/invariant';\nimport { Invitation } from '@dxos/protocols/proto/dxos/client/services';\nimport { type DeviceProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';\n\nimport { ServiceContext } from '../services';\n\n/**\n * Strip secrets from invitation before giving it to the peer.\n */\nexport const sanitizeInvitation = (invitation: Invitation): Invitation => {\n return InvitationEncoder.decode(InvitationEncoder.encode(invitation));\n};\n\nexport type InvitationHost = {\n share(options?: Partial<Invitation>): CancellableInvitation;\n};\n\nexport type InvitationGuest = {\n join(invitation: Invitation | string, deviceProfile?: DeviceProfileDocument): AuthenticatingInvitation;\n};\n\nexport type PerformInvitationCallbacks<T> = {\n onConnecting?: (value: T) => boolean | void;\n onConnected?: (value: T) => boolean | void;\n onReady?: (value: T) => boolean | void;\n onAuthenticating?: (value: T) => boolean | void;\n onSuccess?: (value: T) => boolean | void;\n onCancelled?: (value: T) => boolean | void;\n onTimeout?: (value: T) => boolean | void;\n onError?: (value: T) => boolean | void;\n};\n\nexport type PerformInvitationParams = {\n host: ServiceContext | InvitationHost;\n guest: ServiceContext | InvitationGuest;\n options?: Partial<Invitation>;\n hooks?: {\n host?: PerformInvitationCallbacks<CancellableInvitation>;\n guest?: PerformInvitationCallbacks<AuthenticatingInvitation>;\n };\n guestDeviceProfile?: DeviceProfileDocument;\n};\n\nexport type Result = { invitation?: Invitation; error?: Error };\n\nexport const performInvitation = ({\n host,\n guest,\n options,\n hooks,\n guestDeviceProfile,\n}: PerformInvitationParams): [Promise<Result>, Promise<Result>] => {\n const hostComplete = new Trigger<Result>();\n const guestComplete = new Trigger<Result>();\n const authCode = new Trigger<string>();\n\n const hostObservable = createInvitation(host, options);\n hostObservable.subscribe(\n async (hostInvitation: Invitation) => {\n switch (hostInvitation.state) {\n case Invitation.State.CONNECTING: {\n if (hooks?.host?.onConnecting?.(hostObservable)) {\n break;\n }\n const guestObservable = acceptInvitation(guest, hostInvitation, guestDeviceProfile);\n guestObservable.subscribe(\n async (guestInvitation: Invitation) => {\n switch (guestInvitation.state) {\n case Invitation.State.CONNECTING: {\n if (hooks?.guest?.onConnecting?.(guestObservable)) {\n break;\n }\n invariant(hostInvitation.swarmKey!.equals(guestInvitation.swarmKey!));\n break;\n }\n\n case Invitation.State.CONNECTED: {\n hooks?.guest?.onConnected?.(guestObservable);\n break;\n }\n\n case Invitation.State.READY_FOR_AUTHENTICATION: {\n if (hooks?.guest?.onReady?.(guestObservable)) {\n break;\n }\n await guestObservable.authenticate(await authCode.wait());\n break;\n }\n\n case Invitation.State.AUTHENTICATING: {\n hooks?.guest?.onAuthenticating?.(guestObservable);\n break;\n }\n\n case Invitation.State.SUCCESS: {\n if (hooks?.guest?.onSuccess?.(guestObservable)) {\n break;\n }\n guestComplete.wake({ invitation: guestInvitation });\n break;\n }\n\n case Invitation.State.CANCELLED: {\n if (hooks?.guest?.onCancelled?.(guestObservable)) {\n break;\n }\n guestComplete.wake({ invitation: guestInvitation });\n break;\n }\n\n case Invitation.State.TIMEOUT: {\n if (hooks?.guest?.onTimeout?.(guestObservable)) {\n return;\n }\n guestComplete.wake({ invitation: guestInvitation });\n }\n }\n },\n (error: Error) => {\n if (hooks?.guest?.onError?.(guestObservable)) {\n return;\n }\n guestComplete.wake({ error });\n },\n );\n break;\n }\n\n case Invitation.State.CONNECTED: {\n hooks?.host?.onConnected?.(hostObservable);\n break;\n }\n\n case Invitation.State.READY_FOR_AUTHENTICATION: {\n if (hooks?.host?.onReady?.(hostObservable)) {\n break;\n }\n if (hostInvitation.authCode) {\n authCode.wake(hostInvitation.authCode);\n }\n break;\n }\n\n case Invitation.State.AUTHENTICATING: {\n hooks?.host?.onAuthenticating?.(hostObservable);\n break;\n }\n\n case Invitation.State.SUCCESS: {\n if (hooks?.host?.onSuccess?.(hostObservable)) {\n break;\n }\n hostComplete.wake({ invitation: hostInvitation });\n break;\n }\n\n case Invitation.State.CANCELLED: {\n if (hooks?.host?.onCancelled?.(hostObservable)) {\n break;\n }\n hostComplete.wake({ invitation: hostInvitation });\n break;\n }\n\n case Invitation.State.TIMEOUT: {\n if (hooks?.host?.onTimeout?.(hostObservable)) {\n break;\n }\n hostComplete.wake({ invitation: hostInvitation });\n break;\n }\n }\n },\n (error: Error) => {\n if (hooks?.host?.onError?.(hostObservable)) {\n return;\n }\n hostComplete.wake({ error });\n },\n );\n\n return [hostComplete.wait(), guestComplete.wait()];\n};\n\nconst createInvitation = (\n host: ServiceContext | InvitationHost,\n options?: Partial<Invitation>,\n): CancellableInvitation => {\n options ??= {\n authMethod: Invitation.AuthMethod.NONE,\n ...(options ?? {}),\n };\n\n if (host instanceof ServiceContext) {\n const hostHandler = host.getInvitationHandler({ kind: Invitation.Kind.SPACE, ...options });\n return host.invitations.createInvitation(hostHandler, options);\n }\n\n return host.share(options);\n};\n\nconst acceptInvitation = (\n guest: ServiceContext | InvitationGuest,\n invitation: Invitation,\n guestDeviceProfile?: DeviceProfileDocument,\n): AuthenticatingInvitation => {\n invitation = sanitizeInvitation(invitation);\n\n if (guest instanceof ServiceContext) {\n const guestHandler = guest.getInvitationHandler({ kind: invitation.kind });\n return guest.invitations.acceptInvitation(guestHandler, invitation, guestDeviceProfile);\n }\n\n return guest.join(invitation, guestDeviceProfile);\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { type Config } from '@dxos/config';\nimport { Context } from '@dxos/context';\nimport { createCredentialSignerWithChain, CredentialGenerator } from '@dxos/credentials';\nimport { failUndefined } from '@dxos/debug';\nimport {\n SnapshotStore,\n type DataPipeline,\n MetadataStore,\n SpaceManager,\n valueEncoding,\n DataServiceSubscriptions,\n AutomergeHost,\n} from '@dxos/echo-pipeline';\nimport { testLocalDatabase } from '@dxos/echo-pipeline/testing';\nimport { FeedFactory, FeedStore } from '@dxos/feed-store';\nimport { Keyring } from '@dxos/keyring';\nimport { MemorySignalManager, MemorySignalManagerContext } from '@dxos/messaging';\nimport { MemoryTransportFactory, NetworkManager } from '@dxos/network-manager';\nimport { createStorage, type Storage, StorageType } from '@dxos/random-access-storage';\nimport { BlobStore } from '@dxos/teleport-extension-object-sync';\n\nimport { ClientServicesHost, createDefaultModelFactory, ServiceContext } from '../services';\nimport { DataSpaceManager, type SigningContext } from '../spaces';\n\n//\n// TODO(burdon): Replace with test builder.\n//\n\nexport const createServiceHost = (config: Config, signalManagerContext: MemorySignalManagerContext) => {\n return new ClientServicesHost({\n config,\n signalManager: new MemorySignalManager(signalManagerContext),\n transportFactory: MemoryTransportFactory,\n });\n};\n\nexport const createServiceContext = ({\n signalContext = new MemorySignalManagerContext(),\n storage = createStorage({ type: StorageType.RAM }),\n}: {\n signalContext?: MemorySignalManagerContext;\n storage?: Storage;\n} = {}) => {\n const signalManager = new MemorySignalManager(signalContext);\n const networkManager = new NetworkManager({\n signalManager,\n transportFactory: MemoryTransportFactory,\n });\n\n const modelFactory = createDefaultModelFactory();\n return new ServiceContext(storage, networkManager, signalManager, modelFactory);\n};\n\nexport const createPeers = async (numPeers: number) => {\n const signalContext = new MemorySignalManagerContext();\n\n return await Promise.all(\n Array.from(Array(numPeers)).map(async () => {\n const peer = createServiceContext({ signalContext });\n await peer.open(new Context());\n return peer;\n }),\n );\n};\n\nexport const createIdentity = async (peer: ServiceContext) => {\n await peer.createIdentity();\n return peer;\n};\n\n// TODO(burdon): Remove @dxos/client-testing.\n// TODO(burdon): Create builder and make configurable.\nexport const syncItemsLocal = async (db1: DataPipeline, db2: DataPipeline) => {\n await testLocalDatabase(db1, db2);\n await testLocalDatabase(db2, db1);\n};\n\nexport class TestBuilder {\n public readonly signalContext = new MemorySignalManagerContext();\n private readonly _ctx = new Context();\n\n createPeer(peerOptions?: TestPeerOpts): TestPeer {\n const peer = new TestPeer(this.signalContext, peerOptions);\n this._ctx.onDispose(async () => peer.destroy());\n return peer;\n }\n\n async destroy() {\n await this._ctx.dispose();\n }\n}\n\nexport type TestPeerOpts = {\n dataStore?: StorageType;\n};\n\nexport type TestPeerProps = {\n storage?: Storage;\n feedStore?: FeedStore<any>;\n metadataStore?: MetadataStore;\n keyring?: Keyring;\n networkManager?: NetworkManager;\n spaceManager?: SpaceManager;\n dataSpaceManager?: DataSpaceManager;\n snapshotStore?: SnapshotStore;\n signingContext?: SigningContext;\n blobStore?: BlobStore;\n automergeHost?: AutomergeHost;\n};\n\nexport class TestPeer {\n private _props: TestPeerProps = {};\n\n constructor(\n private readonly signalContext: MemorySignalManagerContext,\n private readonly opts: TestPeerOpts = { dataStore: StorageType.RAM },\n ) {}\n\n get props() {\n return this._props;\n }\n\n get storage() {\n return (this._props.storage ??= createStorage({ type: this.opts.dataStore }));\n }\n\n get keyring() {\n return (this._props.keyring ??= new Keyring(this.storage.createDirectory('keyring')));\n }\n\n get feedStore() {\n return (this._props.feedStore ??= new FeedStore({\n factory: new FeedFactory({\n root: this.storage.createDirectory('feeds'),\n signer: this.keyring,\n hypercore: {\n valueEncoding,\n },\n }),\n }));\n }\n\n get metadataStore() {\n return (this._props.metadataStore ??= new MetadataStore(this.storage.createDirectory('metadata')));\n }\n\n get blobStore() {\n return (this._props.blobStore ??= new BlobStore(this.storage.createDirectory('blobs')));\n }\n\n get snapshotStore() {\n return (this._props.snapshotStore ??= new SnapshotStore(this.storage.createDirectory('snapshots')));\n }\n\n get networkManager() {\n return (this._props.networkManager ??= new NetworkManager({\n signalManager: new MemorySignalManager(this.signalContext),\n transportFactory: MemoryTransportFactory,\n }));\n }\n\n get spaceManager() {\n return (this._props.spaceManager ??= new SpaceManager({\n feedStore: this.feedStore,\n networkManager: this.networkManager,\n metadataStore: this.metadataStore,\n modelFactory: createDefaultModelFactory(),\n snapshotStore: this.snapshotStore,\n blobStore: this.blobStore,\n }));\n }\n\n get identity() {\n return this._props.signingContext ?? failUndefined();\n }\n\n get automergeHost() {\n return (this._props.automergeHost ??= new AutomergeHost({ directory: this.storage.createDirectory('automerge') }));\n }\n\n get dataSpaceManager() {\n return (this._props.dataSpaceManager ??= new DataSpaceManager(\n this.spaceManager,\n this.metadataStore,\n new DataServiceSubscriptions(),\n this.keyring,\n this.identity,\n this.feedStore,\n this.automergeHost,\n ));\n }\n\n async createIdentity() {\n this._props.signingContext ??= await createSigningContext(this.keyring);\n }\n\n async destroy() {\n await this.storage.reset();\n }\n}\n\nexport const createSigningContext = async (keyring: Keyring): Promise<SigningContext> => {\n const identityKey = await keyring.createKey();\n const deviceKey = await keyring.createKey();\n\n return {\n identityKey,\n deviceKey,\n credentialSigner: createCredentialSignerWithChain(\n keyring,\n {\n credential: await new CredentialGenerator(keyring, identityKey, deviceKey).createDeviceAuthorization(deviceKey),\n },\n deviceKey,\n ),\n recordCredential: async () => {}, // No-op.\n getProfile: () => undefined,\n };\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,yBAAiC;AAEjC,kBAA0B;ACF1B,mBAAwB;AACxB,6BAA6F;AAC7F,uBAA0B;AAC1B,sBAA2B;ACF3B,qBAAwB;AACxB,IAAAA,sBAAqE;AACrE,mBAA8B;AAC9B,2BAQO;AACP,qBAAkC;AAClC,wBAAuC;AACvC,qBAAwB;AACxB,uBAAgE;AAChE,6BAAuD;AACvD,mCAAyD;AACzD,4CAA0B;AFdnB,IAAMC,uBAAuB,OAAO,EACzCC,QACAC,OAAM,UAKNC,qCAAiB;EACfF;EACAC;EACAE,SAAS,IAAIC,sBAAUC,OAAOC,KAAK,MAAA,CAAA;EACnCC,W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KAAKlB,OAAOkB,iBAAiB,IAAIC,kCAAa;MACpDd,WAAW,KAAKA;MAChBlC,gBAAgB,KAAKA;MACrByC,eAAe,KAAKA;MACpBvC,kBAAcC,iDAAAA;MACd0C,eAAe,KAAKA;MACpBF,WAAW,KAAKA;IAClB,CAAA;EACF;EAEA,IAAIM,WAAW;AACb,WAAO,KAAKpB,OAAOqB,sBAAkBC,4BAAAA;EACvC;EAEA,IAAIC,gBAAgB;AAClB,WAAQ,KAAKvB,OAAOuB,kBAAkB,IAAIC,mCAAc;MAAEC,WAAW,KAAK3D,QAAQsC,gBAAgB,WAAA;IAAa,CAAA;EACjH;EAEA,IAAIsB,mBAAmB;AACrB,WAAQ,KAAK1B,OAAO0B,qBAAqB,IAAIC,uCAC3C,KAAKT,cACL,KAAKN,eACL,IAAIgB,8CAAAA,GACJ,KAAK1B,SACL,KAAKkB,UACL,KAAKf,WACL,KAAKkB,aAAa;EAEtB;EAEA,MAAMvC,iBAAiB;AACrB,SAAKgB,OAAOqB,mBAAmB,MAAMQ,qBAAqB,KAAK3B,OAAO;EACxE;EAEA,MAAMP,UAAU;AACd,UAAM,KAAK7B,QAAQgE,MAAK;EAC1B;AACF;AAEO,IAAMD,uBAAuB,OAAO3B,YAAAA;AACzC,QAAM6B,cAAc,MAAM7B,QAAQ8B,UAAS;AAC3C,QAAMC,YAAY,MAAM/B,QAAQ8B,UAAS;AAEzC,SAAO;IACLD;IACAE;IACAC,sBAAkBC,qDAChBjC,SACA;MACEkC,YAAY,MAAM,IAAIC,wCAAoBnC,SAAS6B,aAAaE,SAAAA,EAAWK,0BAA0BL,SAAAA;IACvG,GACAA,SAAAA;IAEFM,kBAAkB,YAAA;IAAa;IAC/BC,YAAY,MAAMC;EACpB;AACF;",
|
|
6
|
+
"names": ["import_credentials", "createMockCredential", "signer", "issuer", "createCredential", "subject", "PublicKey", "Buffer", "from", "assertion", "payload", "value", "sanitizeInvitation", "invitation", "InvitationEncoder", "decode", "encode", "performInvitation", "host", "guest", "options", "hooks", "guestDeviceProfile", "hostComplete", "Trigger", "guestComplete", "authCode", "hostObservable", "createInvitation", "subscribe", "hostInvitation", "state", "Invitation", "State", "CONNECTING", "onConnecting", "guestObservable", "acceptInvitation", "guestInvitation", "invariant", "swarmKey", "equals", "CONNECTED", "onConnected", "READY_FOR_AUTHENTICATION", "onReady", "authenticate", "wait", "AUTHENTICATING", "onAuthenticating", "SUCCESS", "onSuccess", "wake", "CANCELLED", "onCancelled", "TIMEOUT", "onTimeout", "error", "onError", "authMethod", "AuthMethod", "NONE", "ServiceContext", "hostHandler", "getInvitationHandler", "kind", "Kind", "SPACE", "invitations", "share", "guestHandler", "join", "createServiceHost", "config", "signalManagerContext", "ClientServicesHost", "signalManager", "MemorySignalManager", "transportFactory", "MemoryTransportFactory", "createServiceContext", "signalContext", "MemorySignalManagerContext", "storage", "createStorage", "type", "StorageType", "RAM", "networkManager", "NetworkManager", "modelFactory", "createDefaultModelFactory", "createPeers", "numPeers", "Promise", "all", "Array", "map", "peer", "open", "Context", "createIdentity", "syncItemsLocal", "db1", "db2", "testLocalDatabase", "TestBuilder", "_ctx", "createPeer", "peerOptions", "TestPeer", "onDispose", "destroy", "dispose", "constructor", "opts", "dataStore", "_props", "props", "keyring", "Keyring", "createDirectory", "feedStore", "FeedStore", "factory", "FeedFactory", "root", "hypercore", "valueEncoding", "metadataStore", "MetadataStore", "blobStore", "BlobStore", "snapshotStore", "SnapshotStore", "spaceManager", "SpaceManager", "identity", "signingContext", "failUndefined", "automergeHost", "AutomergeHost", "directory", "dataSpaceManager", "DataSpaceManager", "DataServiceSubscriptions", "createSigningContext", "reset", "identityKey", "createKey", "deviceKey", "credentialSigner", "createCredentialSignerWithChain", "credential", "CredentialGenerator", "createDeviceAuthorization", "recordCredential", "getProfile", "undefined"]
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Stream } from '@dxos/codec-protobuf';
|
|
2
|
-
import {
|
|
2
|
+
import { Device, type DevicesService, type QueryDevicesResponse } from '@dxos/protocols/proto/dxos/client/services';
|
|
3
3
|
import { type DeviceProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
4
4
|
import { type IdentityManager } from '../identity';
|
|
5
5
|
export declare class DevicesServiceImpl implements DevicesService {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devices-service.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/devices/devices-service.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"devices-service.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/devices/devices-service.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,OAAO,EACL,MAAM,EAEN,KAAK,cAAc,EACnB,KAAK,oBAAoB,EAC1B,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AAEzF,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,qBAAa,kBAAmB,YAAW,cAAc;IAC3C,OAAO,CAAC,QAAQ,CAAC,gBAAgB;gBAAhB,gBAAgB,EAAE,eAAe;IAExD,YAAY,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC;IAInE,YAAY,IAAI,MAAM,CAAC,oBAAoB,CAAC;CAwE7C"}
|
|
@@ -4,7 +4,7 @@ import { type MetadataStore, type SpaceManager } from '@dxos/echo-pipeline';
|
|
|
4
4
|
import { type FeedStore } from '@dxos/feed-store';
|
|
5
5
|
import { type Keyring } from '@dxos/keyring';
|
|
6
6
|
import { PublicKey } from '@dxos/keys';
|
|
7
|
-
import {
|
|
7
|
+
import { Device } from '@dxos/protocols/proto/dxos/client/services';
|
|
8
8
|
import { type FeedMessage } from '@dxos/protocols/proto/dxos/echo/feed';
|
|
9
9
|
import { type DeviceProfileDocument, type ProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
10
10
|
import { Timeframe } from '@dxos/timeframe';
|
|
@@ -27,6 +27,10 @@ export type CreateIdentityOptions = {
|
|
|
27
27
|
displayName?: string;
|
|
28
28
|
deviceProfile?: DeviceProfileDocument;
|
|
29
29
|
};
|
|
30
|
+
export type IdentityManagerRuntimeParams = {
|
|
31
|
+
devicePresenceAnnounceInterval?: number;
|
|
32
|
+
devicePresenceOfflineTimeout?: number;
|
|
33
|
+
};
|
|
30
34
|
export declare class IdentityManager {
|
|
31
35
|
private readonly _metadataStore;
|
|
32
36
|
private readonly _keyring;
|
|
@@ -34,7 +38,9 @@ export declare class IdentityManager {
|
|
|
34
38
|
private readonly _spaceManager;
|
|
35
39
|
readonly stateUpdate: Event<void>;
|
|
36
40
|
private _identity?;
|
|
37
|
-
|
|
41
|
+
private readonly _devicePresenceAnnounceInterval;
|
|
42
|
+
private readonly _devicePresenceOfflineTimeout;
|
|
43
|
+
constructor(_metadataStore: MetadataStore, _keyring: Keyring, _feedStore: FeedStore<FeedMessage>, _spaceManager: SpaceManager, params?: IdentityManagerRuntimeParams);
|
|
38
44
|
get identity(): Identity | undefined;
|
|
39
45
|
open(ctx: Context): Promise<void>;
|
|
40
46
|
close(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity-manager.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/identity/identity-manager.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAsB,MAAM,qBAAqB,CAAC;AAChG,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,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zC,8BAA8B,CAAC,EAAE,MAAM,CAAC;IACxC,4BAA4B,CAAC,EAAE,MAAM,CAAC;CACvC,CAAC;AAGF,qBACa,eAAe;IAUxB,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,aAAa;IAZhC,QAAQ,CAAC,WAAW,cAAe;IAEnC,OAAO,CAAC,SAAS,CAAC,CAAW;IAC7B,OAAO,CAAC,QAAQ,CAAC,+BAA+B,CAAS;IACzD,OAAO,CAAC,QAAQ,CAAC,6BAA6B,CAAS;gBAKpC,cAAc,EAAE,aAAa,EAC7B,QAAQ,EAAE,OAAO,EACjB,UAAU,EAAE,SAAS,CAAC,WAAW,CAAC,EAClC,aAAa,EAAE,YAAY,EAC5C,MAAM,CAAC,EAAE,4BAA4B;IAUvC,IAAI,QAAQ,yBAEX;IAGK,IAAI,CAAC,GAAG,EAAE,OAAO;IAoBjB,KAAK;IAIL,cAAc,CAAC,EAAE,WAAW,EAAE,aAAa,EAAE,GAAE,qBAA0B;IAgF/E,0BAA0B,IAAI,qBAAqB;IAyBnD;;OAEG;IACG,cAAc,CAAC,MAAM,EAAE,kBAAkB;IAmC/C;;OAEG;IACG,aAAa,CAAC,OAAO,EAAE,eAAe;IAiBtC,mBAAmB,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC;YA0B5D,kBAAkB;YAwDlB,eAAe;CAmB9B"}
|
|
@@ -6,6 +6,7 @@ import { type Space } from '@dxos/echo-pipeline';
|
|
|
6
6
|
import { PublicKey } from '@dxos/keys';
|
|
7
7
|
import { type DeviceProfileDocument, type ProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
8
8
|
import { type DeviceAdmissionRequest } from '@dxos/protocols/proto/dxos/halo/invitations';
|
|
9
|
+
import { type Presence } from '@dxos/teleport-extension-gossip';
|
|
9
10
|
import { type ComplexMap } from '@dxos/util';
|
|
10
11
|
import { TrustedKeySetAuthVerifier } from './authenticator';
|
|
11
12
|
export type IdentityParams = {
|
|
@@ -13,6 +14,7 @@ export type IdentityParams = {
|
|
|
13
14
|
deviceKey: PublicKey;
|
|
14
15
|
signer: Signer;
|
|
15
16
|
space: Space;
|
|
17
|
+
presence?: Presence;
|
|
16
18
|
};
|
|
17
19
|
/**
|
|
18
20
|
* Agent identity manager, which includes the agent's Halo space.
|
|
@@ -20,13 +22,14 @@ export type IdentityParams = {
|
|
|
20
22
|
export declare class Identity {
|
|
21
23
|
readonly space: Space;
|
|
22
24
|
private readonly _signer;
|
|
25
|
+
private readonly _presence?;
|
|
23
26
|
private readonly _deviceStateMachine;
|
|
24
27
|
private readonly _profileStateMachine;
|
|
25
28
|
readonly authVerifier: TrustedKeySetAuthVerifier;
|
|
26
29
|
readonly identityKey: PublicKey;
|
|
27
30
|
readonly deviceKey: PublicKey;
|
|
28
31
|
readonly stateUpdate: Event<void>;
|
|
29
|
-
constructor({ space, signer, identityKey, deviceKey }: IdentityParams);
|
|
32
|
+
constructor({ space, signer, identityKey, deviceKey, presence }: IdentityParams);
|
|
30
33
|
get authorizedDeviceKeys(): ComplexMap<PublicKey, DeviceProfileDocument>;
|
|
31
34
|
open(ctx: Context): Promise<void>;
|
|
32
35
|
close(ctx: Context): Promise<void>;
|
|
@@ -39,6 +42,7 @@ export declare class Identity {
|
|
|
39
42
|
get haloSpaceKey(): PublicKey;
|
|
40
43
|
get haloGenesisFeedKey(): PublicKey;
|
|
41
44
|
get deviceCredentialChain(): import("@dxos/protocols/proto/dxos/halo/credentials").Chain | undefined;
|
|
45
|
+
get presence(): Presence | undefined;
|
|
42
46
|
/**
|
|
43
47
|
* Issues credentials as identity.
|
|
44
48
|
* Requires identity to be ready.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/identity/identity.ts"],"names":[],"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
import { Context } from '@dxos/context';
|
|
3
3
|
import { MetadataStore, SpaceManager, DataServiceSubscriptions, SnapshotStore, AutomergeHost } from '@dxos/echo-pipeline';
|
|
4
|
+
import { IndexMetadataStore } from '@dxos/echo-schema';
|
|
4
5
|
import { FeedStore } from '@dxos/feed-store';
|
|
5
6
|
import { Keyring } from '@dxos/keyring';
|
|
6
7
|
import { type SignalManager } from '@dxos/messaging';
|
|
@@ -11,9 +12,10 @@ import type { FeedMessage } from '@dxos/protocols/proto/dxos/echo/feed';
|
|
|
11
12
|
import { type ProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
12
13
|
import { type Storage } from '@dxos/random-access-storage';
|
|
13
14
|
import { BlobStore } from '@dxos/teleport-extension-object-sync';
|
|
14
|
-
import { type CreateIdentityOptions, IdentityManager } from '../identity';
|
|
15
|
+
import { type CreateIdentityOptions, IdentityManager, type IdentityManagerRuntimeParams } from '../identity';
|
|
15
16
|
import { InvitationsHandler, type InvitationProtocol } from '../invitations';
|
|
16
|
-
import { DataSpaceManager } from '../spaces';
|
|
17
|
+
import { DataSpaceManager, type DataSpaceManagerRuntimeParams } from '../spaces';
|
|
18
|
+
export type ServiceContextRuntimeParams = IdentityManagerRuntimeParams & DataSpaceManagerRuntimeParams;
|
|
17
19
|
/**
|
|
18
20
|
* Shared backend for all client services.
|
|
19
21
|
*/
|
|
@@ -22,6 +24,7 @@ export declare class ServiceContext {
|
|
|
22
24
|
readonly networkManager: NetworkManager;
|
|
23
25
|
readonly signalManager: SignalManager;
|
|
24
26
|
readonly modelFactory: ModelFactory;
|
|
27
|
+
readonly _runtimeParams?: (IdentityManagerRuntimeParams & DataSpaceManagerRuntimeParams) | undefined;
|
|
25
28
|
readonly initialized: Trigger<void>;
|
|
26
29
|
readonly dataServiceSubscriptions: DataServiceSubscriptions;
|
|
27
30
|
readonly metadataStore: MetadataStore;
|
|
@@ -36,11 +39,12 @@ export declare class ServiceContext {
|
|
|
36
39
|
readonly identityManager: IdentityManager;
|
|
37
40
|
readonly invitations: InvitationsHandler;
|
|
38
41
|
readonly automergeHost: AutomergeHost;
|
|
42
|
+
readonly indexMetadata: IndexMetadataStore;
|
|
39
43
|
dataSpaceManager?: DataSpaceManager;
|
|
40
44
|
private readonly _handlerFactories;
|
|
41
45
|
private _deviceSpaceSync?;
|
|
42
46
|
private readonly _instanceId;
|
|
43
|
-
constructor(storage: Storage, networkManager: NetworkManager, signalManager: SignalManager, modelFactory: ModelFactory);
|
|
47
|
+
constructor(storage: Storage, networkManager: NetworkManager, signalManager: SignalManager, modelFactory: ModelFactory, _runtimeParams?: (IdentityManagerRuntimeParams & DataSpaceManagerRuntimeParams) | undefined);
|
|
44
48
|
open(ctx: Context): Promise<void>;
|
|
45
49
|
close(): Promise<void>;
|
|
46
50
|
createIdentity(params?: CreateIdentityOptions): Promise<import("../identity").Identity>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-context.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/services/service-context.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGxC,OAAO,EAEL,aAAa,EACb,YAAY,EACZ,wBAAwB,EACxB,aAAa,EACb,aAAa,EACd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAe,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,KAAK,eAAe,EAAmB,MAAM,6CAA6C,CAAC;AACpG,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAIjE,OAAO,
|
|
1
|
+
{"version":3,"file":"service-context.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/services/service-context.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGxC,OAAO,EAEL,aAAa,EACb,YAAY,EACZ,wBAAwB,EACxB,aAAa,EACb,aAAa,EACd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAe,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,KAAK,eAAe,EAAmB,MAAM,6CAA6C,CAAC;AACpG,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAIjE,OAAO,EACL,KAAK,qBAAqB,EAC1B,eAAe,EACf,KAAK,4BAA4B,EAElC,MAAM,aAAa,CAAC;AACrB,OAAO,EAEL,kBAAkB,EAClB,KAAK,kBAAkB,EAExB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,gB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,CAAC,GAAG,kBAAkB;IAM9F,sBAAsB,CAAC,OAAO,EAAE,eAAe,GAAG,SAAS;YAUnD,eAAe;YAMf,oBAAoB;YAUpB,WAAW;CAgE1B"}
|
|
@@ -5,7 +5,7 @@ import { type SignalManager } from '@dxos/messaging';
|
|
|
5
5
|
import { ModelFactory } from '@dxos/model-factory';
|
|
6
6
|
import { type TransportFactory } from '@dxos/network-manager';
|
|
7
7
|
import { type Storage } from '@dxos/random-access-storage';
|
|
8
|
-
import { ServiceContext } from './service-context';
|
|
8
|
+
import { ServiceContext, type ServiceContextRuntimeParams } from './service-context';
|
|
9
9
|
import { ServiceRegistry } from './service-registry';
|
|
10
10
|
export declare const createDefaultModelFactory: () => ModelFactory;
|
|
11
11
|
export type ClientServicesHostParams = {
|
|
@@ -20,6 +20,7 @@ export type ClientServicesHostParams = {
|
|
|
20
20
|
storage?: Storage;
|
|
21
21
|
lockKey?: string;
|
|
22
22
|
callbacks?: ClientServicesHostCallbacks;
|
|
23
|
+
runtimeParams?: ServiceContextRuntimeParams;
|
|
23
24
|
};
|
|
24
25
|
export type ClientServicesHostCallbacks = {
|
|
25
26
|
onReset?: () => Promise<void>;
|
|
@@ -48,9 +49,10 @@ export declare class ClientServicesHost {
|
|
|
48
49
|
private _callbacks?;
|
|
49
50
|
private _devtoolsProxy?;
|
|
50
51
|
private _serviceContext;
|
|
52
|
+
private readonly _runtimeParams?;
|
|
51
53
|
private _opening;
|
|
52
54
|
private _open;
|
|
53
|
-
constructor({ config, modelFactory, transportFactory, signalManager, storage, lockKey, callbacks, }?: ClientServicesHostParams);
|
|
55
|
+
constructor({ config, modelFactory, transportFactory, signalManager, storage, lockKey, callbacks, runtimeParams, }?: ClientServicesHostParams);
|
|
54
56
|
get isOpen(): boolean;
|
|
55
57
|
get config(): Config | undefined;
|
|
56
58
|
get context(): ServiceContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-host.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/services/service-host.ts"],"names":[],"mappings":"AAKA,OAAO,EAAuB,KAAK,cAAc,EAA0B,MAAM,uBAAuB,CAAC;AACzG,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAOxC,OAAO,EAAE,KAAK,aAAa,EAA0B,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAoD,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGhH,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAO3D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"service-host.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/services/service-host.ts"],"names":[],"mappings":"AAKA,OAAO,EAAuB,KAAK,cAAc,EAA0B,MAAM,uBAAuB,CAAC;AACzG,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAOxC,OAAO,EAAE,KAAK,aAAa,EAA0B,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAoD,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGhH,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAO3D,OAAO,EAAE,cAAc,EAAE,KAAK,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAarD,eAAO,MAAM,yBAAyB,oBAErC,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC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AA8B;IAG9D,OAAO,CAAC,QAAQ,CAAS;IAGzB,OAAO,CAAC,KAAK,CAAS;gBAEV,EACV,MAAM,EACN,YAA0C,EAC1C,gBAAgB,EAChB,aAAa,EACb,OAAO,EAEP,OAAO,EACP,SAAS,EACT,aAAa,GACd,GAAE,wBAA6B;IAkDhC,IAAI,MAAM,YAET;IAED,IAAI,MAAM,uBAET;IAED,IAAI,OAAO,mBAEV;IAED,IAAI,eAAe,oCAElB;IAED,IAAI,WAAW,sDAEd;IAED,IAAI,QAAQ,4BAEX;IAED;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,EAAE,iBAAiB;IAiC9C,IAAI,CAAC,GAAG,EAAE,OAAO;IA8FjB,KAAK;IAgBL,KAAK;YAYG,eAAe;CAqB9B"}
|
|
@@ -30,6 +30,10 @@ export type AcceptSpaceOptions = {
|
|
|
30
30
|
*/
|
|
31
31
|
dataTimeframe?: Timeframe;
|
|
32
32
|
};
|
|
33
|
+
export type DataSpaceManagerRuntimeParams = {
|
|
34
|
+
spaceMemberPresenceAnnounceInterval?: number;
|
|
35
|
+
spaceMemberPresenceOfflineTimeout?: number;
|
|
36
|
+
};
|
|
33
37
|
export declare class DataSpaceManager {
|
|
34
38
|
private readonly _spaceManager;
|
|
35
39
|
private readonly _metadataStore;
|
|
@@ -43,7 +47,9 @@ export declare class DataSpaceManager {
|
|
|
43
47
|
private readonly _spaces;
|
|
44
48
|
private _isOpen;
|
|
45
49
|
private readonly _instanceId;
|
|
46
|
-
|
|
50
|
+
private readonly _spaceMemberPresenceAnnounceInterval;
|
|
51
|
+
private readonly _spaceMemberPresenceOfflineTimeout;
|
|
52
|
+
constructor(_spaceManager: SpaceManager, _metadataStore: MetadataStore, _dataServiceSubscriptions: DataServiceSubscriptions, _keyring: Keyring, _signingContext: SigningContext, _feedStore: FeedStore<FeedMessage>, _automergeHost: AutomergeHost, params?: DataSpaceManagerRuntimeParams);
|
|
47
53
|
get spaces(): ComplexMap<PublicKey, DataSpace>;
|
|
48
54
|
open(): Promise<void>;
|
|
49
55
|
close(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-space-manager.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/spaces/data-space-manager.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAA4B,MAAM,aAAa,CAAC;AAE9D,OAAO,EAAE,KAAK,gBAAgB,EAA0B,MAAM,mBAAmB,CAAC;AAClF,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,wBAAwB,EAC7B,KAAK,aAAa,EAElB,KAAK,YAAY,EAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAIvC,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAEpG,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,UAAU,EAA+B,MAAM,YAAY,CAAC;AAErE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAOzC,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,SAAS,CAAC;IACvB,SAAS,EAAE,SAAS,CAAC;IACrB,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,gBAAgB,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5D,UAAU,EAAE,MAAM,eAAe,GAAG,SAAS,CAAC;CAC/C;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,SAAS,CAAC;IACpB,cAAc,EAAE,SAAS,CAAC;IAE1B;;;O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AAU,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,qBAAa,sBAAsB;IACjC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAA+C;IACnE,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA0C;IAC1E,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAU;IACtC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAU;IACtC,OAAO,CAAC,QAAQ,CAAiB;IACjC,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,iBAAiB,CAAiB;IAC1C,OAAO,CAAC,UAAU,CAAqC;IACvD,OAAO,CAAC,aAAa,CAAC,CAAmB;gBAE7B,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,6BAA6B;IAU5E,IAAI,KAAK,IAAI,YAAY,GAAG,SAAS,CAEpC;IAEK,IAAI;IACR;;OAEG;IACH,MAAM,EAAE,MAAM;IA0CV,KAAK;IAWX,OAAO,CAAC,QAAQ;CAGjB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const DXOS_VERSION = "0.4.7-main.
|
|
1
|
+
export declare const DXOS_VERSION = "0.4.7-main.e0789ae";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/client-services",
|
|
3
|
-
"version": "0.4.7-main.
|
|
3
|
+
"version": "0.4.7-main.e0789ae",
|
|
4
4
|
"description": "DXOS client services implementation",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -22,44 +22,44 @@
|
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"platform": "^1.3.6",
|
|
25
|
-
"@dxos/async": "0.4.7-main.
|
|
26
|
-
"@dxos/client-protocol": "0.4.7-main.
|
|
27
|
-
"@dxos/codec-protobuf": "0.4.7-main.
|
|
28
|
-
"@dxos/config": "0.4.7-main.
|
|
29
|
-
"@dxos/context": "0.4.7-main.
|
|
30
|
-
"@dxos/
|
|
31
|
-
"@dxos/
|
|
32
|
-
"@dxos/
|
|
33
|
-
"@dxos/
|
|
34
|
-
"@dxos/
|
|
35
|
-
"@dxos/echo-pipeline": "0.4.7-main.
|
|
36
|
-
"@dxos/echo-schema": "0.4.7-main.
|
|
37
|
-
"@dxos/feed-store": "0.4.7-main.
|
|
38
|
-
"@dxos/invariant": "0.4.7-main.
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/network-manager": "0.4.7-main.
|
|
46
|
-
"@dxos/node-std": "0.4.7-main.
|
|
47
|
-
"@dxos/protocols": "0.4.7-main.
|
|
48
|
-
"@dxos/random-access-storage": "0.4.7-main.
|
|
49
|
-
"@dxos/rpc": "0.4.7-main.
|
|
50
|
-
"@dxos/teleport": "0.4.7-main.
|
|
51
|
-
"@dxos/teleport-extension-gossip": "0.4.7-main.
|
|
52
|
-
"@dxos/teleport-extension-object-sync": "0.4.7-main.
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/tracing": "0.4.7-main.
|
|
56
|
-
"@dxos/
|
|
57
|
-
"@dxos/
|
|
25
|
+
"@dxos/async": "0.4.7-main.e0789ae",
|
|
26
|
+
"@dxos/client-protocol": "0.4.7-main.e0789ae",
|
|
27
|
+
"@dxos/codec-protobuf": "0.4.7-main.e0789ae",
|
|
28
|
+
"@dxos/config": "0.4.7-main.e0789ae",
|
|
29
|
+
"@dxos/context": "0.4.7-main.e0789ae",
|
|
30
|
+
"@dxos/credentials": "0.4.7-main.e0789ae",
|
|
31
|
+
"@dxos/debug": "0.4.7-main.e0789ae",
|
|
32
|
+
"@dxos/crypto": "0.4.7-main.e0789ae",
|
|
33
|
+
"@dxos/document-model": "0.4.7-main.e0789ae",
|
|
34
|
+
"@dxos/echo-db": "0.4.7-main.e0789ae",
|
|
35
|
+
"@dxos/echo-pipeline": "0.4.7-main.e0789ae",
|
|
36
|
+
"@dxos/echo-schema": "0.4.7-main.e0789ae",
|
|
37
|
+
"@dxos/feed-store": "0.4.7-main.e0789ae",
|
|
38
|
+
"@dxos/invariant": "0.4.7-main.e0789ae",
|
|
39
|
+
"@dxos/keyring": "0.4.7-main.e0789ae",
|
|
40
|
+
"@dxos/keys": "0.4.7-main.e0789ae",
|
|
41
|
+
"@dxos/lock-file": "0.4.7-main.e0789ae",
|
|
42
|
+
"@dxos/messaging": "0.4.7-main.e0789ae",
|
|
43
|
+
"@dxos/model-factory": "0.4.7-main.e0789ae",
|
|
44
|
+
"@dxos/log": "0.4.7-main.e0789ae",
|
|
45
|
+
"@dxos/network-manager": "0.4.7-main.e0789ae",
|
|
46
|
+
"@dxos/node-std": "0.4.7-main.e0789ae",
|
|
47
|
+
"@dxos/protocols": "0.4.7-main.e0789ae",
|
|
48
|
+
"@dxos/random-access-storage": "0.4.7-main.e0789ae",
|
|
49
|
+
"@dxos/rpc": "0.4.7-main.e0789ae",
|
|
50
|
+
"@dxos/teleport": "0.4.7-main.e0789ae",
|
|
51
|
+
"@dxos/teleport-extension-gossip": "0.4.7-main.e0789ae",
|
|
52
|
+
"@dxos/teleport-extension-object-sync": "0.4.7-main.e0789ae",
|
|
53
|
+
"@dxos/text-model": "0.4.7-main.e0789ae",
|
|
54
|
+
"@dxos/timeframe": "0.4.7-main.e0789ae",
|
|
55
|
+
"@dxos/tracing": "0.4.7-main.e0789ae",
|
|
56
|
+
"@dxos/util": "0.4.7-main.e0789ae",
|
|
57
|
+
"@dxos/websocket-rpc": "0.4.7-main.e0789ae"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@types/platform": "^1.3.4",
|
|
61
61
|
"@types/readable-stream": "^2.3.9",
|
|
62
|
-
"@dxos/signal": "0.4.7-main.
|
|
62
|
+
"@dxos/signal": "0.4.7-main.e0789ae"
|
|
63
63
|
},
|
|
64
64
|
"publishConfig": {
|
|
65
65
|
"access": "public"
|
|
@@ -6,6 +6,7 @@ import { expect } from 'chai';
|
|
|
6
6
|
|
|
7
7
|
import { Trigger } from '@dxos/async';
|
|
8
8
|
import { Context } from '@dxos/context';
|
|
9
|
+
import { log } from '@dxos/log';
|
|
9
10
|
import { type DevicesService, type Device } from '@dxos/protocols/proto/dxos/client/services';
|
|
10
11
|
import { afterEach, afterTest, beforeEach, describe, test } from '@dxos/test';
|
|
11
12
|
|
|
@@ -44,10 +45,13 @@ describe('DevicesService', () => {
|
|
|
44
45
|
test('returns empty list if no identity is available', async () => {
|
|
45
46
|
const query = devicesService.queryDevices();
|
|
46
47
|
const result = new Trigger<Device[] | undefined>();
|
|
47
|
-
query.subscribe(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
query.subscribe(
|
|
49
|
+
({ devices }) => {
|
|
50
|
+
result.wake(devices);
|
|
51
|
+
},
|
|
52
|
+
(err) => log.catch(err),
|
|
53
|
+
);
|
|
54
|
+
afterTest(() => query.close().catch((err) => log.catch(err)));
|
|
51
55
|
expect(await result.wait()).to.be.length(0);
|
|
52
56
|
});
|
|
53
57
|
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import { EventSubscriptions } from '@dxos/async';
|
|
6
6
|
import { Stream } from '@dxos/codec-protobuf';
|
|
7
|
+
import { invariant } from '@dxos/invariant';
|
|
7
8
|
import {
|
|
8
|
-
|
|
9
|
+
Device,
|
|
9
10
|
DeviceKind,
|
|
10
11
|
type DevicesService,
|
|
11
12
|
type QueryDevicesResponse,
|
|
@@ -28,27 +29,62 @@ export class DevicesServiceImpl implements DevicesService {
|
|
|
28
29
|
if (!deviceKeys) {
|
|
29
30
|
next({ devices: [] });
|
|
30
31
|
} else {
|
|
32
|
+
invariant(this._identityManager.identity?.presence, 'presence not present');
|
|
33
|
+
const peers = this._identityManager.identity.presence.getPeersOnline();
|
|
31
34
|
next({
|
|
32
|
-
devices: Array.from(deviceKeys.entries()).map(([key, profile]) =>
|
|
33
|
-
deviceKey
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
devices: Array.from(deviceKeys.entries()).map(([key, profile]) => {
|
|
36
|
+
const isMe = this._identityManager.identity?.deviceKey.equals(key);
|
|
37
|
+
const peerState = peers.find((peer) => peer.identityKey.equals(key));
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
deviceKey: key,
|
|
41
|
+
kind: this._identityManager.identity?.deviceKey.equals(key) ? DeviceKind.CURRENT : DeviceKind.TRUSTED,
|
|
42
|
+
profile,
|
|
43
|
+
presence: isMe
|
|
44
|
+
? Device.PresenceState.ONLINE
|
|
45
|
+
: peerState
|
|
46
|
+
? Device.PresenceState.ONLINE
|
|
47
|
+
: Device.PresenceState.OFFLINE,
|
|
48
|
+
};
|
|
49
|
+
}),
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
let identitySubscribed = false;
|
|
55
|
+
let presenceSubscribed = false;
|
|
56
|
+
const subscribeIdentity = () => {
|
|
57
|
+
if (!identitySubscribed) {
|
|
58
|
+
this._identityManager.identity?.stateUpdate.on(() => {
|
|
59
|
+
update();
|
|
37
60
|
});
|
|
61
|
+
identitySubscribed = true;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const subscribePresence = () => {
|
|
66
|
+
if (!presenceSubscribed) {
|
|
67
|
+
this._identityManager.identity?.presence?.updated.on(() => {
|
|
68
|
+
update();
|
|
69
|
+
});
|
|
70
|
+
presenceSubscribed = true;
|
|
38
71
|
}
|
|
39
72
|
};
|
|
40
73
|
|
|
41
74
|
const subscriptions = new EventSubscriptions();
|
|
75
|
+
|
|
76
|
+
if (this._identityManager.identity) {
|
|
77
|
+
subscribeIdentity();
|
|
78
|
+
subscribePresence();
|
|
79
|
+
}
|
|
80
|
+
|
|
42
81
|
subscriptions.add(
|
|
43
82
|
this._identityManager.stateUpdate.on(() => {
|
|
44
83
|
update();
|
|
45
84
|
|
|
46
85
|
if (this._identityManager.identity) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
update();
|
|
50
|
-
}),
|
|
51
|
-
);
|
|
86
|
+
subscribeIdentity();
|
|
87
|
+
subscribePresence();
|
|
52
88
|
}
|
|
53
89
|
}),
|
|
54
90
|
);
|