@dxos/credentials 0.6.13 → 0.6.14-main.1366248
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/index.mjs +92 -77
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +98 -76
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +1865 -0
- package/dist/lib/node-esm/index.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -0
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/presentations/json-encoding.test.d.ts +2 -0
- package/dist/types/src/presentations/json-encoding.test.d.ts.map +1 -0
- package/dist/types/src/seedphrase.d.ts +0 -4
- package/dist/types/src/seedphrase.d.ts.map +1 -1
- package/package.json +17 -40
- package/project.json +1 -1
- package/src/credentials/verifier.test.ts +1 -2
- package/src/index.ts +1 -1
- package/src/presentations/json-encoding.test.ts +65 -0
- package/src/presentations/verifier.test.ts +1 -2
- package/src/seedphrase.ts +0 -7
- package/src/state-machine/invitation-state-machine.test.ts +2 -2
- package/src/state-machine/member-state-machine.test.ts +3 -3
- package/src/state-machine/space-state-machine.test.ts +1 -2
- package/tsconfig.json +2 -49
- package/vitest.config.ts +9 -0
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { expect } from '
|
|
5
|
+
import { describe, expect, test } from 'vitest';
|
|
6
6
|
|
|
7
7
|
import { randomBytes } from '@dxos/crypto';
|
|
8
8
|
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
|
-
import { describe, test } from '@dxos/test';
|
|
12
11
|
|
|
13
12
|
import { signPresentation } from './presentation';
|
|
14
13
|
import { verifyPresentation, verifyPresentationSignature } from './verifier';
|
package/src/seedphrase.ts
CHANGED
|
@@ -8,21 +8,14 @@ import { createKeyPair } from '@dxos/crypto';
|
|
|
8
8
|
import { invariant } from '@dxos/invariant';
|
|
9
9
|
import { type KeyPair } from '@dxos/keys';
|
|
10
10
|
|
|
11
|
-
// Util functions for Identity: export, import, create.
|
|
12
|
-
|
|
13
11
|
/**
|
|
14
12
|
* Generate bip39 seed phrase (aka mnemonic).
|
|
15
|
-
*
|
|
16
|
-
* @deprecated
|
|
17
13
|
*/
|
|
18
14
|
export const generateSeedPhrase = (): string => generateMnemonic();
|
|
19
15
|
|
|
20
16
|
/**
|
|
21
17
|
* Generate key pair from seed phrase.
|
|
22
|
-
*
|
|
23
|
-
* @deprecated
|
|
24
18
|
*/
|
|
25
|
-
// TODO(dmaretskyi): Use web-crypto.
|
|
26
19
|
export const keyPairFromSeedPhrase = (seedPhrase: string): KeyPair => {
|
|
27
20
|
invariant(seedPhrase);
|
|
28
21
|
const seed = mnemonicToSeedSync(seedPhrase);
|
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { expect } from '
|
|
5
|
+
import { beforeEach, describe, expect, test } from 'vitest';
|
|
6
6
|
|
|
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
10
|
import { SpaceMember, type Credential } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
11
11
|
import { type DelegateSpaceInvitation } from '@dxos/protocols/proto/dxos/halo/invitations';
|
|
12
|
-
import { describe, test } from '@dxos/test';
|
|
13
12
|
import { range } from '@dxos/util';
|
|
14
13
|
|
|
15
14
|
import { InvitationStateMachine } from './invitation-state-machine';
|
|
@@ -30,6 +29,7 @@ describe('InvitationStateMachine', () => {
|
|
|
30
29
|
authMethod: Invitation.AuthMethod.KNOWN_PUBLIC_KEY,
|
|
31
30
|
multiUse: false,
|
|
32
31
|
};
|
|
32
|
+
|
|
33
33
|
beforeEach(async () => {
|
|
34
34
|
space = await keyring.createKey();
|
|
35
35
|
identity = await keyring.createKey();
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
//
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
import { beforeEach, describe, expect, test } from 'vitest';
|
|
5
6
|
|
|
6
7
|
import { Keyring } from '@dxos/keyring';
|
|
7
8
|
import { PublicKey } from '@dxos/keys';
|
|
8
9
|
import { SpaceMember } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
9
|
-
import { describe, test } from '@dxos/test';
|
|
10
10
|
import { range } from '@dxos/util';
|
|
11
11
|
|
|
12
12
|
import { MemberStateMachine } from './member-state-machine';
|
|
@@ -16,8 +16,8 @@ const keyring = new Keyring();
|
|
|
16
16
|
|
|
17
17
|
describe('MemberStateMachine', () => {
|
|
18
18
|
const genesisFeedKey: PublicKey = PublicKey.random();
|
|
19
|
-
|
|
20
19
|
let spaceKey: PublicKey;
|
|
20
|
+
|
|
21
21
|
beforeEach(async () => {
|
|
22
22
|
spaceKey = await keyring.createKey();
|
|
23
23
|
});
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import expect from '
|
|
5
|
+
import { describe, expect, test } from 'vitest';
|
|
6
6
|
|
|
7
7
|
import { Keyring } from '@dxos/keyring';
|
|
8
8
|
import { type PublicKey } from '@dxos/keys';
|
|
9
9
|
import { AdmittedFeed, type Chain, SpaceMember } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
10
|
-
import { describe, test } from '@dxos/test';
|
|
11
10
|
|
|
12
11
|
import { SpaceStateMachine } from './space-state-machine';
|
|
13
12
|
import { createCredential, verifyCredential } from '../credentials';
|
package/tsconfig.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends": "../../../../tsconfig.json",
|
|
2
|
+
"extends": "../../../../tsconfig.base.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
|
-
"outDir": "dist/types",
|
|
5
4
|
"types": [
|
|
6
5
|
"node"
|
|
7
6
|
]
|
|
@@ -9,51 +8,5 @@
|
|
|
9
8
|
"include": [
|
|
10
9
|
"src"
|
|
11
10
|
],
|
|
12
|
-
"references": [
|
|
13
|
-
{
|
|
14
|
-
"path": "../../../common/async"
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
"path": "../../../common/codec-protobuf"
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"path": "../../../common/context"
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
"path": "../../../common/crypto"
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
"path": "../../../common/debug"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"path": "../../../common/feed-store"
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"path": "../../../common/invariant"
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
"path": "../../../common/keys"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"path": "../../../common/log"
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
"path": "../../../common/node-std"
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
"path": "../../../common/random-access-storage"
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
"path": "../../../common/timeframe"
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
"path": "../../../common/util"
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
"path": "../../protocols"
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
"path": "../keyring"
|
|
57
|
-
}
|
|
58
|
-
]
|
|
11
|
+
"references": []
|
|
59
12
|
}
|
package/vitest.config.ts
ADDED