@dxos/credentials 0.8.3 → 0.8.4-main.03d5cd7b56
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 → neutral}/index.mjs +185 -379
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/types/src/credentials/assertions.d.ts +1 -1
- package/dist/types/src/credentials/assertions.d.ts.map +1 -1
- package/dist/types/src/credentials/credential-factory.d.ts +4 -4
- package/dist/types/src/credentials/credential-factory.d.ts.map +1 -1
- package/dist/types/src/credentials/credential-generator.d.ts +3 -3
- package/dist/types/src/credentials/credential-generator.d.ts.map +1 -1
- package/dist/types/src/credentials/signing.d.ts.map +1 -1
- package/dist/types/src/credentials/verifier.d.ts.map +1 -1
- package/dist/types/src/did.d.ts +1 -1
- package/dist/types/src/did.d.ts.map +1 -1
- package/dist/types/src/graph/credential-graph.d.ts.map +1 -1
- package/dist/types/src/passcode.d.ts.map +1 -1
- package/dist/types/src/presentations/presentation.d.ts.map +1 -1
- package/dist/types/src/presentations/signing.d.ts.map +1 -1
- package/dist/types/src/presentations/verifier.d.ts.map +1 -1
- package/dist/types/src/processor/device-state-machine.d.ts +2 -2
- package/dist/types/src/processor/device-state-machine.d.ts.map +1 -1
- package/dist/types/src/processor/index.d.ts +1 -1
- package/dist/types/src/processor/index.d.ts.map +1 -1
- package/dist/types/src/processor/profile-state-machine.d.ts +2 -2
- package/dist/types/src/processor/profile-state-machine.d.ts.map +1 -1
- package/dist/types/src/seedphrase.d.ts.map +1 -1
- package/dist/types/src/state-machine/feed-state-machine.d.ts.map +1 -1
- package/dist/types/src/state-machine/invitation-state-machine.d.ts.map +1 -1
- package/dist/types/src/state-machine/member-state-machine.d.ts +1 -1
- package/dist/types/src/state-machine/member-state-machine.d.ts.map +1 -1
- package/dist/types/src/state-machine/space-state-machine.d.ts +8 -2
- package/dist/types/src/state-machine/space-state-machine.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/docs/README.md +17 -17
- package/moon.yml +12 -0
- package/package.json +20 -23
- package/src/credentials/assertions.ts +1 -1
- package/src/credentials/credential-factory.ts +5 -5
- package/src/credentials/credential-generator.ts +6 -1
- package/src/credentials/signing.ts +12 -0
- package/src/did.ts +2 -2
- package/src/presentations/json-encoding.test.ts +1 -1
- package/src/presentations/presentation.ts +1 -1
- package/src/presentations/verifier.test.ts +1 -1
- package/src/presentations/verifier.ts +1 -1
- package/src/processor/device-state-machine.ts +3 -3
- package/src/processor/index.ts +1 -1
- package/src/processor/profile-state-machine.ts +3 -3
- package/src/state-machine/invitation-state-machine.test.ts +2 -2
- package/src/state-machine/member-state-machine.test.ts +1 -1
- package/src/state-machine/member-state-machine.ts +1 -1
- package/src/state-machine/space-state-machine.test.ts +244 -2
- package/src/state-machine/space-state-machine.ts +33 -9
- package/vitest.config.ts +7 -3
- package/.eslintrc.cjs +0 -7
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/node/index.cjs +0 -1894
- package/dist/lib/node/index.cjs.map +0 -7
- package/dist/lib/node/meta.json +0 -1
- package/dist/lib/node-esm/index.mjs +0 -1870
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/project.json +0 -27
package/docs/README.md
CHANGED
|
@@ -84,20 +84,20 @@ dxos/mesh-protocol --> dxos/codec-protobuf
|
|
|
84
84
|
|
|
85
85
|
## Dependencies
|
|
86
86
|
|
|
87
|
-
| Module
|
|
88
|
-
|
|
89
|
-
| [`@dxos/async`](../../../../common/async/docs/README.md)
|
|
90
|
-
| [`@dxos/codec-protobuf`](../../../../common/codec-protobuf/docs/README.md)
|
|
91
|
-
| [`@dxos/context`](../../../../common/context/docs/README.md)
|
|
92
|
-
| [`@dxos/crypto`](../../../../common/crypto/docs/README.md)
|
|
93
|
-
| [`@dxos/debug`](../../../../common/debug/docs/README.md)
|
|
94
|
-
| [`@dxos/feed-store`](../../../../common/feed-store/docs/README.md)
|
|
95
|
-
| [`@dxos/hypercore`](../../../../common/hypercore/docs/README.md)
|
|
96
|
-
| [`@dxos/keyring`](../../keyring/docs/README.md)
|
|
97
|
-
| [`@dxos/keys`](../../../../common/keys/docs/README.md)
|
|
98
|
-
| [`@dxos/log`](../../../../common/log/docs/README.md)
|
|
99
|
-
| [`@dxos/mesh-protocol`](../../../mesh/mesh-protocol/docs/README.md)
|
|
100
|
-
| [`@dxos/protocols`](../../../protocols/docs/README.md)
|
|
101
|
-
| [`@dxos/random-access-storage`](../../../../common/random-access-storage/docs/README.md) |
|
|
102
|
-
| [`@dxos/timeframe`](../../../../common/timeframe/docs/README.md)
|
|
103
|
-
| [`@dxos/util`](../../../../common/util/docs/README.md)
|
|
87
|
+
| Module | Direct |
|
|
88
|
+
| ---------------------------------------------------------------------------------------- | ------- |
|
|
89
|
+
| [`@dxos/async`](../../../../common/async/docs/README.md) | ✓ |
|
|
90
|
+
| [`@dxos/codec-protobuf`](../../../../common/codec-protobuf/docs/README.md) | ✓ |
|
|
91
|
+
| [`@dxos/context`](../../../../common/context/docs/README.md) | |
|
|
92
|
+
| [`@dxos/crypto`](../../../../common/crypto/docs/README.md) | ✓ |
|
|
93
|
+
| [`@dxos/debug`](../../../../common/debug/docs/README.md) | ✓ |
|
|
94
|
+
| [`@dxos/feed-store`](../../../../common/feed-store/docs/README.md) | ✓ |
|
|
95
|
+
| [`@dxos/hypercore`](../../../../common/hypercore/docs/README.md) | |
|
|
96
|
+
| [`@dxos/keyring`](../../keyring/docs/README.md) | ✓ |
|
|
97
|
+
| [`@dxos/keys`](../../../../common/keys/docs/README.md) | ✓ |
|
|
98
|
+
| [`@dxos/log`](../../../../common/log/docs/README.md) | ✓ |
|
|
99
|
+
| [`@dxos/mesh-protocol`](../../../mesh/mesh-protocol/docs/README.md) | ✓ |
|
|
100
|
+
| [`@dxos/protocols`](../../../protocols/docs/README.md) | ✓ |
|
|
101
|
+
| [`@dxos/random-access-storage`](../../../../common/random-access-storage/docs/README.md) | |
|
|
102
|
+
| [`@dxos/timeframe`](../../../../common/timeframe/docs/README.md) | |
|
|
103
|
+
| [`@dxos/util`](../../../../common/util/docs/README.md) | ✓ |
|
package/moon.yml
ADDED
package/package.json
CHANGED
|
@@ -1,42 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/credentials",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4-main.03d5cd7b56",
|
|
4
4
|
"description": "DXOS Credentials",
|
|
5
5
|
"homepage": "https://github.com/dxos/dxos/tree/main/packages/core/halo/credentials#readme",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
|
-
"repository":
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/dxos/dxos"
|
|
10
|
+
},
|
|
8
11
|
"license": "MIT",
|
|
9
12
|
"author": "info@dxos.org",
|
|
10
|
-
"sideEffects":
|
|
13
|
+
"sideEffects": false,
|
|
11
14
|
"type": "module",
|
|
12
15
|
"exports": {
|
|
13
16
|
".": {
|
|
17
|
+
"source": "./src/index.ts",
|
|
14
18
|
"types": "./dist/types/src/index.d.ts",
|
|
15
|
-
"
|
|
16
|
-
"node": "./dist/lib/node-esm/index.mjs"
|
|
19
|
+
"default": "./dist/lib/neutral/index.mjs"
|
|
17
20
|
}
|
|
18
21
|
},
|
|
19
22
|
"types": "dist/types/src/index.d.ts",
|
|
20
|
-
"typesVersions": {
|
|
21
|
-
"*": {}
|
|
22
|
-
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"bip39": "^3.1.0",
|
|
25
|
-
"json-stable-stringify": "^1.0
|
|
26
|
-
"@dxos/async": "0.8.
|
|
27
|
-
"@dxos/
|
|
28
|
-
"@dxos/
|
|
29
|
-
"@dxos/
|
|
30
|
-
"@dxos/
|
|
31
|
-
"@dxos/
|
|
32
|
-
"@dxos/
|
|
33
|
-
"@dxos/
|
|
34
|
-
"@dxos/protocols": "0.8.
|
|
35
|
-
"@dxos/
|
|
36
|
-
"@dxos/
|
|
37
|
-
},
|
|
38
|
-
"devDependencies": {
|
|
39
|
-
"@types/json-stable-stringify": "^1.0.32"
|
|
25
|
+
"json-stable-stringify": "^1.3.0",
|
|
26
|
+
"@dxos/async": "0.8.4-main.03d5cd7b56",
|
|
27
|
+
"@dxos/crypto": "0.8.4-main.03d5cd7b56",
|
|
28
|
+
"@dxos/context": "0.8.4-main.03d5cd7b56",
|
|
29
|
+
"@dxos/keyring": "0.8.4-main.03d5cd7b56",
|
|
30
|
+
"@dxos/log": "0.8.4-main.03d5cd7b56",
|
|
31
|
+
"@dxos/node-std": "0.8.4-main.03d5cd7b56",
|
|
32
|
+
"@dxos/invariant": "0.8.4-main.03d5cd7b56",
|
|
33
|
+
"@dxos/keys": "0.8.4-main.03d5cd7b56",
|
|
34
|
+
"@dxos/protocols": "0.8.4-main.03d5cd7b56",
|
|
35
|
+
"@dxos/util": "0.8.4-main.03d5cd7b56",
|
|
36
|
+
"@dxos/timeframe": "0.8.4-main.03d5cd7b56"
|
|
40
37
|
},
|
|
41
38
|
"publishConfig": {
|
|
42
39
|
"access": "public"
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type PublicKey } from '@dxos/keys';
|
|
6
|
-
import { type
|
|
6
|
+
import { type TYPES, type TypedMessage } from '@dxos/protocols/proto';
|
|
7
7
|
import { type Credential } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
8
8
|
|
|
9
9
|
export const getCredentialAssertion = (credential: Credential): TypedMessage => credential.subject.assertion;
|
|
@@ -11,14 +11,14 @@ import { type Chain, type Credential } from '@dxos/protocols/proto/dxos/halo/cre
|
|
|
11
11
|
import { getCredentialProofPayload } from './signing';
|
|
12
12
|
import { SIGNATURE_TYPE_ED25519, verifyChain } from './verifier';
|
|
13
13
|
|
|
14
|
-
export type
|
|
14
|
+
export type CreateCredentialSignerProps = {
|
|
15
15
|
subject: PublicKey;
|
|
16
16
|
assertion: TypedMessage;
|
|
17
17
|
nonce?: Uint8Array;
|
|
18
18
|
parentCredentialIds?: PublicKey[];
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
export type
|
|
21
|
+
export type CreateCredentialProps = {
|
|
22
22
|
signer: Signer;
|
|
23
23
|
issuer: PublicKey;
|
|
24
24
|
signingKey?: PublicKey;
|
|
@@ -44,7 +44,7 @@ export const createCredential = async ({
|
|
|
44
44
|
chain,
|
|
45
45
|
nonce,
|
|
46
46
|
parentCredentialIds,
|
|
47
|
-
}:
|
|
47
|
+
}: CreateCredentialProps): Promise<Credential> => {
|
|
48
48
|
invariant(assertion['@type'], 'Invalid assertion.');
|
|
49
49
|
invariant(!!signingKey === !!chain, 'Chain must be provided if and only if the signing key differs from the issuer.');
|
|
50
50
|
if (chain) {
|
|
@@ -77,7 +77,7 @@ export const createCredential = async ({
|
|
|
77
77
|
credential.proof!.chain = chain;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
credential.id = PublicKey.from(await subtleCrypto.digest('SHA-256', signedPayload));
|
|
80
|
+
credential.id = PublicKey.from(await subtleCrypto.digest('SHA-256', signedPayload as Uint8Array<ArrayBuffer>));
|
|
81
81
|
|
|
82
82
|
return credential;
|
|
83
83
|
};
|
|
@@ -93,7 +93,7 @@ export const createCredentialMessage = (credential: Credential) => {
|
|
|
93
93
|
// TODO(burdon): Vs. Signer.
|
|
94
94
|
export interface CredentialSigner {
|
|
95
95
|
getIssuer(): PublicKey;
|
|
96
|
-
createCredential: (params:
|
|
96
|
+
createCredential: (params: CreateCredentialSignerProps) => Promise<Credential>;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
/**
|
|
@@ -10,13 +10,14 @@ import {
|
|
|
10
10
|
AdmittedFeed,
|
|
11
11
|
type Credential,
|
|
12
12
|
type DeviceProfileDocument,
|
|
13
|
+
MembershipPolicy,
|
|
13
14
|
type ProfileDocument,
|
|
14
15
|
SpaceMember,
|
|
15
16
|
} from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
16
17
|
import { type DelegateSpaceInvitation } from '@dxos/protocols/proto/dxos/halo/invitations';
|
|
17
18
|
import { Timeframe } from '@dxos/timeframe';
|
|
18
19
|
|
|
19
|
-
import {
|
|
20
|
+
import { type CredentialSigner, createCredential } from './credential-factory';
|
|
20
21
|
|
|
21
22
|
// TODO(burdon): Normalize generate and functions below.
|
|
22
23
|
// Use throughout stack and in tests.
|
|
@@ -38,6 +39,7 @@ export class CredentialGenerator {
|
|
|
38
39
|
spaceKey: PublicKey,
|
|
39
40
|
controlKey: PublicKey,
|
|
40
41
|
creatorProfile?: ProfileDocument,
|
|
42
|
+
membershipPolicy: MembershipPolicy = MembershipPolicy.INVITE,
|
|
41
43
|
): Promise<Credential[]> {
|
|
42
44
|
return [
|
|
43
45
|
await createCredential({
|
|
@@ -47,6 +49,7 @@ export class CredentialGenerator {
|
|
|
47
49
|
assertion: {
|
|
48
50
|
'@type': 'dxos.halo.credentials.SpaceGenesis',
|
|
49
51
|
spaceKey,
|
|
52
|
+
membershipPolicy,
|
|
50
53
|
},
|
|
51
54
|
}),
|
|
52
55
|
|
|
@@ -221,6 +224,7 @@ export const createAdmissionCredentials = async (
|
|
|
221
224
|
membershipChainHeads: PublicKey[] = [],
|
|
222
225
|
profile?: ProfileDocument,
|
|
223
226
|
invitationCredentialId?: PublicKey,
|
|
227
|
+
tags?: string[],
|
|
224
228
|
): Promise<FeedMessage.Payload[]> => {
|
|
225
229
|
const credentials = await Promise.all([
|
|
226
230
|
await signer.createCredential({
|
|
@@ -233,6 +237,7 @@ export const createAdmissionCredentials = async (
|
|
|
233
237
|
profile,
|
|
234
238
|
genesisFeedKey,
|
|
235
239
|
invitationCredentialId,
|
|
240
|
+
tags: tags ?? [],
|
|
236
241
|
},
|
|
237
242
|
}),
|
|
238
243
|
]);
|
|
@@ -27,6 +27,18 @@ export const getCredentialProofPayload = (credential: Credential): Uint8Array =>
|
|
|
27
27
|
}
|
|
28
28
|
delete copy.id; // ID is not part of the signature payload.
|
|
29
29
|
|
|
30
|
+
// Normalize empty repeated fields in the assertion to avoid proto3 serialization asymmetry.
|
|
31
|
+
// Proto3 does not encode empty repeated fields, but the codec may restore them as [] after deserialization,
|
|
32
|
+
// causing a signature mismatch if the original signing payload did not include the field.
|
|
33
|
+
const assertion = (copy.subject as any)?.assertion;
|
|
34
|
+
if (assertion) {
|
|
35
|
+
for (const key of Object.keys(assertion)) {
|
|
36
|
+
if (Array.isArray(assertion[key]) && assertion[key].length === 0) {
|
|
37
|
+
delete assertion[key];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
30
42
|
return Buffer.from(canonicalStringify(copy));
|
|
31
43
|
};
|
|
32
44
|
|
package/src/did.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { subtleCrypto } from '@dxos/crypto';
|
|
6
|
-
import {
|
|
6
|
+
import { IdentityDid, PublicKey } from '@dxos/keys';
|
|
7
7
|
import { ComplexMap } from '@dxos/util';
|
|
8
8
|
|
|
9
9
|
const IDENTITY_DIDS_CACHE = new ComplexMap<PublicKey, IdentityDid>(PublicKey.hash);
|
|
@@ -18,7 +18,7 @@ export const createDidFromIdentityKey = async (identityKey: PublicKey): Promise<
|
|
|
18
18
|
return cachedValue;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
const digest = await subtleCrypto.digest('SHA-256', identityKey.asUint8Array());
|
|
21
|
+
const digest = await subtleCrypto.digest('SHA-256', identityKey.asUint8Array() as Uint8Array<ArrayBuffer>);
|
|
22
22
|
|
|
23
23
|
const bytes = new Uint8Array(digest).slice(0, IdentityDid.byteLength);
|
|
24
24
|
const identityDid = IdentityDid.encode(bytes);
|
|
@@ -11,8 +11,8 @@ import { buf } from '@dxos/protocols/buf';
|
|
|
11
11
|
import { PresentationSchema } from '@dxos/protocols/buf/dxos/halo/credentials_pb';
|
|
12
12
|
import { schema } from '@dxos/protocols/proto';
|
|
13
13
|
|
|
14
|
-
import { signPresentation } from './presentation';
|
|
15
14
|
import { createCredential } from '../credentials';
|
|
15
|
+
import { signPresentation } from './presentation';
|
|
16
16
|
|
|
17
17
|
describe('json encoding', () => {
|
|
18
18
|
test.skip('service access exercise by a device', async () => {
|
|
@@ -6,8 +6,8 @@ import { type Signer } from '@dxos/crypto';
|
|
|
6
6
|
import { type PublicKey } from '@dxos/keys';
|
|
7
7
|
import { type Chain, type Presentation, type Proof } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
8
8
|
|
|
9
|
-
import { getPresentationProofPayload } from './signing';
|
|
10
9
|
import { SIGNATURE_TYPE_ED25519 } from '../credentials';
|
|
10
|
+
import { getPresentationProofPayload } from './signing';
|
|
11
11
|
|
|
12
12
|
// TODO(burdon): Rename createPresentation?
|
|
13
13
|
export const signPresentation = async ({
|
|
@@ -9,9 +9,9 @@ import { Keyring } from '@dxos/keyring';
|
|
|
9
9
|
import { PublicKey } from '@dxos/keys';
|
|
10
10
|
import { type Chain, SpaceMember } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
11
11
|
|
|
12
|
+
import { createCredential } from '../credentials';
|
|
12
13
|
import { signPresentation } from './presentation';
|
|
13
14
|
import { verifyPresentation, verifyPresentationSignature } from './verifier';
|
|
14
|
-
import { createCredential } from '../credentials';
|
|
15
15
|
|
|
16
16
|
describe('presentation verifier', () => {
|
|
17
17
|
describe('chain', () => {
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
import { verifySignature } from '@dxos/crypto';
|
|
6
6
|
import { type Presentation, type Proof } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
7
7
|
|
|
8
|
-
import { getPresentationProofPayload } from './signing';
|
|
9
8
|
import { SIGNATURE_TYPE_ED25519, type VerificationResult, verifyChain, verifyCredential } from '../credentials';
|
|
9
|
+
import { getPresentationProofPayload } from './signing';
|
|
10
10
|
|
|
11
11
|
export const verifyPresentation = async (presentation: Presentation): Promise<VerificationResult> => {
|
|
12
12
|
const errors: string[] = [];
|
|
@@ -9,10 +9,10 @@ import { log } from '@dxos/log';
|
|
|
9
9
|
import { type Chain, type Credential, type DeviceProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
10
10
|
import { ComplexMap } from '@dxos/util';
|
|
11
11
|
|
|
12
|
-
import { type CredentialProcessor } from './credential-processor';
|
|
13
12
|
import { getCredentialAssertion, isValidAuthorizedDeviceCredential } from '../credentials';
|
|
13
|
+
import { type CredentialProcessor } from './credential-processor';
|
|
14
14
|
|
|
15
|
-
export type
|
|
15
|
+
export type DeviceStateMachineProps = {
|
|
16
16
|
identityKey: PublicKey;
|
|
17
17
|
deviceKey: PublicKey;
|
|
18
18
|
onUpdate?: () => void;
|
|
@@ -29,7 +29,7 @@ export class DeviceStateMachine implements CredentialProcessor {
|
|
|
29
29
|
|
|
30
30
|
public deviceCredentialChain?: Chain;
|
|
31
31
|
|
|
32
|
-
constructor(private readonly _params:
|
|
32
|
+
constructor(private readonly _params: DeviceStateMachineProps) {}
|
|
33
33
|
|
|
34
34
|
async processCredential(credential: Credential): Promise<void> {
|
|
35
35
|
log('processing credential...', {
|
package/src/processor/index.ts
CHANGED
|
@@ -6,10 +6,10 @@ import { type PublicKey } from '@dxos/keys';
|
|
|
6
6
|
import { log } from '@dxos/log';
|
|
7
7
|
import { type Credential, type ProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
8
8
|
|
|
9
|
-
import { type CredentialProcessor } from './credential-processor';
|
|
10
9
|
import { getCredentialAssertion } from '../credentials';
|
|
10
|
+
import { type CredentialProcessor } from './credential-processor';
|
|
11
11
|
|
|
12
|
-
export type
|
|
12
|
+
export type ProfileStateMachineProps = {
|
|
13
13
|
identityKey: PublicKey;
|
|
14
14
|
onUpdate?: () => void;
|
|
15
15
|
};
|
|
@@ -21,7 +21,7 @@ export class ProfileStateMachine implements CredentialProcessor {
|
|
|
21
21
|
// TODO(burdon): Return values via getter.
|
|
22
22
|
public profile?: ProfileDocument;
|
|
23
23
|
|
|
24
|
-
constructor(private readonly _params:
|
|
24
|
+
constructor(private readonly _params: ProfileStateMachineProps) {}
|
|
25
25
|
|
|
26
26
|
async processCredential(credential: Credential): Promise<void> {
|
|
27
27
|
const assertion = getCredentialAssertion(credential);
|
|
@@ -7,16 +7,16 @@ import { beforeEach, describe, expect, test } from 'vitest';
|
|
|
7
7
|
import { Keyring } from '@dxos/keyring';
|
|
8
8
|
import { PublicKey } from '@dxos/keys';
|
|
9
9
|
import { Invitation } from '@dxos/protocols/proto/dxos/client/services';
|
|
10
|
-
import {
|
|
10
|
+
import { type Credential, SpaceMember } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
11
11
|
import { type DelegateSpaceInvitation } from '@dxos/protocols/proto/dxos/halo/invitations';
|
|
12
12
|
import { range } from '@dxos/util';
|
|
13
13
|
|
|
14
|
-
import { InvitationStateMachine } from './invitation-state-machine';
|
|
15
14
|
import {
|
|
16
15
|
createCredential,
|
|
17
16
|
createCredentialSignerWithKey,
|
|
18
17
|
createDelegatedSpaceInvitationCredential,
|
|
19
18
|
} from '../credentials';
|
|
19
|
+
import { InvitationStateMachine } from './invitation-state-machine';
|
|
20
20
|
|
|
21
21
|
describe('InvitationStateMachine', () => {
|
|
22
22
|
const keyring = new Keyring();
|
|
@@ -9,8 +9,8 @@ import { PublicKey } from '@dxos/keys';
|
|
|
9
9
|
import { SpaceMember } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
10
10
|
import { range } from '@dxos/util';
|
|
11
11
|
|
|
12
|
-
import { MemberStateMachine } from './member-state-machine';
|
|
13
12
|
import { createAdmissionCredentials, createCredentialSignerWithKey } from '../credentials';
|
|
13
|
+
import { MemberStateMachine } from './member-state-machine';
|
|
14
14
|
|
|
15
15
|
const keyring = new Keyring();
|
|
16
16
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { invariant } from '@dxos/invariant';
|
|
6
6
|
import { PublicKey } from '@dxos/keys';
|
|
7
7
|
import { log } from '@dxos/log';
|
|
8
|
-
import { type Credential,
|
|
8
|
+
import { type Credential, type ProfileDocument, SpaceMember } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
9
9
|
import { ComplexMap } from '@dxos/util';
|
|
10
10
|
|
|
11
11
|
import { getCredentialAssertion } from '../credentials';
|