@dxos/client-services 0.5.9-main.bdf733d → 0.5.9-main.bf0ae3e
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-KNGR7BYM.mjs → chunk-4IR3JP4U.mjs} +767 -605
- package/dist/lib/browser/chunk-4IR3JP4U.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 +11 -11
- package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
- package/dist/lib/node/{chunk-WWHTBQNR.cjs → chunk-ZBIDLLZ4.cjs} +982 -824
- package/dist/lib/node/chunk-ZBIDLLZ4.cjs.map +7 -0
- package/dist/lib/node/index.cjs +42 -42
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +17 -17
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- package/dist/types/src/packlets/identity/default-space-state-machine.d.ts +19 -0
- package/dist/types/src/packlets/identity/default-space-state-machine.d.ts.map +1 -0
- package/dist/types/src/packlets/identity/identity-service.d.ts +14 -7
- package/dist/types/src/packlets/identity/identity-service.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity.d.ts +4 -1
- package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts +5 -3
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts +1 -0
- package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts +8 -6
- package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +36 -36
- package/src/packlets/identity/default-space-state-machine.ts +44 -0
- package/src/packlets/identity/identity-service.test.ts +35 -5
- package/src/packlets/identity/identity-service.ts +50 -8
- package/src/packlets/identity/identity.ts +25 -2
- package/src/packlets/services/service-context.ts +1 -4
- package/src/packlets/services/service-host.ts +13 -40
- package/src/packlets/spaces/data-space-manager.test.ts +46 -1
- package/src/packlets/spaces/data-space-manager.ts +54 -25
- package/src/packlets/spaces/data-space.ts +24 -5
- package/src/packlets/spaces/spaces-service.ts +2 -2
- package/src/packlets/testing/test-builder.ts +12 -10
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-KNGR7BYM.mjs.map +0 -7
- package/dist/lib/node/chunk-WWHTBQNR.cjs.map +0 -7
|
@@ -30,7 +30,7 @@ __export(testing_exports, {
|
|
|
30
30
|
sanitizeInvitation: () => sanitizeInvitation
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(testing_exports);
|
|
33
|
-
var
|
|
33
|
+
var import_chunk_ZBIDLLZ4 = require("../../chunk-ZBIDLLZ4.cjs");
|
|
34
34
|
var import_credentials = require("@dxos/credentials");
|
|
35
35
|
var import_keys = require("@dxos/keys");
|
|
36
36
|
var import_async = require("@dxos/async");
|
|
@@ -227,7 +227,7 @@ var createInvitation = async (host, options) => {
|
|
|
227
227
|
authMethod: import_services.Invitation.AuthMethod.NONE,
|
|
228
228
|
...options ?? {}
|
|
229
229
|
};
|
|
230
|
-
if (host instanceof
|
|
230
|
+
if (host instanceof import_chunk_ZBIDLLZ4.ServiceContext) {
|
|
231
231
|
return host.invitationsManager.createInvitation({
|
|
232
232
|
kind: import_services.Invitation.Kind.SPACE,
|
|
233
233
|
...options
|
|
@@ -237,7 +237,7 @@ var createInvitation = async (host, options) => {
|
|
|
237
237
|
};
|
|
238
238
|
var acceptInvitation = (guest, invitation, guestDeviceProfile) => {
|
|
239
239
|
invitation = sanitizeInvitation(invitation);
|
|
240
|
-
if (guest instanceof
|
|
240
|
+
if (guest instanceof import_chunk_ZBIDLLZ4.ServiceContext) {
|
|
241
241
|
return guest.invitationsManager.acceptInvitation({
|
|
242
242
|
invitation,
|
|
243
243
|
deviceProfile: guestDeviceProfile
|
|
@@ -246,7 +246,7 @@ var acceptInvitation = (guest, invitation, guestDeviceProfile) => {
|
|
|
246
246
|
return guest.join(invitation, guestDeviceProfile);
|
|
247
247
|
};
|
|
248
248
|
var createServiceHost = (config, signalManagerContext) => {
|
|
249
|
-
return new
|
|
249
|
+
return new import_chunk_ZBIDLLZ4.ClientServicesHost({
|
|
250
250
|
config,
|
|
251
251
|
signalManager: new import_messaging.MemorySignalManager(signalManagerContext),
|
|
252
252
|
transportFactory: import_network_manager.MemoryTransportFactory
|
|
@@ -254,7 +254,7 @@ var createServiceHost = (config, signalManagerContext) => {
|
|
|
254
254
|
};
|
|
255
255
|
var createServiceContext = async ({ signalContext = new import_messaging.MemorySignalManagerContext(), storage = (0, import_random_access_storage.createStorage)({
|
|
256
256
|
type: import_random_access_storage.StorageType.RAM
|
|
257
|
-
}) } = {}) => {
|
|
257
|
+
}), runtimeParams } = {}) => {
|
|
258
258
|
const signalManager = new import_messaging.MemorySignalManager(signalContext);
|
|
259
259
|
const networkManager = new import_network_manager.SwarmNetworkManager({
|
|
260
260
|
signalManager,
|
|
@@ -262,10 +262,11 @@ var createServiceContext = async ({ signalContext = new import_messaging.MemoryS
|
|
|
262
262
|
});
|
|
263
263
|
const level = (0, import_testing.createTestLevel)();
|
|
264
264
|
await level.open();
|
|
265
|
-
return new
|
|
265
|
+
return new import_chunk_ZBIDLLZ4.ServiceContext(storage, level, networkManager, signalManager, {
|
|
266
266
|
invitationConnectionDefaultParams: {
|
|
267
267
|
controlHeartbeatInterval: 200
|
|
268
|
-
}
|
|
268
|
+
},
|
|
269
|
+
...runtimeParams
|
|
269
270
|
});
|
|
270
271
|
};
|
|
271
272
|
var createPeers = async (numPeers) => {
|
|
@@ -297,11 +298,11 @@ var TestBuilder = class {
|
|
|
297
298
|
}
|
|
298
299
|
};
|
|
299
300
|
var TestPeer = class {
|
|
300
|
-
constructor(
|
|
301
|
+
constructor(_signalContext, _opts = {
|
|
301
302
|
dataStore: import_random_access_storage.StorageType.RAM
|
|
302
303
|
}) {
|
|
303
|
-
this.
|
|
304
|
-
this.
|
|
304
|
+
this._signalContext = _signalContext;
|
|
305
|
+
this._opts = _opts;
|
|
305
306
|
this._props = {};
|
|
306
307
|
}
|
|
307
308
|
get props() {
|
|
@@ -309,7 +310,7 @@ var TestPeer = class {
|
|
|
309
310
|
}
|
|
310
311
|
get storage() {
|
|
311
312
|
return this._props.storage ??= (0, import_random_access_storage.createStorage)({
|
|
312
|
-
type: this.
|
|
313
|
+
type: this._opts.dataStore
|
|
313
314
|
});
|
|
314
315
|
}
|
|
315
316
|
get keyring() {
|
|
@@ -340,7 +341,7 @@ var TestPeer = class {
|
|
|
340
341
|
}
|
|
341
342
|
get networkManager() {
|
|
342
343
|
return this._props.networkManager ??= new import_network_manager.SwarmNetworkManager({
|
|
343
|
-
signalManager: new import_messaging.MemorySignalManager(this.
|
|
344
|
+
signalManager: new import_messaging.MemorySignalManager(this._signalContext),
|
|
344
345
|
transportFactory: import_network_manager.MemoryTransportFactory
|
|
345
346
|
});
|
|
346
347
|
}
|
|
@@ -358,17 +359,16 @@ var TestPeer = class {
|
|
|
358
359
|
}
|
|
359
360
|
get echoHost() {
|
|
360
361
|
return this._props.echoHost ??= new import_echo_db.EchoHost({
|
|
361
|
-
kv: this.level
|
|
362
|
-
storage: this.storage
|
|
362
|
+
kv: this.level
|
|
363
363
|
});
|
|
364
364
|
}
|
|
365
365
|
get dataSpaceManager() {
|
|
366
|
-
return this._props.dataSpaceManager ??= new
|
|
366
|
+
return this._props.dataSpaceManager ??= new import_chunk_ZBIDLLZ4.DataSpaceManager(this.spaceManager, this.metadataStore, this.keyring, this.identity, this.feedStore, this.echoHost, this.invitationsManager, this._opts.dataSpaceParams);
|
|
367
367
|
}
|
|
368
368
|
get invitationsManager() {
|
|
369
|
-
return this._props.invitationsManager ??= new
|
|
369
|
+
return this._props.invitationsManager ??= new import_chunk_ZBIDLLZ4.InvitationsManager(new import_chunk_ZBIDLLZ4.InvitationsHandler(this.networkManager), (invitation) => {
|
|
370
370
|
if (invitation.kind === import_services2.Invitation.Kind.SPACE) {
|
|
371
|
-
return new
|
|
371
|
+
return new import_chunk_ZBIDLLZ4.SpaceInvitationProtocol(this.dataSpaceManager, this.identity, this.keyring, invitation.spaceKey);
|
|
372
372
|
} else {
|
|
373
373
|
throw new Error("not implemented");
|
|
374
374
|
}
|
|
@@ -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 codeInputDelay?: number;\n};\n\nexport type Result = { invitation?: Invitation; error?: Error };\n\nexport const performInvitation = ({\n host,\n guest,\n options,\n hooks,\n guestDeviceProfile,\n codeInputDelay,\n}: PerformInvitationParams): [Promise<Result>, Promise<Result>] => {\n let guestError = false;\n let guestConnected = false;\n const hostComplete = new Trigger<Result>();\n const guestComplete = new Trigger<Result>();\n const authCode = new Trigger<string>();\n\n void createInvitation(host, options).then((hostObservable) => {\n hostObservable.subscribe(\n async (hostInvitation: Invitation) => {\n switch (hostInvitation.state) {\n case Invitation.State.CONNECTING: {\n if (guestConnected) {\n break;\n }\n guestConnected = true;\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 const code = await authCode.wait();\n if (codeInputDelay == null) {\n await guestObservable.authenticate(code);\n } else {\n setTimeout(async () => {\n if (!guestError) {\n await guestObservable.authenticate(code);\n }\n }, codeInputDelay);\n }\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 guestError = true;\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\n return [hostComplete.wait(), guestComplete.wait()];\n};\n\nconst createInvitation = async (\n host: ServiceContext | InvitationHost,\n options?: Partial<Invitation>,\n): Promise<CancellableInvitation> => {\n options ??= {\n authMethod: Invitation.AuthMethod.NONE,\n ...(options ?? {}),\n };\n\n if (host instanceof ServiceContext) {\n return host.invitationsManager.createInvitation({\n kind: Invitation.Kind.SPACE,\n ...options,\n });\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 return guest.invitationsManager.acceptInvitation({\n invitation,\n deviceProfile: guestDeviceProfile,\n });\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 { EchoHost } from '@dxos/echo-db';\nimport { MetadataStore, SnapshotStore, SpaceManager, valueEncoding } from '@dxos/echo-pipeline';\nimport { FeedFactory, FeedStore } from '@dxos/feed-store';\nimport { Keyring } from '@dxos/keyring';\nimport { type LevelDB } from '@dxos/kv-store';\nimport { createTestLevel } from '@dxos/kv-store/testing';\nimport { MemorySignalManager, MemorySignalManagerContext } from '@dxos/messaging';\nimport { MemoryTransportFactory, SwarmNetworkManager } from '@dxos/network-manager';\nimport { Invitation } from '@dxos/protocols/proto/dxos/client/services';\nimport { createStorage, StorageType, type Storage } from '@dxos/random-access-storage';\nimport { BlobStore } from '@dxos/teleport-extension-object-sync';\n\nimport { InvitationsHandler, InvitationsManager, SpaceInvitationProtocol } from '../invitations';\nimport { ClientServicesHost, 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 = async ({\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 SwarmNetworkManager({\n signalManager,\n transportFactory: MemoryTransportFactory,\n });\n const level = createTestLevel();\n await level.open();\n\n return new ServiceContext(storage, level, networkManager, signalManager, {\n invitationConnectionDefaultParams: { controlHeartbeatInterval: 200 },\n });\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 = await 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\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 level?: LevelDB;\n feedStore?: FeedStore<any>;\n metadataStore?: MetadataStore;\n keyring?: Keyring;\n networkManager?: SwarmNetworkManager;\n spaceManager?: SpaceManager;\n dataSpaceManager?: DataSpaceManager;\n snapshotStore?: SnapshotStore;\n signingContext?: SigningContext;\n blobStore?: BlobStore;\n echoHost?: EchoHost;\n invitationsManager?: InvitationsManager;\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 level() {\n return (this._props.level ??= createTestLevel());\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 SwarmNetworkManager({\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 snapshotStore: this.snapshotStore,\n blobStore: this.blobStore,\n }));\n }\n\n get identity() {\n return this._props.signingContext ?? failUndefined();\n }\n\n get echoHost() {\n return (this._props.echoHost ??= new EchoHost({\n kv: this.level,\n storage: this.storage,\n }));\n }\n\n get dataSpaceManager(): DataSpaceManager {\n return (this._props.dataSpaceManager ??= new DataSpaceManager(\n this.spaceManager,\n this.metadataStore,\n this.keyring,\n this.identity,\n this.feedStore,\n this.echoHost,\n this.invitationsManager,\n ));\n }\n\n get invitationsManager() {\n return (this._props.invitationsManager ??= new InvitationsManager(\n new InvitationsHandler(this.networkManager),\n (invitation) => {\n if (invitation.kind === Invitation.Kind.SPACE) {\n return new SpaceInvitationProtocol(this.dataSpaceManager, this.identity!, this.keyring, invitation.spaceKey!);\n } else {\n throw new Error('not implemented');\n }\n },\n this.metadataStore,\n ));\n }\n\n async createIdentity() {\n this._props.signingContext ??= await createSigningContext(this.keyring);\n }\n\n async destroy() {\n await this.level.close();\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,qBAAyB;AACzB,2BAA0E;AAC1E,wBAAuC;AACvC,qBAAwB;AAExB,qBAAgC;AAChC,uBAAgE;AAChE,6BAA4D;AAC5D,IAAAC,mBAA2B;AAC3B,mCAAyD;AACzD,4CAA0B;AFTnB,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,OAA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AAMkD,mBAAmB5B,iBAAiB;MAC/C5B;MACA6D,eAAepD;IACjB,CAAA;EACF;AAEA,SAAOH,MAAMwD,KAAK9D,YAAYS,kBAAAA;AAChC;ACvNO,IAAMsD,oBAAoB,CAACC,QAAgBC,yBAAAA;AAChD,SAAO,IAAIC,yCAAmB;IAC5BF;IACAG,eAAe,IAAIC,qCAAoBH,oBAAAA;IACvCI,kBAAkBC;EACpB,CAAA;AACF;AAEO,IAAMC,uBAAuB,OAAO,EACzCC,gBAAgB,IAAIC,4CAAAA,GACpBC,cAAUC,4CAAc;EAAEC,MAAMC,yCAAYC;AAAI,CAAA,
|
|
6
|
-
"names": ["import_credentials", "import_services", "createMockCredential", "signer", "issuer", "createCredential", "subject", "PublicKey", "Buffer", "from", "assertion", "payload", "value", "sanitizeInvitation", "invitation", "InvitationEncoder", "decode", "encode", "performInvitation", "host", "guest", "options", "hooks", "guestDeviceProfile", "codeInputDelay", "guestError", "guestConnected", "hostComplete", "Trigger", "guestComplete", "authCode", "createInvitation", "then", "hostObservable", "subscribe", "hostInvitation", "state", "Invitation", "State", "CONNECTING", "onConnecting", "guestObservable", "acceptInvitation", "guestInvitation", "invariant", "swarmKey", "equals", "CONNECTED", "onConnected", "READY_FOR_AUTHENTICATION", "onReady", "code", "wait", "authenticate", "setTimeout", "AUTHENTICATING", "onAuthenticating", "SUCCESS", "onSuccess", "wake", "CANCELLED", "onCancelled", "TIMEOUT", "onTimeout", "error", "onError", "authMethod", "AuthMethod", "NONE", "ServiceContext", "invitationsManager", "kind", "Kind", "SPACE", "share", "deviceProfile", "join", "createServiceHost", "config", "signalManagerContext", "ClientServicesHost", "signalManager", "MemorySignalManager", "transportFactory", "MemoryTransportFactory", "createServiceContext", "signalContext", "MemorySignalManagerContext", "storage", "createStorage", "type", "StorageType", "RAM", "networkManager", "SwarmNetworkManager", "level", "createTestLevel", "open", "invitationConnectionDefaultParams", "controlHeartbeatInterval", "createPeers", "numPeers", "Promise", "all", "Array", "map", "peer", "Context", "createIdentity", "TestBuilder", "_ctx", "createPeer", "peerOptions", "TestPeer", "onDispose", "destroy", "dispose", "constructor", "
|
|
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 codeInputDelay?: number;\n};\n\nexport type Result = { invitation?: Invitation; error?: Error };\n\nexport const performInvitation = ({\n host,\n guest,\n options,\n hooks,\n guestDeviceProfile,\n codeInputDelay,\n}: PerformInvitationParams): [Promise<Result>, Promise<Result>] => {\n let guestError = false;\n let guestConnected = false;\n const hostComplete = new Trigger<Result>();\n const guestComplete = new Trigger<Result>();\n const authCode = new Trigger<string>();\n\n void createInvitation(host, options).then((hostObservable) => {\n hostObservable.subscribe(\n async (hostInvitation: Invitation) => {\n switch (hostInvitation.state) {\n case Invitation.State.CONNECTING: {\n if (guestConnected) {\n break;\n }\n guestConnected = true;\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 const code = await authCode.wait();\n if (codeInputDelay == null) {\n await guestObservable.authenticate(code);\n } else {\n setTimeout(async () => {\n if (!guestError) {\n await guestObservable.authenticate(code);\n }\n }, codeInputDelay);\n }\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 guestError = true;\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\n return [hostComplete.wait(), guestComplete.wait()];\n};\n\nconst createInvitation = async (\n host: ServiceContext | InvitationHost,\n options?: Partial<Invitation>,\n): Promise<CancellableInvitation> => {\n options ??= {\n authMethod: Invitation.AuthMethod.NONE,\n ...(options ?? {}),\n };\n\n if (host instanceof ServiceContext) {\n return host.invitationsManager.createInvitation({\n kind: Invitation.Kind.SPACE,\n ...options,\n });\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 return guest.invitationsManager.acceptInvitation({\n invitation,\n deviceProfile: guestDeviceProfile,\n });\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 { EchoHost } from '@dxos/echo-db';\nimport { MetadataStore, SnapshotStore, SpaceManager, valueEncoding } from '@dxos/echo-pipeline';\nimport { FeedFactory, FeedStore } from '@dxos/feed-store';\nimport { Keyring } from '@dxos/keyring';\nimport { type LevelDB } from '@dxos/kv-store';\nimport { createTestLevel } from '@dxos/kv-store/testing';\nimport { MemorySignalManager, MemorySignalManagerContext } from '@dxos/messaging';\nimport { MemoryTransportFactory, SwarmNetworkManager } from '@dxos/network-manager';\nimport { Invitation } from '@dxos/protocols/proto/dxos/client/services';\nimport { createStorage, StorageType, type Storage } from '@dxos/random-access-storage';\nimport { BlobStore } from '@dxos/teleport-extension-object-sync';\n\nimport { InvitationsHandler, InvitationsManager, SpaceInvitationProtocol } from '../invitations';\nimport { ClientServicesHost, ServiceContext, type ServiceContextRuntimeParams } from '../services';\nimport { DataSpaceManager, type DataSpaceManagerRuntimeParams, 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 = async ({\n signalContext = new MemorySignalManagerContext(),\n storage = createStorage({ type: StorageType.RAM }),\n runtimeParams,\n}: {\n signalContext?: MemorySignalManagerContext;\n storage?: Storage;\n runtimeParams?: ServiceContextRuntimeParams;\n} = {}) => {\n const signalManager = new MemorySignalManager(signalContext);\n const networkManager = new SwarmNetworkManager({\n signalManager,\n transportFactory: MemoryTransportFactory,\n });\n const level = createTestLevel();\n await level.open();\n\n return new ServiceContext(storage, level, networkManager, signalManager, {\n invitationConnectionDefaultParams: { controlHeartbeatInterval: 200 },\n ...runtimeParams,\n });\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 = await 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\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 dataSpaceParams?: DataSpaceManagerRuntimeParams;\n};\n\nexport type TestPeerProps = {\n storage?: Storage;\n level?: LevelDB;\n feedStore?: FeedStore<any>;\n metadataStore?: MetadataStore;\n keyring?: Keyring;\n networkManager?: SwarmNetworkManager;\n spaceManager?: SpaceManager;\n dataSpaceManager?: DataSpaceManager;\n snapshotStore?: SnapshotStore;\n signingContext?: SigningContext;\n blobStore?: BlobStore;\n echoHost?: EchoHost;\n invitationsManager?: InvitationsManager;\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 level() {\n return (this._props.level ??= createTestLevel());\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 SwarmNetworkManager({\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 snapshotStore: this.snapshotStore,\n blobStore: this.blobStore,\n }));\n }\n\n get identity() {\n return this._props.signingContext ?? failUndefined();\n }\n\n get echoHost() {\n return (this._props.echoHost ??= new EchoHost({ kv: this.level }));\n }\n\n get dataSpaceManager(): DataSpaceManager {\n return (this._props.dataSpaceManager ??= new DataSpaceManager(\n this.spaceManager,\n this.metadataStore,\n this.keyring,\n this.identity,\n this.feedStore,\n this.echoHost,\n this.invitationsManager,\n this._opts.dataSpaceParams,\n ));\n }\n\n get invitationsManager() {\n return (this._props.invitationsManager ??= new InvitationsManager(\n new InvitationsHandler(this.networkManager),\n (invitation) => {\n if (invitation.kind === Invitation.Kind.SPACE) {\n return new SpaceInvitationProtocol(this.dataSpaceManager, this.identity!, this.keyring, invitation.spaceKey!);\n } else {\n throw new Error('not implemented');\n }\n },\n this.metadataStore,\n ));\n }\n\n async createIdentity() {\n this._props.signingContext ??= await createSigningContext(this.keyring);\n }\n\n async destroy() {\n await this.level.close();\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,qBAAyB;AACzB,2BAA0E;AAC1E,wBAAuC;AACvC,qBAAwB;AAExB,qBAAgC;AAChC,uBAAgE;AAChE,6BAA4D;AAC5D,IAAAC,mBAA2B;AAC3B,mCAAyD;AACzD,4CAA0B;AFTnB,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;AAmCO,IAAMI,oBAAoB,CAAC,EAChCC,MACAC,OACAC,SACAC,OACAC,oBACAC,eAAc,MACU;AACxB,MAAIC,aAAa;AACjB,MAAIC,iBAAiB;AACrB,QAAMC,eAAe,IAAIC,qBAAAA;AACzB,QAAMC,gBAAgB,IAAID,qBAAAA;AAC1B,QAAME,WAAW,IAAIF,qBAAAA;AAErB,OAAK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A;IAAa;IAC/BC,YAAY,MAAMC;EACpB;AACF;",
|
|
6
|
+
"names": ["import_credentials", "import_services", "createMockCredential", "signer", "issuer", "createCredential", "subject", "PublicKey", "Buffer", "from", "assertion", "payload", "value", "sanitizeInvitation", "invitation", "InvitationEncoder", "decode", "encode", "performInvitation", "host", "guest", "options", "hooks", "guestDeviceProfile", "codeInputDelay", "guestError", "guestConnected", "hostComplete", "Trigger", "guestComplete", "authCode", "createInvitation", "then", "hostObservable", "subscribe", "hostInvitation", "state", "Invitation", "State", "CONNECTING", "onConnecting", "guestObservable", "acceptInvitation", "guestInvitation", "invariant", "swarmKey", "equals", "CONNECTED", "onConnected", "READY_FOR_AUTHENTICATION", "onReady", "code", "wait", "authenticate", "setTimeout", "AUTHENTICATING", "onAuthenticating", "SUCCESS", "onSuccess", "wake", "CANCELLED", "onCancelled", "TIMEOUT", "onTimeout", "error", "onError", "authMethod", "AuthMethod", "NONE", "ServiceContext", "invitationsManager", "kind", "Kind", "SPACE", "share", "deviceProfile", "join", "createServiceHost", "config", "signalManagerContext", "ClientServicesHost", "signalManager", "MemorySignalManager", "transportFactory", "MemoryTransportFactory", "createServiceContext", "signalContext", "MemorySignalManagerContext", "storage", "createStorage", "type", "StorageType", "RAM", "runtimeParams", "networkManager", "SwarmNetworkManager", "level", "createTestLevel", "open", "invitationConnectionDefaultParams", "controlHeartbeatInterval", "createPeers", "numPeers", "Promise", "all", "Array", "map", "peer", "Context", "createIdentity", "TestBuilder", "_ctx", "createPeer", "peerOptions", "TestPeer", "onDispose", "destroy", "dispose", "constructor", "_signalContext", "_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", "echoHost", "EchoHost", "kv", "dataSpaceManager", "DataSpaceManager", "dataSpaceParams", "InvitationsManager", "InvitationsHandler", "SpaceInvitationProtocol", "spaceKey", "Error", "createSigningContext", "close", "reset", "identityKey", "createKey", "deviceKey", "credentialSigner", "createCredentialSignerWithChain", "credential", "CredentialGenerator", "createDeviceAuthorization", "recordCredential", "getProfile", "undefined"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type CredentialProcessor } from '@dxos/credentials';
|
|
2
|
+
import { SpaceId, type PublicKey } from '@dxos/keys';
|
|
3
|
+
import { type Credential } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
4
|
+
type DefaultSpaceStateMachineParams = {
|
|
5
|
+
identityKey: PublicKey;
|
|
6
|
+
onUpdate?: () => void;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Processes device invitation credentials.
|
|
10
|
+
*/
|
|
11
|
+
export declare class DefaultSpaceStateMachine implements CredentialProcessor {
|
|
12
|
+
private readonly _params;
|
|
13
|
+
private _spaceId;
|
|
14
|
+
constructor(_params: DefaultSpaceStateMachineParams);
|
|
15
|
+
get spaceId(): SpaceId | undefined;
|
|
16
|
+
processCredential(credential: Credential): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=default-space-state-machine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-space-state-machine.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/identity/default-space-state-machine.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,mBAAmB,EAA0B,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAE,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAErD,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,6CAA6C,CAAC;AAE9E,KAAK,8BAA8B,GAAG;IACpC,WAAW,EAAE,SAAS,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB,CAAC;AAEF;;GAEG;AACH,qBAAa,wBAAyB,YAAW,mBAAmB;IAGtD,OAAO,CAAC,QAAQ,CAAC,OAAO;IAFpC,OAAO,CAAC,QAAQ,CAAsB;gBAET,OAAO,EAAE,8BAA8B;IAEpE,IAAW,OAAO,IAAI,OAAO,GAAG,SAAS,CAExC;IAEK,iBAAiB,CAAC,UAAU,EAAE,UAAU;CAiB/C"}
|
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
import { Stream } from '@dxos/codec-protobuf';
|
|
2
|
+
import { Resource } from '@dxos/context';
|
|
2
3
|
import { type Keyring } from '@dxos/keyring';
|
|
3
|
-
import { type CreateIdentityRequest, type Identity, type IdentityService, type QueryIdentityResponse, type RecoverIdentityRequest, type SignPresentationRequest } from '@dxos/protocols/proto/dxos/client/services';
|
|
4
|
+
import { type CreateIdentityRequest, type Identity as IdentityProto, type IdentityService, type QueryIdentityResponse, type RecoverIdentityRequest, type SignPresentationRequest } from '@dxos/protocols/proto/dxos/client/services';
|
|
4
5
|
import { type Presentation, type ProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
6
|
+
import { type Identity } from './identity';
|
|
5
7
|
import { type CreateIdentityOptions, type IdentityManager } from './identity-manager';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
import { type DataSpaceManager } from '../spaces';
|
|
9
|
+
export declare class IdentityServiceImpl extends Resource implements IdentityService {
|
|
8
10
|
private readonly _identityManager;
|
|
9
11
|
private readonly _keyring;
|
|
12
|
+
private readonly _dataSpaceManagerProvider;
|
|
13
|
+
private readonly _createIdentity;
|
|
10
14
|
private readonly _onProfileUpdate?;
|
|
11
|
-
constructor(_createIdentity: (params: CreateIdentityOptions) => Promise<Identity>,
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
constructor(_identityManager: IdentityManager, _keyring: Keyring, _dataSpaceManagerProvider: () => DataSpaceManager, _createIdentity: (params: CreateIdentityOptions) => Promise<Identity>, _onProfileUpdate?: ((profile: ProfileDocument | undefined) => Promise<void>) | undefined);
|
|
16
|
+
protected _open(): Promise<void>;
|
|
17
|
+
createIdentity(request: CreateIdentityRequest): Promise<IdentityProto>;
|
|
18
|
+
private _createDefaultSpace;
|
|
19
|
+
recoverIdentity(request: RecoverIdentityRequest): Promise<IdentityProto>;
|
|
14
20
|
queryIdentity(): Stream<QueryIdentityResponse>;
|
|
15
21
|
private _getIdentity;
|
|
16
|
-
updateProfile(profile: ProfileDocument): Promise<
|
|
22
|
+
updateProfile(profile: ProfileDocument): Promise<IdentityProto>;
|
|
17
23
|
signPresentation({ presentation, nonce }: SignPresentationRequest): Promise<Presentation>;
|
|
24
|
+
private _fixIdentityWithoutDefaultSpace;
|
|
18
25
|
}
|
|
19
26
|
//# sourceMappingURL=identity-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity-service.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/identity/identity-service.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"identity-service.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/identity/identity-service.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAIzC,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,QAAQ,IAAI,aAAa,EAC9B,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAE7B,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAEtG,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,KAAK,qBAAqB,EAAE,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACtF,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAElD,qBAAa,mBAAoB,SAAQ,QAAS,YAAW,eAAe;IAExE,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,yBAAyB;IAC1C,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC;gBAJjB,gBAAgB,EAAE,eAAe,EACjC,QAAQ,EAAE,OAAO,EACjB,yBAAyB,EAAE,MAAM,gBAAgB,EACjD,eAAe,EAAE,CAAC,MAAM,EAAE,qBAAqB,KAAK,OAAO,CAAC,QAAQ,CAAC,EACrE,gBAAgB,CAAC,aAAY,eAAe,GAAG,SAAS,KAAK,QAAQ,IAAI,CAAC,aAAA;cAKpE,KAAK;IAOxB,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,aAAa,CAAC;YAO9D,mBAAmB;IAO3B,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,aAAa,CAAC;IAI9E,aAAa,IAAI,MAAM,CAAC,qBAAqB,CAAC;IAS9C,OAAO,CAAC,YAAY;IAYd,aAAa,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,aAAa,CAAC;IAO/D,gBAAgB,CAAC,EAAE,YAAY,EAAE,KAAK,EAAE,EAAE,uBAAuB,GAAG,OAAO,CAAC,YAAY,CAAC;YAYjF,+BAA+B;CAkB9C"}
|
|
@@ -3,7 +3,7 @@ import { type Context } from '@dxos/context';
|
|
|
3
3
|
import { type CredentialSigner } from '@dxos/credentials';
|
|
4
4
|
import { type Signer } from '@dxos/crypto';
|
|
5
5
|
import { type Space } from '@dxos/echo-pipeline';
|
|
6
|
-
import { PublicKey } from '@dxos/keys';
|
|
6
|
+
import { PublicKey, type SpaceId } 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
9
|
import { type Presence } from '@dxos/teleport-extension-gossip';
|
|
@@ -25,12 +25,14 @@ export declare class Identity {
|
|
|
25
25
|
private readonly _presence?;
|
|
26
26
|
private readonly _deviceStateMachine;
|
|
27
27
|
private readonly _profileStateMachine;
|
|
28
|
+
private readonly _defaultSpaceStateMachine;
|
|
28
29
|
readonly authVerifier: TrustedKeySetAuthVerifier;
|
|
29
30
|
readonly identityKey: PublicKey;
|
|
30
31
|
readonly deviceKey: PublicKey;
|
|
31
32
|
readonly stateUpdate: Event<void>;
|
|
32
33
|
constructor({ space, signer, identityKey, deviceKey, presence }: IdentityParams);
|
|
33
34
|
get authorizedDeviceKeys(): ComplexMap<PublicKey, DeviceProfileDocument>;
|
|
35
|
+
get defaultSpaceId(): SpaceId | undefined;
|
|
34
36
|
open(ctx: Context): Promise<void>;
|
|
35
37
|
close(ctx: Context): Promise<void>;
|
|
36
38
|
ready(): Promise<void>;
|
|
@@ -52,6 +54,7 @@ export declare class Identity {
|
|
|
52
54
|
* Issues credentials as device.
|
|
53
55
|
*/
|
|
54
56
|
getDeviceCredentialSigner(): CredentialSigner;
|
|
57
|
+
updateDefaultSpace(spaceId: SpaceId): Promise<void>;
|
|
55
58
|
admitDevice({ deviceKey, controlFeedKey, dataFeedKey }: DeviceAdmissionRequest): Promise<void>;
|
|
56
59
|
}
|
|
57
60
|
//# sourceMappingURL=identity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/identity/identity.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAEL,KAAK,gB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AAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAW;IACtC,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAqB;IACzD,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAsB;IAC3D,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAA2B;IACrE,SAAgB,YAAY,EAAE,yBAAyB,CAAC;IAExD,SAAgB,WAAW,EAAE,SAAS,CAAC;IACvC,SAAgB,SAAS,EAAE,SAAS,CAAC;IAErC,SAAgB,WAAW,cAAe;gBAE9B,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,cAAc;IAgC/E,IAAI,oBAAoB,IAAI,UAAU,CAAC,SAAS,EAAE,qBAAqB,CAAC,CAEvE;IAED,IAAI,cAAc,IAAI,OAAO,GAAG,SAAS,CAExC;IAGK,IAAI,CAAC,GAAG,EAAE,OAAO;IASjB,KAAK,CAAC,GAAG,EAAE,OAAO;IASlB,KAAK;IAMX,IAAI,eAAe,IAAI,eAAe,GAAG,SAAS,CAEjD;IAED;;OAEG;IACH,IAAI,eAAe,mDAElB;IAED,IAAI,YAAY,cAEf;IAED,IAAI,kBAAkB,cAErB;IAED,IAAI,qBAAqB,4EAExB;IAED,IAAI,QAAQ,yBAEX;IAED;;;OAGG;IACH,2BAA2B,IAAI,gBAAgB;IAS/C;;OAEG;IACH,yBAAyB,IAAI,gBAAgB;IAIvC,kBAAkB,CAAC,OAAO,EAAE,OAAO;IASnC,WAAW,CAAC,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,EAAE,sBAAsB;CA2CrF"}
|
|
@@ -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,QAAQ,E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B,SAAS,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IAClD,SAAgB,OAAO,EAAE,OAAO,CAAC;IACjC,SAAgB,YAAY,EAAE,YAAY,CAAC;IAC3C,SAAgB,eAAe,EAAE,eAAe,CAAC;IACjD,SAAgB,WAAW,EAAE,kBAAkB,CAAC;IAChD,SAAgB,kBAAkB,EAAE,kBAAkB,CAAC;IACvD,SAAgB,QAAQ,EAAE,QAAQ,CAAC;IAG5B,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IAE3C,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAG9B;IAEJ,OAAO,CAAC,gBAAgB,CAAC,CAAsB;IAE/C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA8B;gBAGxC,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,OAAO,EACd,cAAc,EAAE,mBAAmB,EACnC,aAAa,EAAE,aAAa,EAC5B,cAAc,CAAC,yCAA6B;cA4DrC,KAAK,CAAC,GAAG,EAAE,OAAO;cAuBlB,MAAM,CAAC,GAAG,EAAE,OAAO;IAgBtC,cAAc,CAAC,MAAM,GAAE,qBAA0B;IAMvD,oBAAoB,CAAC,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,GAAG,kBAAkB;IAM9F,sBAAsB,CAAC,OAAO,EAAE,eAAe,GAAG,SAAS;YAUnD,eAAe;YAMf,oBAAoB;YAUpB,WAAW;CAgE1B"}
|
|
@@ -48,7 +48,7 @@ export declare class ClientServicesHost {
|
|
|
48
48
|
private _callbacks?;
|
|
49
49
|
private _devtoolsProxy?;
|
|
50
50
|
private _serviceContext;
|
|
51
|
-
private readonly _runtimeParams
|
|
51
|
+
private readonly _runtimeParams;
|
|
52
52
|
private diagnosticsBroadcastHandler;
|
|
53
53
|
private _opening;
|
|
54
54
|
private _open;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-host.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/services/service-host.ts"],"names":[],"mappings":"AAKA,OAAO,
|
|
1
|
+
{"version":3,"file":"service-host.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/services/service-host.ts"],"names":[],"mappings":"AAKA,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACjF,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAA0B,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EAAyD,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGrH,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAI3D,OAAO,EAAE,cAAc,EAAE,KAAK,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAiBrD,MAAM,MAAM,wBAAwB,GAAG;IACrC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,2BAA2B,CAAC;IACxC,aAAa,CAAC,EAAE,2BAA2B,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG;IACxC,OAAO,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;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,CAAC,GAAG,EAAE,OAAO;IAmGjB,KAAK;IAkBL,KAAK;YAYG,eAAe;CAK9B"}
|
|
@@ -44,14 +44,13 @@ export declare class DataSpaceManager {
|
|
|
44
44
|
private readonly _feedStore;
|
|
45
45
|
private readonly _echoHost;
|
|
46
46
|
private readonly _invitationsManager;
|
|
47
|
+
private readonly _params?;
|
|
47
48
|
private readonly _ctx;
|
|
48
49
|
readonly updated: Event<void>;
|
|
49
50
|
private readonly _spaces;
|
|
50
51
|
private _isOpen;
|
|
51
52
|
private readonly _instanceId;
|
|
52
|
-
|
|
53
|
-
private readonly _spaceMemberPresenceOfflineTimeout;
|
|
54
|
-
constructor(_spaceManager: SpaceManager, _metadataStore: MetadataStore, _keyring: Keyring, _signingContext: SigningContext, _feedStore: FeedStore<FeedMessage>, _echoHost: EchoHost, _invitationsManager: InvitationsManager, params?: DataSpaceManagerRuntimeParams);
|
|
53
|
+
constructor(_spaceManager: SpaceManager, _metadataStore: MetadataStore, _keyring: Keyring, _signingContext: SigningContext, _feedStore: FeedStore<FeedMessage>, _echoHost: EchoHost, _invitationsManager: InvitationsManager, _params?: DataSpaceManagerRuntimeParams | undefined);
|
|
55
54
|
get spaces(): ComplexMap<PublicKey, DataSpace>;
|
|
56
55
|
open(): Promise<void>;
|
|
57
56
|
close(): Promise<void>;
|
|
@@ -59,6 +58,9 @@ export declare class DataSpaceManager {
|
|
|
59
58
|
* Creates a new space writing the genesis credentials to the control feed.
|
|
60
59
|
*/
|
|
61
60
|
createSpace(): Promise<DataSpace>;
|
|
61
|
+
isDefaultSpace(space: DataSpace): Promise<boolean>;
|
|
62
|
+
createDefaultSpace(): Promise<DataSpace>;
|
|
63
|
+
private _getSpaceRootDocument;
|
|
62
64
|
acceptSpace(opts: AcceptSpaceOptions): Promise<DataSpace>;
|
|
63
65
|
/**
|
|
64
66
|
* Wait until the space data pipeline is fully initialized.
|
|
@@ -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;
|
|
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;AAK9D,OAAO,EACL,KAAK,gBAAgB,EAItB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAEL,KAAK,aAAa,EAElB,KAAK,YAAY,EAGlB,MAAM,qBAAqB,CAAC;AAG7B,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;AAIjH,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAc,UAAU,EAA+B,MAAM,YAAY,CAAC;AAEjF,OAAO,EAAE,SAAS,EAAwB,MAAM,cAAc,CAAC;AAG/D,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAQzD,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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Ae;IA+BnC,IACI,EAAE,iCAEL;IAED,IACI,GAAG,cAEN;IAED,IAAI,MAAM,YAET;IAED,IACI,KAAK,IAAI,UAAU,CAEtB;IAGD,IAAI,KAAK,UAER;IAED,IAAI,QAAQ,aAEX;IAED,IAAI,kBAAkB,uBAErB;IAED,IAAI,KAAK,2BAER;IAED,IAAI,mBAAmB,wBAEtB;IAGD,OAAO,KAAK,cAAc,GAKzB;IAGK,IAAI;YAMI,KAAK;IAeb,KAAK;YAIG,MAAM;IAkBd,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG;IAI/C,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI;;;IAIlE;;OAEG;IACH,2BAA2B;IAuBrB,sBAAsB;YA6Bd,iCAAiC;YAyBjC,oBAAoB;IAiDlC,OAAO,CAAC,mBAAmB;IAwCrB,gBAAgB,CAAC,OAAO,EAAE,eAAe;IAWzC,WAAW,CAAC,OAAO,CAAC,EAAE,kBAAkB;IA4HxC,QAAQ;IAWR,UAAU;CAajB;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB,aAAc,QAAQ,KAAG,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,SAQrF,CAAC"}
|
|
@@ -19,7 +19,7 @@ export declare class SpacesServiceImpl implements SpacesService {
|
|
|
19
19
|
subscribeMessages({ spaceKey, channel }: SubscribeMessagesRequest): Stream<GossipMessage>;
|
|
20
20
|
queryCredentials({ spaceKey, noTail }: QueryCredentialsRequest): Stream<Credential>;
|
|
21
21
|
writeCredentials({ spaceKey, credentials }: WriteCredentialsRequest): Promise<void>;
|
|
22
|
-
createEpoch({ spaceKey, migration }: CreateEpochRequest): Promise<void>;
|
|
22
|
+
createEpoch({ spaceKey, migration, automergeRootUrl }: CreateEpochRequest): Promise<void>;
|
|
23
23
|
private _serializeSpace;
|
|
24
24
|
private _requireIdentity;
|
|
25
25
|
private _updateMetr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C,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,oBAAoB;gBAFpB,gBAAgB,EAAE,eAAe,EACjC,aAAa,EAAE,YAAY,EAC3B,oBAAoB,EAAE,QAAQ,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAGtE,WAAW,IAAI,OAAO,CAAC,KAAK,CAAC;IAQ7B,WAAW,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,kBAAkB;IAmBnD,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC;IA0BvE,WAAW,IAAI,MAAM,CAAC,mBAAmB,CAAC;IAmDpC,WAAW,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,kBAAkB;IAMpE,iBAAiB,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,wBAAwB;IAajE,gBAAgB,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,uBAAuB,GAAG,MAAM,CAAC,UAAU,CAAC;IAmB7E,gBAAgB,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,EAAE,uBAAuB;IAmBnE,WAAW,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,gBAAgB,EAAE,EAAE,kBAAkB;IAM/E,OAAO,CAAC,eAAe;IA6CvB,OAAO,CAAC,gBAAgB;YASV,cAAc;CAS7B"}
|
|
@@ -9,12 +9,13 @@ import { SwarmNetworkManager } from '@dxos/network-manager';
|
|
|
9
9
|
import { StorageType, type Storage } from '@dxos/random-access-storage';
|
|
10
10
|
import { BlobStore } from '@dxos/teleport-extension-object-sync';
|
|
11
11
|
import { InvitationsManager } from '../invitations';
|
|
12
|
-
import { ClientServicesHost, ServiceContext } from '../services';
|
|
13
|
-
import { DataSpaceManager, type SigningContext } from '../spaces';
|
|
12
|
+
import { ClientServicesHost, ServiceContext, type ServiceContextRuntimeParams } from '../services';
|
|
13
|
+
import { DataSpaceManager, type DataSpaceManagerRuntimeParams, type SigningContext } from '../spaces';
|
|
14
14
|
export declare const createServiceHost: (config: Config, signalManagerContext: MemorySignalManagerContext) => ClientServicesHost;
|
|
15
|
-
export declare const createServiceContext: ({ signalContext, storage, }?: {
|
|
15
|
+
export declare const createServiceContext: ({ signalContext, storage, runtimeParams, }?: {
|
|
16
16
|
signalContext?: MemorySignalManagerContext;
|
|
17
17
|
storage?: Storage;
|
|
18
|
+
runtimeParams?: ServiceContextRuntimeParams;
|
|
18
19
|
}) => Promise<ServiceContext>;
|
|
19
20
|
export declare const createPeers: (numPeers: number) => Promise<ServiceContext[]>;
|
|
20
21
|
export declare const createIdentity: (peer: ServiceContext) => Promise<ServiceContext>;
|
|
@@ -26,6 +27,7 @@ export declare class TestBuilder {
|
|
|
26
27
|
}
|
|
27
28
|
export type TestPeerOpts = {
|
|
28
29
|
dataStore?: StorageType;
|
|
30
|
+
dataSpaceParams?: DataSpaceManagerRuntimeParams;
|
|
29
31
|
};
|
|
30
32
|
export type TestPeerProps = {
|
|
31
33
|
storage?: Storage;
|
|
@@ -43,10 +45,10 @@ export type TestPeerProps = {
|
|
|
43
45
|
invitationsManager?: InvitationsManager;
|
|
44
46
|
};
|
|
45
47
|
export declare class TestPeer {
|
|
46
|
-
private readonly
|
|
47
|
-
private readonly
|
|
48
|
+
private readonly _signalContext;
|
|
49
|
+
private readonly _opts;
|
|
48
50
|
private _props;
|
|
49
|
-
constructor(
|
|
51
|
+
constructor(_signalContext: MemorySignalManagerContext, _opts?: TestPeerOpts);
|
|
50
52
|
get props(): TestPeerProps;
|
|
51
53
|
get storage(): Storage;
|
|
52
54
|
get keyring(): Keyring;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-builder.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/testing/test-builder.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAI3C,OAAO,EAAE,QAAQ,EAAE,MAAM,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