@dxos/credentials 2.23.1-dev.f5b1145e → 2.24.1-dev.4c2329ab

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.
@@ -6,7 +6,7 @@ import matches from 'lodash.matches';
6
6
 
7
7
  import { PublicKey, PublicKeyLike } from '@dxos/crypto';
8
8
 
9
- export type FilterFuntion = (obj: any) => boolean;
9
+ export type FilterFunction = (obj: any) => boolean;
10
10
 
11
11
  /**
12
12
  * Utility to create simple filtering predicates.
@@ -15,42 +15,42 @@ export class Filter {
15
15
  /**
16
16
  * Execute the filter over the supplied values.
17
17
  */
18
- static filter (values: IterableIterator<any>, filter: FilterFuntion) {
18
+ static filter (values: IterableIterator<any>, filter: FilterFunction) {
19
19
  return Array.from(values).filter(value => filter(value));
20
20
  }
21
21
 
22
22
  /**
23
23
  * Negates a filter.
24
24
  */
25
- static not (filter: FilterFuntion): FilterFuntion {
25
+ static not (filter: FilterFunction): FilterFunction {
26
26
  return value => !filter(value);
27
27
  }
28
28
 
29
29
  /**
30
30
  * ANDs all supplied filters.
31
31
  */
32
- static and (...filters: FilterFuntion[]): FilterFuntion {
32
+ static and (...filters: FilterFunction[]): FilterFunction {
33
33
  return value => filters.every(filter => filter(value));
34
34
  }
35
35
 
36
36
  /**
37
37
  * Filters objects for required property.
38
38
  */
39
- static hasProperty (property: string): FilterFuntion {
39
+ static hasProperty (property: string): FilterFunction {
40
40
  return ({ [property]: value }) => value !== undefined;
41
41
  }
42
42
 
43
43
  /**
44
44
  * Filters objects for given property values.
45
45
  */
46
- static propertyIn (property: string, values: any[]): FilterFuntion {
46
+ static propertyIn (property: string, values: any[]): FilterFunction {
47
47
  return ({ [property]: value }) => values.includes(value);
48
48
  }
49
49
 
50
50
  /**
51
51
  * Filters objects for required key.
52
52
  */
53
- static hasKey (property: string, key: PublicKeyLike): FilterFuntion {
53
+ static hasKey (property: string, key: PublicKeyLike): FilterFunction {
54
54
  return ({ [property]: value }) => PublicKey.from(value).equals(key);
55
55
  }
56
56
 
@@ -58,7 +58,7 @@ export class Filter {
58
58
  * Filters objects for exact object.
59
59
  * https://lodash.com/docs/#matches
60
60
  */
61
- static matches (attributes: any): FilterFuntion {
61
+ static matches (attributes: any): FilterFunction {
62
62
  return matches(attributes);
63
63
  }
64
64
  }
@@ -9,7 +9,7 @@
9
9
  import assert from 'assert';
10
10
  import stableStringify from 'json-stable-stringify';
11
11
 
12
- import { createKeyPair, KeyPair, PublicKey, PublicKeyLike } from '@dxos/crypto';
12
+ import { createKeyPair, KeyPair, PublicKey, PublicKeyLike, PUBLIC_KEY_LENGTH, SECRET_KEY_LENGTH } from '@dxos/crypto';
13
13
 
14
14
  import { KeyChain, KeyRecord, KeyType, createDateTimeString } from '../proto';
15
15
  import { MakeOptional } from '../typedefs';
@@ -19,9 +19,12 @@ import { SecretKey } from './keytype';
19
19
  * Checks for a valid publicKey Buffer.
20
20
  */
21
21
  // TODO(burdon): Move to dxos/crypto.
22
- export function isValidPublicKey (key: PublicKeyLike): key is PublicKeyLike {
22
+ export function isValidPublicKey (key: PublicKeyLike, keyType?: KeyType): key is PublicKeyLike {
23
23
  try {
24
24
  PublicKey.from(key);
25
+ if (keyType && [KeyType.PARTY, KeyType.IDENTITY, KeyType.FEED, KeyType.DEVICE].includes(keyType)) {
26
+ assert(PublicKey.from(key).asUint8Array().length === PUBLIC_KEY_LENGTH);
27
+ }
25
28
  return true;
26
29
  } catch (e: any) {
27
30
  }
@@ -32,17 +35,20 @@ export function isValidPublicKey (key: PublicKeyLike): key is PublicKeyLike {
32
35
  * Checks for a valid publicKey Buffer.
33
36
  */
34
37
  // TODO(burdon): Move to dxos/crypto.
35
- export function assertValidPublicKey (key: PublicKeyLike): asserts key is PublicKeyLike {
38
+ export function assertValidPublicKey (key: PublicKeyLike, keyType?: KeyType): asserts key is PublicKeyLike {
36
39
  assert(key);
37
- assert(isValidPublicKey(key));
40
+ assert(isValidPublicKey(key, keyType));
38
41
  }
39
42
 
40
43
  /**
41
44
  * Checks for a valid secretKey Buffer.
42
45
  */
43
46
  // TODO(burdon): Move to dxos/crypto.
44
- export function assertValidSecretKey (key?: SecretKey): asserts key is SecretKey {
45
- assert(key && key.length === 64);
47
+ export function assertValidSecretKey (key?: SecretKey, keyType?: KeyType): asserts key is SecretKey {
48
+ assert(key);
49
+ if (keyType && [KeyType.PARTY, KeyType.IDENTITY, KeyType.FEED, KeyType.DEVICE].includes(keyType)) {
50
+ assert(key.length === SECRET_KEY_LENGTH);
51
+ }
46
52
  }
47
53
 
48
54
  /**
@@ -50,9 +56,9 @@ export function assertValidSecretKey (key?: SecretKey): asserts key is SecretKey
50
56
  */
51
57
  // TODO(burdon): Move to dxos/crypto.
52
58
  export function assertValidKeyPair (keyRecord: any): asserts keyRecord is KeyPair {
53
- const { publicKey, secretKey } = keyRecord;
54
- assertValidPublicKey(publicKey);
55
- assertValidSecretKey(secretKey);
59
+ const { publicKey, secretKey, type } = keyRecord;
60
+ assertValidPublicKey(publicKey, type);
61
+ assertValidSecretKey(secretKey, type);
56
62
  }
57
63
 
58
64
  /**
@@ -194,7 +194,8 @@ it('Attempt to add a badly formatted key', async () => {
194
194
  const good = createKeyPair();
195
195
  const bad = {
196
196
  publicKey: keyToString(good.publicKey),
197
- secretKey: keyToString(good.secretKey)
197
+ secretKey: keyToString(good.secretKey),
198
+ type: KeyType.IDENTITY
198
199
  };
199
200
 
200
201
  await expect(() => keyring.addKeyRecord(bad as any)).rejects.toBeInstanceOf(assert.AssertionError);
@@ -225,7 +226,8 @@ it('Attempt to add keyRecord with reversed publicKey/secretKey', async () => {
225
226
  const good = createKeyPair();
226
227
  const bad = {
227
228
  secretKey: good.publicKey,
228
- publicKey: good.secretKey
229
+ publicKey: good.secretKey,
230
+ type: KeyType.IDENTITY
229
231
  };
230
232
 
231
233
  await expect(() => keyring.addKeyRecord(bad as any)).rejects.toBeInstanceOf(assert.AssertionError);
@@ -235,7 +237,8 @@ it('Attempt to add secretKey as a publicKey', async () => {
235
237
  const { secretKey } = createKeyPair();
236
238
  const keyring = new Keyring();
237
239
  const bad = {
238
- publicKey: secretKey
240
+ publicKey: secretKey,
241
+ type: KeyType.IDENTITY
239
242
  };
240
243
 
241
244
  await expect(() => keyring.addPublicKey(bad as any)).rejects.toBeInstanceOf(assert.AssertionError);
@@ -370,3 +373,15 @@ it('Authenticate flow for Kube/Keyhole authentication', async () => {
370
373
  expect(Buffer.from(signedCredential.signed.nonce).toString()).toBe(Buffer.from('challenge token').toString());
371
374
  expect(kubeKeyring.verify(signedCredential)).toBe(true);
372
375
  });
376
+
377
+ it('Storing DXNS keys', async () => {
378
+ const keyring = new Keyring();
379
+ const secretKey = Buffer.from('sock force bubble lock tank staff cycle extra tobacco super sniff bachelor');
380
+ const publicKey = PublicKey.fromHex('ba44cf74f42e924d864f0aa362f6ae3788ba8500d1245fa3c863113d2f001d37');
381
+
382
+ await keyring.addKeyRecord({
383
+ secretKey,
384
+ publicKey,
385
+ type: KeyType.DXNS
386
+ });
387
+ });
@@ -17,7 +17,7 @@ import {
17
17
  KeyChain, KeyRecord, KeyRecordList, KeyType, Message, SignedMessage, WithTypeUrl, createDateTimeString
18
18
  } from '../proto';
19
19
  import { RawSignature } from '../typedefs';
20
- import { Filter, FilterFuntion } from './filter';
20
+ import { Filter, FilterFunction } from './filter';
21
21
  import {
22
22
  assertNoSecrets,
23
23
  assertValidKeyPair,
@@ -353,7 +353,7 @@ export class Keyring implements Signer {
353
353
  */
354
354
  @meter
355
355
  async addPublicKey (keyRecord: Omit<KeyRecord, 'key' | 'secretKey'>) {
356
- assertValidPublicKey(keyRecord.publicKey);
356
+ assertValidPublicKey(keyRecord.publicKey, keyRecord.type);
357
357
  assertNoSecrets(keyRecord);
358
358
 
359
359
  return this._addKeyRecord(keyRecord);
@@ -415,7 +415,7 @@ export class Keyring implements Signer {
415
415
  @meter
416
416
  async updateKey (keyRecord: KeyRecord) {
417
417
  assert(keyRecord);
418
- assertValidPublicKey(keyRecord.publicKey);
418
+ assertValidPublicKey(keyRecord.publicKey, keyRecord.type);
419
419
 
420
420
  // Do not allow updating/changing secrets.
421
421
  const cleaned = stripSecrets(keyRecord);
@@ -439,7 +439,7 @@ export class Keyring implements Signer {
439
439
  @meter
440
440
  async deleteSecretKey (keyRecord: KeyRecord) {
441
441
  assert(keyRecord);
442
- assertValidPublicKey(keyRecord.publicKey);
442
+ assertValidPublicKey(keyRecord.publicKey, keyRecord.type);
443
443
 
444
444
  const existing = this.getFullKey(keyRecord.publicKey);
445
445
  if (existing) {
@@ -452,17 +452,15 @@ export class Keyring implements Signer {
452
452
 
453
453
  /**
454
454
  * Returns true if the stored KeyRecord has a secretKey available.
455
- * @param keyRecord
456
- * @returns {boolean}
457
455
  */
458
456
  @meter
459
- hasSecretKey (keyRecord: KeyRecord | KeyChain) {
457
+ hasSecretKey (keyRecord: KeyRecord | KeyChain): boolean {
460
458
  assert(keyRecord);
461
459
  const { publicKey } = keyRecord;
462
460
  assertValidPublicKey(publicKey);
463
461
 
464
462
  const existing = this.getFullKey(publicKey);
465
- return existing && Buffer.isBuffer(existing.secretKey);
463
+ return existing ? Buffer.isBuffer(existing.secretKey) : false;
466
464
  }
467
465
 
468
466
  /**
@@ -512,7 +510,7 @@ export class Keyring implements Signer {
512
510
  /**
513
511
  * Find all keys matching the indicated criteria: 'key', 'type', 'own', etc.
514
512
  */
515
- private _findFullKeys (...filters: FilterFuntion[]): KeyRecord[] {
513
+ private _findFullKeys (...filters: FilterFunction[]): KeyRecord[] {
516
514
  return Filter.filter(this._keyCache.values(), Filter.and(...filters));
517
515
  }
518
516
 
@@ -523,14 +521,14 @@ export class Keyring implements Signer {
523
521
  * @returns {KeyRecord[]} KeyRecords, without secretKeys
524
522
  */
525
523
  @meter
526
- findKeys (...filters: FilterFuntion[]): KeyRecord[] {
524
+ findKeys (...filters: FilterFunction[]): KeyRecord[] {
527
525
  return this._findFullKeys(...filters).map(stripSecrets);
528
526
  }
529
527
 
530
528
  /**
531
529
  * Find one key matching the indicated criteria: 'party', 'type', etc.
532
530
  */
533
- private _findFullKey (...filters: FilterFuntion[]): KeyRecord | undefined {
531
+ private _findFullKey (...filters: FilterFunction[]): KeyRecord | undefined {
534
532
  const matches = this._findFullKeys(...filters);
535
533
  if (matches.length > 1) {
536
534
  throw Error(`Expected <= 1 matching keys; found ${matches.length}.`);
@@ -544,7 +542,7 @@ export class Keyring implements Signer {
544
542
  * @returns KeyRecord, without secretKey
545
543
  */
546
544
  @meter
547
- findKey (...filters: FilterFuntion[]) {
545
+ findKey (...filters: FilterFunction[]) {
548
546
  const key = this._findFullKey(...filters);
549
547
  return key ? stripSecrets(key) : undefined;
550
548
  }
@@ -11,7 +11,8 @@ export enum KeyType {
11
11
  IDENTITY = 1,
12
12
  DEVICE = 2,
13
13
  PARTY = 3,
14
- FEED = 4
14
+ FEED = 4,
15
+ DXNS = 5
15
16
  }
16
17
  export interface PubKey {
17
18
  data?: Uint8Array;
@@ -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\":null},\"deviceKey\":{\"type\":\"PubKey\",\"id\":2,\"comment\":null},\"identityKey\":{\"type\":\"PubKey\",\"id\":3,\"comment\":null},\"feedKey\":{\"type\":\"PubKey\",\"id\":4,\"comment\":null}},\"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},\"hints\":{\"rule\":\"repeated\",\"type\":\"KeyHint\",\"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},\"comment\":null,\"comments\":{\"UNKNOWN\":null,\"IDENTITY\":null,\"DEVICE\":null,\"PARTY\":null,\"FEED\":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\":null},\"deviceKey\":{\"type\":\"PubKey\",\"id\":2,\"comment\":null},\"identityKey\":{\"type\":\"PubKey\",\"id\":3,\"comment\":null},\"feedKey\":{\"type\":\"PubKey\",\"id\":4,\"comment\":null}},\"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},\"hints\":{\"rule\":\"repeated\",\"type\":\"KeyHint\",\"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\":5},\"comment\":null,\"comments\":{\"UNKNOWN\":null,\"IDENTITY\":null,\"DEVICE\":null,\"PARTY\":null,\"FEED\":null,\"DXNS\":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);