@dxos/credentials 2.33.7-dev.c2ba88fb → 2.33.8-dev.6bc74570

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.
Files changed (101) hide show
  1. package/.rush/temp/package-deps_build.json +24 -23
  2. package/.rush/temp/package-deps_build_test.json +24 -23
  3. package/.rush/temp/shrinkwrap-deps.json +11 -1
  4. package/credentials.build.log +13 -11
  5. package/dist/src/auth/auth-message.d.ts +1 -1
  6. package/dist/src/auth/auth-message.d.ts.map +1 -1
  7. package/dist/src/auth/auth-message.js +2 -2
  8. package/dist/src/auth/auth-message.js.map +1 -1
  9. package/dist/src/auth/auth-plugin.test.js +10 -9
  10. package/dist/src/auth/auth-plugin.test.js.map +1 -1
  11. package/dist/src/auth/auth.test.js.map +1 -1
  12. package/dist/src/auth/authenticator.js +2 -2
  13. package/dist/src/auth/authenticator.js.map +1 -1
  14. package/dist/src/greet/greeter-plugin.test.js +10 -9
  15. package/dist/src/greet/greeter-plugin.test.js.map +1 -1
  16. package/dist/src/greet/greeter.d.ts +1 -1
  17. package/dist/src/greet/greeter.d.ts.map +1 -1
  18. package/dist/src/greet/greeter.js +2 -2
  19. package/dist/src/greet/greeter.js.map +1 -1
  20. package/dist/src/greet/greeting-command-plugin.d.ts.map +1 -1
  21. package/dist/src/greet/greeting-command-plugin.js +3 -3
  22. package/dist/src/greet/greeting-command-plugin.js.map +1 -1
  23. package/dist/src/greet/invitation.d.ts +1 -1
  24. package/dist/src/greet/invitation.d.ts.map +1 -1
  25. package/dist/src/greet/invitation.js +2 -1
  26. package/dist/src/greet/invitation.js.map +1 -1
  27. package/dist/src/identity/identity-message-processor.d.ts +1 -1
  28. package/dist/src/identity/identity-message-processor.d.ts.map +1 -1
  29. package/dist/src/identity/identity-message-processor.js +4 -4
  30. package/dist/src/identity/identity-message-processor.js.map +1 -1
  31. package/dist/src/identity/index.d.ts +1 -0
  32. package/dist/src/identity/index.d.ts.map +1 -1
  33. package/dist/src/identity/index.js +1 -0
  34. package/dist/src/identity/index.js.map +1 -1
  35. package/dist/src/identity/seedphrase.d.ts +9 -0
  36. package/dist/src/identity/seedphrase.d.ts.map +1 -0
  37. package/dist/src/identity/seedphrase.js +28 -0
  38. package/dist/src/identity/seedphrase.js.map +1 -0
  39. package/dist/src/identity/seedphrase.test.js +20 -4
  40. package/dist/src/identity/seedphrase.test.js.map +1 -1
  41. package/dist/src/keys/filter.d.ts +1 -1
  42. package/dist/src/keys/filter.d.ts.map +1 -1
  43. package/dist/src/keys/filter.js +2 -2
  44. package/dist/src/keys/filter.js.map +1 -1
  45. package/dist/src/keys/keyring-helpers.d.ts +2 -1
  46. package/dist/src/keys/keyring-helpers.d.ts.map +1 -1
  47. package/dist/src/keys/keyring-helpers.js +7 -6
  48. package/dist/src/keys/keyring-helpers.js.map +1 -1
  49. package/dist/src/keys/keyring.d.ts +1 -1
  50. package/dist/src/keys/keyring.d.ts.map +1 -1
  51. package/dist/src/keys/keyring.js +10 -9
  52. package/dist/src/keys/keyring.js.map +1 -1
  53. package/dist/src/keys/keyring.test.js +9 -8
  54. package/dist/src/keys/keyring.test.js.map +1 -1
  55. package/dist/src/keys/keystore.js +2 -2
  56. package/dist/src/keys/keystore.js.map +1 -1
  57. package/dist/src/keys/signer.d.ts +1 -1
  58. package/dist/src/keys/signer.d.ts.map +1 -1
  59. package/dist/src/party/party-credential.d.ts +1 -1
  60. package/dist/src/party/party-credential.d.ts.map +1 -1
  61. package/dist/src/party/party-credential.js +7 -6
  62. package/dist/src/party/party-credential.js.map +1 -1
  63. package/dist/src/party/party-invitation-manager.js +3 -3
  64. package/dist/src/party/party-invitation-manager.js.map +1 -1
  65. package/dist/src/party/party-state.d.ts +1 -1
  66. package/dist/src/party/party-state.d.ts.map +1 -1
  67. package/dist/src/party/party-state.js +8 -7
  68. package/dist/src/party/party-state.js.map +1 -1
  69. package/dist/src/proto/gen/dxos/halo/keys.d.ts +9 -9
  70. package/dist/src/proto/gen/index.d.ts.map +1 -1
  71. package/dist/src/proto/gen/index.js +1 -1
  72. package/dist/src/proto/gen/index.js.map +1 -1
  73. package/dist/src/proto/substitutions.d.ts +2 -2
  74. package/dist/src/proto/substitutions.js +2 -2
  75. package/dist/src/proto/substitutions.js.map +1 -1
  76. package/dist/tsconfig.tsbuildinfo +1 -1
  77. package/package.json +13 -12
  78. package/src/auth/auth-message.ts +1 -1
  79. package/src/auth/auth-plugin.test.ts +6 -5
  80. package/src/auth/auth.test.ts +2 -1
  81. package/src/auth/authenticator.ts +1 -1
  82. package/src/greet/greeter-plugin.test.ts +6 -5
  83. package/src/greet/greeter.ts +1 -1
  84. package/src/greet/greeting-command-plugin.ts +3 -3
  85. package/src/greet/invitation.ts +2 -1
  86. package/src/identity/identity-message-processor.ts +1 -1
  87. package/src/identity/index.ts +1 -0
  88. package/src/identity/seedphrase.test.ts +20 -1
  89. package/src/identity/seedphrase.ts +24 -0
  90. package/src/keys/filter.ts +1 -1
  91. package/src/keys/keyring-helpers.ts +2 -1
  92. package/src/keys/keyring.test.ts +5 -4
  93. package/src/keys/keyring.ts +3 -2
  94. package/src/keys/keystore.ts +1 -1
  95. package/src/keys/signer.ts +1 -1
  96. package/src/party/party-credential.ts +2 -1
  97. package/src/party/party-invitation-manager.ts +1 -1
  98. package/src/party/party-state.ts +2 -1
  99. package/src/proto/gen/dxos/halo/keys.ts +9 -9
  100. package/src/proto/gen/index.ts +1 -1
  101. package/src/proto/substitutions.ts +1 -1
@@ -2,7 +2,8 @@
2
2
  // Copyright 2019 DXOS.org
3
3
  //
4
4
 
5
- import { randomBytes, PublicKey, PublicKeyLike } from '@dxos/crypto';
5
+ import { randomBytes } from '@dxos/crypto';
6
+ import { PublicKey, PublicKeyLike } from '@dxos/protocols';
6
7
 
7
8
  import { createDateTimeString } from '../proto';
8
9
 
@@ -6,7 +6,7 @@ import assert from 'assert';
6
6
  import debug from 'debug';
7
7
  import { EventEmitter } from 'events';
8
8
 
9
- import { PublicKey, PublicKeyLike } from '@dxos/crypto';
9
+ import { PublicKey, PublicKeyLike } from '@dxos/protocols';
10
10
 
11
11
  import { isDeviceInfoMessage, isIdentityInfoMessage } from '../identity';
12
12
  import { Keyring, assertValidPublicKey } from '../keys';
@@ -5,3 +5,4 @@
5
5
  export * from './events';
6
6
  export * from './identity-message';
7
7
  export * from './identity-message-processor';
8
+ export * from './seedphrase';
@@ -2,12 +2,31 @@
2
2
  // Copyright 2020 DXOS.org
3
3
  //
4
4
 
5
+ import { generateMnemonic, mnemonicToSeedSync } from 'bip39';
5
6
  import expect from 'expect';
6
7
 
7
- import { generateSeedPhrase, KeyPair, keyPairFromSeedPhrase, PublicKey } from '@dxos/crypto';
8
+ import { createKeyPair, KeyPair } from '@dxos/crypto';
9
+ import { PublicKey } from '@dxos/protocols';
8
10
 
9
11
  import { Keyring } from '../keys';
10
12
  import { KeyType } from '../proto';
13
+ import { generateSeedPhrase, keyPairFromSeedPhrase } from './seedphrase';
14
+
15
+ it('Basic bip39 operations work', async () => {
16
+ const seedPhrase = generateMnemonic();
17
+ const seed = mnemonicToSeedSync(seedPhrase);
18
+ const keyPair = await createKeyPair(seed.slice(0, 32));
19
+ expect(keyPair).not.toBeUndefined();
20
+ });
21
+
22
+ it('Create keypair from seedphrase', async () => {
23
+ const seedPhrase = generateSeedPhrase();
24
+ expect(typeof seedPhrase).toBe('string');
25
+ expect(seedPhrase.split(/\s+/g).length).toEqual(12);
26
+
27
+ const recoveredKeyPair = keyPairFromSeedPhrase(seedPhrase);
28
+ expect(recoveredKeyPair).toBeDefined();
29
+ });
11
30
 
12
31
  it('Create cold identity key and recover', async () => {
13
32
  // Generate a seed phrase and validate result.
@@ -0,0 +1,24 @@
1
+ //
2
+ // Copyright 2020 DXOS.org
3
+ //
4
+
5
+ import assert from 'assert';
6
+ import { generateMnemonic, mnemonicToSeedSync } from 'bip39';
7
+
8
+ import { createKeyPair } from '@dxos/crypto';
9
+
10
+ // Util functions for Identity: export, import, create.
11
+
12
+ /**
13
+ * Generate bip39 seed phrase (aka mnemonic).
14
+ */
15
+ export const generateSeedPhrase = (): string => generateMnemonic();
16
+
17
+ /**
18
+ * Generate key pair from seed phrase.
19
+ */
20
+ export const keyPairFromSeedPhrase = (seedPhrase: string) => {
21
+ assert(seedPhrase);
22
+ const seed = mnemonicToSeedSync(seedPhrase);
23
+ return createKeyPair(seed);
24
+ };
@@ -4,7 +4,7 @@
4
4
 
5
5
  import matches from 'lodash.matches';
6
6
 
7
- import { PublicKey, PublicKeyLike } from '@dxos/crypto';
7
+ import { PublicKey, PublicKeyLike } from '@dxos/protocols';
8
8
 
9
9
  export type FilterFunction = (obj: any) => boolean;
10
10
 
@@ -9,7 +9,8 @@
9
9
  import assert from 'assert';
10
10
  import stableStringify from 'json-stable-stringify';
11
11
 
12
- import { createKeyPair, KeyPair, PublicKey, PublicKeyLike, PUBLIC_KEY_LENGTH, SECRET_KEY_LENGTH } from '@dxos/crypto';
12
+ import { createKeyPair, KeyPair } from '@dxos/crypto';
13
+ import { PublicKey, PublicKeyLike, PUBLIC_KEY_LENGTH, SECRET_KEY_LENGTH } from '@dxos/protocols';
13
14
 
14
15
  import { KeyChain, KeyRecord, KeyType, createDateTimeString } from '../proto';
15
16
  import { MakeOptional } from '../typedefs';
@@ -7,7 +7,8 @@
7
7
  import assert from 'assert';
8
8
  import expect from 'expect';
9
9
 
10
- import { createKeyPair, keyToString, randomBytes, verify, PublicKey } from '@dxos/crypto';
10
+ import { createKeyPair, randomBytes, verify } from '@dxos/crypto';
11
+ import { PublicKey } from '@dxos/protocols';
11
12
 
12
13
  import { KeyType, schema } from '../proto';
13
14
  import { Filter } from './filter';
@@ -89,7 +90,7 @@ it('Add/retrieve a publicKey from an external source (without secret present)',
89
90
 
90
91
  it('Retrieve a non-existent key', async () => {
91
92
  const keyring = new Keyring();
92
- const internal = keyring.findKey(Filter.matches({ key: keyToString(randomBytes(32)) }));
93
+ const internal = keyring.findKey(Filter.matches({ key: PublicKey.stringify(randomBytes(32)) }));
93
94
  expect(internal).toBeUndefined();
94
95
  });
95
96
 
@@ -193,8 +194,8 @@ it('Attempt to add a badly formatted key', async () => {
193
194
  const keyring = new Keyring();
194
195
  const good = createKeyPair();
195
196
  const bad = {
196
- publicKey: keyToString(good.publicKey),
197
- secretKey: keyToString(good.secretKey),
197
+ publicKey: PublicKey.stringify(good.publicKey),
198
+ secretKey: PublicKey.stringify(good.secretKey),
198
199
  type: KeyType.IDENTITY
199
200
  };
200
201
 
@@ -7,8 +7,9 @@ import memdown from 'memdown';
7
7
 
8
8
  import { Event } from '@dxos/async';
9
9
  import {
10
- PublicKey, PublicKeyLike, KeyPair, keyToBuffer, randomBytes, sign as cryptoSign, verify as cryptoVerify
10
+ KeyPair, randomBytes, sign as cryptoSign, verify as cryptoVerify
11
11
  } from '@dxos/crypto';
12
+ import { PublicKey, PublicKeyLike } from '@dxos/protocols';
12
13
  import { arraysEqual } from '@dxos/util';
13
14
 
14
15
  import { isSignedMessage, unwrapMessage } from '../party';
@@ -582,7 +583,7 @@ export class Keyring implements Signer {
582
583
  item.publicKey = PublicKey.from(item.publicKey);
583
584
  }
584
585
  if (item.secretKey) {
585
- item.secretKey = keyToBuffer(item.secretKey);
586
+ item.secretKey = PublicKey.bufferize(item.secretKey);
586
587
  }
587
588
 
588
589
  if (item.secretKey) {
@@ -10,7 +10,7 @@ import levelup, { LevelUp } from 'levelup';
10
10
  import memdown from 'memdown';
11
11
  import toArray from 'stream-to-array';
12
12
 
13
- import { PublicKey } from '@dxos/crypto';
13
+ import { PublicKey } from '@dxos/protocols';
14
14
 
15
15
  import { KeyRecord } from '../proto';
16
16
 
@@ -2,7 +2,7 @@
2
2
  // Copyright 2021 DXOS.org
3
3
  //
4
4
 
5
- import { PublicKey } from '@dxos/crypto';
5
+ import { PublicKey } from '@dxos/protocols';
6
6
 
7
7
  import { KeyChain, KeyRecord, SignedMessage, WithTypeUrl } from '../proto';
8
8
 
@@ -4,7 +4,8 @@
4
4
 
5
5
  import assert from 'assert';
6
6
 
7
- import { randomBytes, PublicKey, PublicKeyLike } from '@dxos/crypto';
7
+ import { randomBytes } from '@dxos/crypto';
8
+ import { PublicKey, PublicKeyLike } from '@dxos/protocols';
8
9
 
9
10
  import { assertValidPublicKey, Signer } from '../keys';
10
11
  import { KeyChain, KeyRecord, Message, SignedMessage, PartyCredential, Command, Auth, WithTypeUrl } from '../proto';
@@ -5,7 +5,7 @@
5
5
  import assert from 'assert';
6
6
  import debug from 'debug';
7
7
 
8
- import { PublicKey } from '@dxos/crypto';
8
+ import { PublicKey } from '@dxos/protocols';
9
9
 
10
10
  import { KeyRecord, SignedMessage } from '../proto';
11
11
  import { PartyEventType } from './events';
@@ -6,7 +6,8 @@ import assert from 'assert';
6
6
  import debug from 'debug';
7
7
  import { EventEmitter } from 'events';
8
8
 
9
- import { PublicKey, PublicKeyLike, discoveryKey } from '@dxos/crypto';
9
+ import { discoveryKey } from '@dxos/crypto';
10
+ import { PublicKey, PublicKeyLike } from '@dxos/protocols';
10
11
 
11
12
  import { isIdentityMessage, IdentityMessageProcessor, IdentityEvents } from '../identity';
12
13
  import { Keyring, assertValidPublicKey, keyTypeName } from '../keys';
@@ -22,36 +22,36 @@ export interface PrivKey {
22
22
  }
23
23
  export interface KeyRecord {
24
24
  /**
25
- * - The `KeyType` type of the key. This is often unknown for keys from other sources.
25
+ * The `KeyType` type of the key. This is often unknown for keys from other sources.
26
26
  */
27
27
  type: KeyType;
28
28
  /**
29
- * - The public key as a Buffer (required).
29
+ * The public key as a Buffer (required).
30
30
  */
31
31
  publicKey: ReturnType<(typeof substitutions)["dxos.halo.keys.PubKey"]["decode"]>;
32
32
  /**
33
- * - The secret key as a Buffer (this will never be visible outside the Keyring).
33
+ * The secret key as a Buffer (this will never be visible outside the Keyring).
34
34
  */
35
35
  secretKey?: ReturnType<(typeof substitutions)["dxos.halo.keys.PrivKey"]["decode"]>;
36
36
  /**
37
- * - Is this key from a Greeting "hint"?
37
+ * Is this key from a Greeting "hint"?
38
38
  */
39
39
  hint?: boolean;
40
40
  /**
41
- * - Is this our key? Usually true if `secretKey` is present,
42
- * may be false for "inception keys" such as the Party key.
41
+ * Determines if this is our key?
42
+ * Usually true if `secretKey` is present; may be false for "inception keys" such as the Party key.
43
43
  */
44
44
  own?: boolean;
45
45
  /**
46
- * - Is this key to be trusted?
46
+ * Is this key to be trusted?
47
47
  */
48
48
  trusted?: boolean;
49
49
  /**
50
- * - An RFC-3339 date/time string for when the key was added to the Keyring.
50
+ * An RFC-3339 date/time string for when the key was added to the Keyring.
51
51
  */
52
52
  added?: string;
53
53
  /**
54
- * - An RFC-3339 date/time string for when the key was created.
54
+ * An RFC-3339 date/time string for when the key was created.
55
55
  */
56
56
  created?: string;
57
57
  }
@@ -49,5 +49,5 @@ export interface TYPES {
49
49
  }
50
50
  export interface SERVICES {
51
51
  }
52
- export const schemaJson = JSON.parse("{\"nested\":{\"dxos\":{\"nested\":{\"credentials\":{\"nested\":{\"auth\":{\"nested\":{\"Auth\":{\"fields\":{\"partyKey\":{\"type\":\"PubKey\",\"id\":1,\"comment\":\"The publicKey of the target Party for these credentials.\"},\"deviceKey\":{\"type\":\"PubKey\",\"id\":2,\"comment\":\"The publicKey of the authenticating Device.\"},\"identityKey\":{\"type\":\"PubKey\",\"id\":3,\"comment\":\"The publicKey of the authenticating Identity.\"},\"feedKey\":{\"type\":\"PubKey\",\"id\":4,\"comment\":\"The publicKey of the authenticating Identity.\"},\"feedAdmit\":{\"type\":\"google.protobuf.Any\",\"id\":5,\"comment\":\"FeedAdmit message to the should be written to a control feed in case the `feedKey` is not admitted to the party.\"}},\"comment\":\"The payload for a SignedMessage sent during handshake for replication authentication.\"}}},\"greet\":{\"nested\":{\"BeginResponse\":{\"fields\":{\"info\":{\"keyType\":\"string\",\"type\":\"google.protobuf.Any\",\"id\":1,\"comment\":null}},\"comment\":null},\"ClaimResponse\":{\"fields\":{\"id\":{\"type\":\"bytes\",\"id\":1,\"comment\":null},\"rendezvousKey\":{\"type\":\"bytes\",\"id\":2,\"comment\":null}},\"comment\":null},\"Command\":{\"fields\":{\"command\":{\"type\":\"Type\",\"id\":1,\"comment\":null},\"secret\":{\"type\":\"bytes\",\"id\":2,\"comment\":null},\"params\":{\"rule\":\"repeated\",\"type\":\"google.protobuf.Any\",\"id\":10,\"comment\":null}},\"nested\":{\"Type\":{\"values\":{\"BEGIN\":0,\"HANDSHAKE\":1,\"NOTARIZE\":2,\"FINISH\":3,\"CLAIM\":10},\"comment\":null,\"comments\":{\"BEGIN\":null,\"HANDSHAKE\":null,\"NOTARIZE\":null,\"FINISH\":null,\"CLAIM\":null}}},\"comment\":\"A Greeter command.\"},\"HandshakeResponse\":{\"fields\":{\"nonce\":{\"type\":\"bytes\",\"id\":1,\"comment\":null},\"partyKey\":{\"type\":\"PubKey\",\"id\":2,\"comment\":null}},\"comment\":null},\"KeyHint\":{\"fields\":{\"publicKey\":{\"type\":\"PubKey\",\"id\":1,\"comment\":null},\"type\":{\"type\":\"KeyType\",\"id\":2,\"comment\":null}},\"comment\":null},\"NotarizeResponse\":{\"fields\":{\"copies\":{\"rule\":\"repeated\",\"type\":\"google.protobuf.Any\",\"id\":1,\"comment\":null},\"feedHints\":{\"rule\":\"repeated\",\"type\":\"PubKey\",\"id\":2,\"comment\":null}},\"comment\":null}}},\"identity\":{\"nested\":{\"DeviceInfo\":{\"fields\":{\"publicKey\":{\"type\":\"PubKey\",\"id\":1,\"comment\":null},\"displayName\":{\"type\":\"string\",\"id\":2,\"comment\":null}},\"comment\":null},\"IdentityInfo\":{\"fields\":{\"publicKey\":{\"type\":\"PubKey\",\"id\":1,\"comment\":null},\"displayName\":{\"type\":\"string\",\"id\":2,\"comment\":null}},\"comment\":null}}},\"Message\":{\"fields\":{\"payload\":{\"rule\":\"required\",\"type\":\"google.protobuf.Any\",\"id\":1,\"comment\":null}},\"comment\":null},\"party\":{\"nested\":{\"Envelope\":{\"fields\":{\"partyKey\":{\"type\":\"PubKey\",\"id\":1,\"comment\":null},\"message\":{\"type\":\"Message\",\"id\":2,\"comment\":null}},\"comment\":null},\"FeedAdmit\":{\"fields\":{\"partyKey\":{\"type\":\"PubKey\",\"id\":1,\"comment\":null},\"feedKey\":{\"type\":\"PubKey\",\"id\":2,\"comment\":null}},\"comment\":null},\"FeedGenesis\":{\"fields\":{\"feedKey\":{\"type\":\"PubKey\",\"id\":1,\"comment\":null},\"ownerKey\":{\"type\":\"PubKey\",\"id\":2,\"comment\":null}},\"comment\":null},\"KeyAdmit\":{\"fields\":{\"partyKey\":{\"type\":\"PubKey\",\"id\":1,\"comment\":null},\"admitKey\":{\"type\":\"PubKey\",\"id\":2,\"comment\":null},\"admitKeyType\":{\"type\":\"KeyType\",\"id\":3,\"comment\":null}},\"comment\":null},\"PartyCredential\":{\"oneofs\":{\"contents\":{\"oneof\":[\"envelope\",\"partyGenesis\",\"keyAdmit\",\"feedAdmit\",\"feedGenesis\"],\"comment\":null}},\"fields\":{\"type\":{\"type\":\"Type\",\"id\":1,\"comment\":null},\"envelope\":{\"type\":\"Envelope\",\"id\":10,\"comment\":null},\"partyGenesis\":{\"type\":\"PartyGenesis\",\"id\":11,\"comment\":null},\"keyAdmit\":{\"type\":\"KeyAdmit\",\"id\":12,\"comment\":null},\"feedAdmit\":{\"type\":\"FeedAdmit\",\"id\":13,\"comment\":null},\"feedGenesis\":{\"type\":\"FeedGenesis\",\"id\":14,\"comment\":null}},\"nested\":{\"Type\":{\"values\":{\"ENVELOPE\":0,\"PARTY_GENESIS\":1,\"FEED_GENESIS\":2,\"KEY_ADMIT\":3,\"FEED_ADMIT\":4},\"comment\":null,\"comments\":{\"ENVELOPE\":null,\"PARTY_GENESIS\":null,\"FEED_GENESIS\":null,\"KEY_ADMIT\":null,\"FEED_ADMIT\":null}}},\"comment\":null},\"PartyGenesis\":{\"fields\":{\"partyKey\":{\"type\":\"PubKey\",\"id\":1,\"comment\":null},\"feedKey\":{\"type\":\"PubKey\",\"id\":2,\"comment\":null},\"admitKey\":{\"type\":\"PubKey\",\"id\":3,\"comment\":null},\"admitKeyType\":{\"type\":\"KeyType\",\"id\":4,\"comment\":null}},\"comment\":null},\"PartyInvitation\":{\"fields\":{\"id\":{\"type\":\"bytes\",\"id\":1,\"comment\":null},\"partyKey\":{\"type\":\"PubKey\",\"id\":2,\"comment\":null},\"issuerKey\":{\"type\":\"PubKey\",\"id\":3,\"comment\":null},\"inviteeKey\":{\"type\":\"PubKey\",\"id\":4,\"comment\":null}},\"comment\":null}}},\"SignedMessage\":{\"fields\":{\"signed\":{\"rule\":\"required\",\"type\":\"Signed\",\"id\":1,\"comment\":null},\"signatures\":{\"rule\":\"repeated\",\"type\":\"Signature\",\"id\":2,\"comment\":null}},\"nested\":{\"Signature\":{\"fields\":{\"key\":{\"rule\":\"required\",\"type\":\"PubKey\",\"id\":1,\"comment\":null},\"signature\":{\"rule\":\"required\",\"type\":\"bytes\",\"id\":2,\"comment\":null},\"keyChain\":{\"type\":\"KeyChain\",\"id\":3,\"comment\":null}},\"comment\":null},\"Signed\":{\"fields\":{\"created\":{\"rule\":\"required\",\"type\":\"string\",\"id\":1,\"comment\":null},\"nonce\":{\"rule\":\"required\",\"type\":\"bytes\",\"id\":2,\"comment\":null},\"payload\":{\"rule\":\"required\",\"type\":\"google.protobuf.Any\",\"id\":10,\"comment\":null}},\"comment\":null}},\"comment\":\"A generic container message used whenever messages are signed (e.g. PartyCredential)\"}}},\"halo\":{\"nested\":{\"keys\":{\"nested\":{\"KeyChain\":{\"fields\":{\"publicKey\":{\"rule\":\"required\",\"type\":\"PubKey\",\"id\":1,\"comment\":null},\"message\":{\"rule\":\"required\",\"type\":\"SignedMessage\",\"id\":2,\"comment\":null},\"parents\":{\"rule\":\"repeated\",\"type\":\"KeyChain\",\"id\":3,\"comment\":null}},\"comment\":null},\"KeyRecord\":{\"fields\":{\"type\":{\"rule\":\"required\",\"type\":\"KeyType\",\"id\":1,\"comment\":\"- The `KeyType` type of the key. This is often unknown for keys from other sources.\"},\"publicKey\":{\"rule\":\"required\",\"type\":\"PubKey\",\"id\":2,\"comment\":\"- The public key as a Buffer (required).\"},\"secretKey\":{\"type\":\"PrivKey\",\"id\":3,\"comment\":\"- The secret key as a Buffer (this will never be visible outside the Keyring).\"},\"hint\":{\"type\":\"bool\",\"id\":4,\"comment\":\"- Is this key from a Greeting \\\"hint\\\"?\"},\"own\":{\"type\":\"bool\",\"id\":5,\"comment\":\"- Is this our key? Usually true if `secretKey` is present,\\nmay be false for \\\"inception keys\\\" such as the Party key.\"},\"trusted\":{\"type\":\"bool\",\"id\":6,\"comment\":\"- Is this key to be trusted?\"},\"added\":{\"type\":\"string\",\"id\":7,\"comment\":\"- An RFC-3339 date/time string for when the key was added to the Keyring.\"},\"created\":{\"type\":\"string\",\"id\":8,\"comment\":\"- An RFC-3339 date/time string for when the key was created.\"}},\"comment\":null},\"KeyRecordList\":{\"fields\":{\"keys\":{\"rule\":\"repeated\",\"type\":\"KeyRecord\",\"id\":1,\"comment\":null}},\"comment\":null},\"KeyType\":{\"values\":{\"UNKNOWN\":0,\"IDENTITY\":1,\"DEVICE\":2,\"PARTY\":3,\"FEED\":4,\"DXNS_ADDRESS\":5},\"comment\":null,\"comments\":{\"UNKNOWN\":null,\"IDENTITY\":null,\"DEVICE\":null,\"PARTY\":null,\"FEED\":null,\"DXNS_ADDRESS\":null}},\"PrivKey\":{\"fields\":{\"data\":{\"type\":\"bytes\",\"id\":1,\"comment\":null}},\"comment\":null},\"PubKey\":{\"fields\":{\"data\":{\"type\":\"bytes\",\"id\":1,\"comment\":null}},\"comment\":null}}}}}}},\"google\":{\"nested\":{\"protobuf\":{\"nested\":{\"Any\":{\"fields\":{\"type_url\":{\"type\":\"string\",\"id\":1},\"value\":{\"type\":\"bytes\",\"id\":2}},\"comment\":null},\"BoolValue\":{\"fields\":{\"value\":{\"type\":\"bool\",\"id\":1}},\"comment\":null},\"BytesValue\":{\"fields\":{\"value\":{\"type\":\"bytes\",\"id\":1}},\"comment\":null},\"DoubleValue\":{\"fields\":{\"value\":{\"type\":\"double\",\"id\":1}},\"comment\":null},\"FloatValue\":{\"fields\":{\"value\":{\"type\":\"float\",\"id\":1}},\"comment\":null},\"Int32Value\":{\"fields\":{\"value\":{\"type\":\"int32\",\"id\":1}},\"comment\":null},\"Int64Value\":{\"fields\":{\"value\":{\"type\":\"int64\",\"id\":1}},\"comment\":null},\"StringValue\":{\"fields\":{\"value\":{\"type\":\"string\",\"id\":1}},\"comment\":null},\"UInt32Value\":{\"fields\":{\"value\":{\"type\":\"uint32\",\"id\":1}},\"comment\":null},\"UInt64Value\":{\"fields\":{\"value\":{\"type\":\"uint64\",\"id\":1}},\"comment\":null}}}}}}}");
52
+ export const schemaJson = JSON.parse("{\"nested\":{\"dxos\":{\"nested\":{\"credentials\":{\"nested\":{\"auth\":{\"nested\":{\"Auth\":{\"fields\":{\"partyKey\":{\"type\":\"PubKey\",\"id\":1,\"comment\":\"The publicKey of the target Party for these credentials.\"},\"deviceKey\":{\"type\":\"PubKey\",\"id\":2,\"comment\":\"The publicKey of the authenticating Device.\"},\"identityKey\":{\"type\":\"PubKey\",\"id\":3,\"comment\":\"The publicKey of the authenticating Identity.\"},\"feedKey\":{\"type\":\"PubKey\",\"id\":4,\"comment\":\"The publicKey of the authenticating Identity.\"},\"feedAdmit\":{\"type\":\"google.protobuf.Any\",\"id\":5,\"comment\":\"FeedAdmit message to the should be written to a control feed in case the `feedKey` is not admitted to the party.\"}},\"comment\":\"The payload for a SignedMessage sent during handshake for replication authentication.\"}}},\"greet\":{\"nested\":{\"BeginResponse\":{\"fields\":{\"info\":{\"keyType\":\"string\",\"type\":\"google.protobuf.Any\",\"id\":1,\"comment\":null}},\"comment\":null},\"ClaimResponse\":{\"fields\":{\"id\":{\"type\":\"bytes\",\"id\":1,\"comment\":null},\"rendezvousKey\":{\"type\":\"bytes\",\"id\":2,\"comment\":null}},\"comment\":null},\"Command\":{\"fields\":{\"command\":{\"type\":\"Type\",\"id\":1,\"comment\":null},\"secret\":{\"type\":\"bytes\",\"id\":2,\"comment\":null},\"params\":{\"rule\":\"repeated\",\"type\":\"google.protobuf.Any\",\"id\":10,\"comment\":null}},\"nested\":{\"Type\":{\"values\":{\"BEGIN\":0,\"HANDSHAKE\":1,\"NOTARIZE\":2,\"FINISH\":3,\"CLAIM\":10},\"comment\":null,\"comments\":{\"BEGIN\":null,\"HANDSHAKE\":null,\"NOTARIZE\":null,\"FINISH\":null,\"CLAIM\":null}}},\"comment\":\"A Greeter command.\"},\"HandshakeResponse\":{\"fields\":{\"nonce\":{\"type\":\"bytes\",\"id\":1,\"comment\":null},\"partyKey\":{\"type\":\"PubKey\",\"id\":2,\"comment\":null}},\"comment\":null},\"KeyHint\":{\"fields\":{\"publicKey\":{\"type\":\"PubKey\",\"id\":1,\"comment\":null},\"type\":{\"type\":\"KeyType\",\"id\":2,\"comment\":null}},\"comment\":null},\"NotarizeResponse\":{\"fields\":{\"copies\":{\"rule\":\"repeated\",\"type\":\"google.protobuf.Any\",\"id\":1,\"comment\":null},\"feedHints\":{\"rule\":\"repeated\",\"type\":\"PubKey\",\"id\":2,\"comment\":null}},\"comment\":null}}},\"identity\":{\"nested\":{\"DeviceInfo\":{\"fields\":{\"publicKey\":{\"type\":\"PubKey\",\"id\":1,\"comment\":null},\"displayName\":{\"type\":\"string\",\"id\":2,\"comment\":null}},\"comment\":null},\"IdentityInfo\":{\"fields\":{\"publicKey\":{\"type\":\"PubKey\",\"id\":1,\"comment\":null},\"displayName\":{\"type\":\"string\",\"id\":2,\"comment\":null}},\"comment\":null}}},\"Message\":{\"fields\":{\"payload\":{\"rule\":\"required\",\"type\":\"google.protobuf.Any\",\"id\":1,\"comment\":null}},\"comment\":null},\"party\":{\"nested\":{\"Envelope\":{\"fields\":{\"partyKey\":{\"type\":\"PubKey\",\"id\":1,\"comment\":null},\"message\":{\"type\":\"Message\",\"id\":2,\"comment\":null}},\"comment\":null},\"FeedAdmit\":{\"fields\":{\"partyKey\":{\"type\":\"PubKey\",\"id\":1,\"comment\":null},\"feedKey\":{\"type\":\"PubKey\",\"id\":2,\"comment\":null}},\"comment\":null},\"FeedGenesis\":{\"fields\":{\"feedKey\":{\"type\":\"PubKey\",\"id\":1,\"comment\":null},\"ownerKey\":{\"type\":\"PubKey\",\"id\":2,\"comment\":null}},\"comment\":null},\"KeyAdmit\":{\"fields\":{\"partyKey\":{\"type\":\"PubKey\",\"id\":1,\"comment\":null},\"admitKey\":{\"type\":\"PubKey\",\"id\":2,\"comment\":null},\"admitKeyType\":{\"type\":\"KeyType\",\"id\":3,\"comment\":null}},\"comment\":null},\"PartyCredential\":{\"oneofs\":{\"contents\":{\"oneof\":[\"envelope\",\"partyGenesis\",\"keyAdmit\",\"feedAdmit\",\"feedGenesis\"],\"comment\":null}},\"fields\":{\"type\":{\"type\":\"Type\",\"id\":1,\"comment\":null},\"envelope\":{\"type\":\"Envelope\",\"id\":10,\"comment\":null},\"partyGenesis\":{\"type\":\"PartyGenesis\",\"id\":11,\"comment\":null},\"keyAdmit\":{\"type\":\"KeyAdmit\",\"id\":12,\"comment\":null},\"feedAdmit\":{\"type\":\"FeedAdmit\",\"id\":13,\"comment\":null},\"feedGenesis\":{\"type\":\"FeedGenesis\",\"id\":14,\"comment\":null}},\"nested\":{\"Type\":{\"values\":{\"ENVELOPE\":0,\"PARTY_GENESIS\":1,\"FEED_GENESIS\":2,\"KEY_ADMIT\":3,\"FEED_ADMIT\":4},\"comment\":null,\"comments\":{\"ENVELOPE\":null,\"PARTY_GENESIS\":null,\"FEED_GENESIS\":null,\"KEY_ADMIT\":null,\"FEED_ADMIT\":null}}},\"comment\":null},\"PartyGenesis\":{\"fields\":{\"partyKey\":{\"type\":\"PubKey\",\"id\":1,\"comment\":null},\"feedKey\":{\"type\":\"PubKey\",\"id\":2,\"comment\":null},\"admitKey\":{\"type\":\"PubKey\",\"id\":3,\"comment\":null},\"admitKeyType\":{\"type\":\"KeyType\",\"id\":4,\"comment\":null}},\"comment\":null},\"PartyInvitation\":{\"fields\":{\"id\":{\"type\":\"bytes\",\"id\":1,\"comment\":null},\"partyKey\":{\"type\":\"PubKey\",\"id\":2,\"comment\":null},\"issuerKey\":{\"type\":\"PubKey\",\"id\":3,\"comment\":null},\"inviteeKey\":{\"type\":\"PubKey\",\"id\":4,\"comment\":null}},\"comment\":null}}},\"SignedMessage\":{\"fields\":{\"signed\":{\"rule\":\"required\",\"type\":\"Signed\",\"id\":1,\"comment\":null},\"signatures\":{\"rule\":\"repeated\",\"type\":\"Signature\",\"id\":2,\"comment\":null}},\"nested\":{\"Signature\":{\"fields\":{\"key\":{\"rule\":\"required\",\"type\":\"PubKey\",\"id\":1,\"comment\":null},\"signature\":{\"rule\":\"required\",\"type\":\"bytes\",\"id\":2,\"comment\":null},\"keyChain\":{\"type\":\"KeyChain\",\"id\":3,\"comment\":null}},\"comment\":null},\"Signed\":{\"fields\":{\"created\":{\"rule\":\"required\",\"type\":\"string\",\"id\":1,\"comment\":null},\"nonce\":{\"rule\":\"required\",\"type\":\"bytes\",\"id\":2,\"comment\":null},\"payload\":{\"rule\":\"required\",\"type\":\"google.protobuf.Any\",\"id\":10,\"comment\":null}},\"comment\":null}},\"comment\":\"A generic container message used whenever messages are signed (e.g. PartyCredential)\"}}},\"halo\":{\"nested\":{\"keys\":{\"nested\":{\"KeyChain\":{\"fields\":{\"publicKey\":{\"rule\":\"required\",\"type\":\"PubKey\",\"id\":1,\"comment\":null},\"message\":{\"rule\":\"required\",\"type\":\"SignedMessage\",\"id\":2,\"comment\":null},\"parents\":{\"rule\":\"repeated\",\"type\":\"KeyChain\",\"id\":3,\"comment\":null}},\"comment\":null},\"KeyRecord\":{\"fields\":{\"type\":{\"rule\":\"required\",\"type\":\"KeyType\",\"id\":1,\"comment\":\"The `KeyType` type of the key. This is often unknown for keys from other sources.\"},\"publicKey\":{\"rule\":\"required\",\"type\":\"PubKey\",\"id\":2,\"comment\":\"The public key as a Buffer (required).\"},\"secretKey\":{\"type\":\"PrivKey\",\"id\":3,\"comment\":\"The secret key as a Buffer (this will never be visible outside the Keyring).\"},\"hint\":{\"type\":\"bool\",\"id\":4,\"comment\":\"Is this key from a Greeting \\\"hint\\\"?\"},\"own\":{\"type\":\"bool\",\"id\":5,\"comment\":\"Determines if this is our key?\\nUsually true if `secretKey` is present; may be false for \\\"inception keys\\\" such as the Party key.\"},\"trusted\":{\"type\":\"bool\",\"id\":6,\"comment\":\"Is this key to be trusted?\"},\"added\":{\"type\":\"string\",\"id\":7,\"comment\":\"An RFC-3339 date/time string for when the key was added to the Keyring.\"},\"created\":{\"type\":\"string\",\"id\":8,\"comment\":\"An RFC-3339 date/time string for when the key was created.\"}},\"comment\":null},\"KeyRecordList\":{\"fields\":{\"keys\":{\"rule\":\"repeated\",\"type\":\"KeyRecord\",\"id\":1,\"comment\":null}},\"comment\":null},\"KeyType\":{\"values\":{\"UNKNOWN\":0,\"IDENTITY\":1,\"DEVICE\":2,\"PARTY\":3,\"FEED\":4,\"DXNS_ADDRESS\":5},\"comment\":null,\"comments\":{\"UNKNOWN\":null,\"IDENTITY\":null,\"DEVICE\":null,\"PARTY\":null,\"FEED\":null,\"DXNS_ADDRESS\":null}},\"PrivKey\":{\"fields\":{\"data\":{\"type\":\"bytes\",\"id\":1,\"comment\":null}},\"comment\":null},\"PubKey\":{\"fields\":{\"data\":{\"type\":\"bytes\",\"id\":1,\"comment\":null}},\"comment\":null}}}}}}},\"google\":{\"nested\":{\"protobuf\":{\"nested\":{\"Any\":{\"fields\":{\"type_url\":{\"type\":\"string\",\"id\":1},\"value\":{\"type\":\"bytes\",\"id\":2}},\"comment\":null},\"BoolValue\":{\"fields\":{\"value\":{\"type\":\"bool\",\"id\":1}},\"comment\":null},\"BytesValue\":{\"fields\":{\"value\":{\"type\":\"bytes\",\"id\":1}},\"comment\":null},\"DoubleValue\":{\"fields\":{\"value\":{\"type\":\"double\",\"id\":1}},\"comment\":null},\"FloatValue\":{\"fields\":{\"value\":{\"type\":\"float\",\"id\":1}},\"comment\":null},\"Int32Value\":{\"fields\":{\"value\":{\"type\":\"int32\",\"id\":1}},\"comment\":null},\"Int64Value\":{\"fields\":{\"value\":{\"type\":\"int64\",\"id\":1}},\"comment\":null},\"StringValue\":{\"fields\":{\"value\":{\"type\":\"string\",\"id\":1}},\"comment\":null},\"UInt32Value\":{\"fields\":{\"value\":{\"type\":\"uint32\",\"id\":1}},\"comment\":null},\"UInt64Value\":{\"fields\":{\"value\":{\"type\":\"uint64\",\"id\":1}},\"comment\":null}}}}}}}");
53
53
  export const schema = Schema.fromJson<TYPES, SERVICES>(schemaJson, substitutions);
@@ -3,7 +3,7 @@
3
3
  //
4
4
 
5
5
  import { anySubstitutions } from '@dxos/codec-protobuf';
6
- import { publicKeySubstitutions } from '@dxos/crypto';
6
+ import { publicKeySubstitutions } from '@dxos/protocols';
7
7
 
8
8
  export default {
9
9
  ...anySubstitutions,