@dxos/client-services 0.5.9-main.4ed8273 → 0.5.9-main.72c50cd
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-YJ5SPRLY.mjs → chunk-G25WUL6O.mjs} +589 -731
- package/dist/lib/browser/chunk-G25WUL6O.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 +9 -10
- package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
- package/dist/lib/node/{chunk-RQHBQWKH.cjs → chunk-FTGPY2GQ.cjs} +809 -947
- package/dist/lib/node/chunk-FTGPY2GQ.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 +15 -16
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- package/dist/types/src/packlets/identity/identity-service.d.ts +7 -14
- package/dist/types/src/packlets/identity/identity-service.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity.d.ts +1 -4
- package/dist/types/src/packlets/identity/identity.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 +3 -5
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts +6 -8
- 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/identity-service.test.ts +5 -35
- package/src/packlets/identity/identity-service.ts +8 -50
- package/src/packlets/identity/identity.ts +2 -25
- package/src/packlets/services/service-host.ts +40 -13
- package/src/packlets/spaces/data-space-manager.test.ts +1 -46
- package/src/packlets/spaces/data-space-manager.ts +25 -54
- package/src/packlets/spaces/data-space.ts +5 -10
- package/src/packlets/testing/test-builder.ts +6 -11
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-YJ5SPRLY.mjs.map +0 -7
- package/dist/lib/node/chunk-RQHBQWKH.cjs.map +0 -7
- package/dist/types/src/packlets/identity/default-space-state-machine.d.ts +0 -19
- package/dist/types/src/packlets/identity/default-space-state-machine.d.ts.map +0 -1
- package/src/packlets/identity/default-space-state-machine.ts +0 -44
|
@@ -1,19 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,44 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type CredentialProcessor, getCredentialAssertion } from '@dxos/credentials';
|
|
6
|
-
import { SpaceId, type PublicKey } from '@dxos/keys';
|
|
7
|
-
import { log } from '@dxos/log';
|
|
8
|
-
import { type Credential } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
9
|
-
|
|
10
|
-
type DefaultSpaceStateMachineParams = {
|
|
11
|
-
identityKey: PublicKey;
|
|
12
|
-
onUpdate?: () => void;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Processes device invitation credentials.
|
|
17
|
-
*/
|
|
18
|
-
export class DefaultSpaceStateMachine implements CredentialProcessor {
|
|
19
|
-
private _spaceId: SpaceId | undefined;
|
|
20
|
-
|
|
21
|
-
constructor(private readonly _params: DefaultSpaceStateMachineParams) {}
|
|
22
|
-
|
|
23
|
-
public get spaceId(): SpaceId | undefined {
|
|
24
|
-
return this._spaceId;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
async processCredential(credential: Credential) {
|
|
28
|
-
const assertion = getCredentialAssertion(credential);
|
|
29
|
-
switch (assertion['@type']) {
|
|
30
|
-
case 'dxos.halo.credentials.DefaultSpace': {
|
|
31
|
-
if (!credential.subject.id.equals(this._params.identityKey)) {
|
|
32
|
-
log.warn('Invalid default space credential', { expectedIdentity: this._params.identityKey, credential });
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
if (!SpaceId.isValid(assertion.spaceId)) {
|
|
36
|
-
log.warn('Invalid default space id', { id: assertion.spaceId });
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
this._spaceId = assertion.spaceId;
|
|
40
|
-
break;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|