@dxos/credentials 2.33.1-dev.83d113fe → 2.33.1-dev.eb88db79

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 (62) hide show
  1. package/.rush/temp/package-deps_build.json +14 -14
  2. package/.rush/temp/package-deps_build:test.json +13 -13
  3. package/.rush/temp/package-deps_prerelease.json +13 -13
  4. package/dist/src/auth/auth-message.d.ts +1 -1
  5. package/dist/src/auth/auth-message.d.ts.map +1 -1
  6. package/dist/src/auth/auth-message.js +4 -3
  7. package/dist/src/auth/auth-message.js.map +1 -1
  8. package/dist/src/auth/auth-plugin.test.js +2 -4
  9. package/dist/src/auth/auth-plugin.test.js.map +1 -1
  10. package/dist/src/auth/auth.test.d.ts.map +1 -1
  11. package/dist/src/auth/auth.test.js +255 -248
  12. package/dist/src/auth/auth.test.js.map +1 -1
  13. package/dist/src/auth/authenticator.d.ts +9 -14
  14. package/dist/src/auth/authenticator.d.ts.map +1 -1
  15. package/dist/src/auth/authenticator.js +15 -46
  16. package/dist/src/auth/authenticator.js.map +1 -1
  17. package/dist/src/greet/greeter-plugin.test.js +4 -4
  18. package/dist/src/greet/greeter-plugin.test.js.map +1 -1
  19. package/dist/src/greet/greeter.d.ts +15 -15
  20. package/dist/src/greet/greeter.js +5 -5
  21. package/dist/src/greet/greeter.js.map +1 -1
  22. package/dist/src/greet/greeter.test.js +12 -12
  23. package/dist/src/greet/greeter.test.js.map +1 -1
  24. package/dist/src/greet/greeting-message.d.ts +2 -2
  25. package/dist/src/greet/greeting-message.js +9 -9
  26. package/dist/src/greet/greeting-message.js.map +1 -1
  27. package/dist/src/identity/identity-message.js +4 -4
  28. package/dist/src/identity/identity-message.js.map +1 -1
  29. package/dist/src/keys/keyring-helpers.d.ts.map +1 -1
  30. package/dist/src/keys/keyring-helpers.js +4 -3
  31. package/dist/src/keys/keyring-helpers.js.map +1 -1
  32. package/dist/src/keys/keyring.js +2 -2
  33. package/dist/src/keys/keyring.js.map +1 -1
  34. package/dist/src/party/party-credential.d.ts +1 -1
  35. package/dist/src/party/party-credential.js +10 -10
  36. package/dist/src/party/party-credential.js.map +1 -1
  37. package/dist/src/proto/any.d.ts +3 -3
  38. package/dist/src/proto/any.d.ts.map +1 -1
  39. package/dist/src/proto/gen/dxos/credentials/auth.d.ts +16 -0
  40. package/dist/src/proto/gen/dxos/credentials/auth.d.ts.map +1 -1
  41. package/dist/src/proto/gen/index.d.ts.map +1 -1
  42. package/dist/src/proto/gen/index.js +1 -1
  43. package/dist/src/proto/gen/index.js.map +1 -1
  44. package/dist/src/proto/substitutions.d.ts +1 -1
  45. package/dist/tsconfig.tsbuildinfo +1 -1
  46. package/package.json +11 -11
  47. package/src/auth/auth-message.ts +5 -3
  48. package/src/auth/auth-plugin.test.ts +7 -9
  49. package/src/auth/auth.test.ts +551 -0
  50. package/src/auth/authenticator.ts +21 -42
  51. package/src/greet/greeter-plugin.test.ts +4 -4
  52. package/src/greet/greeter.test.js +12 -12
  53. package/src/greet/greeter.ts +5 -5
  54. package/src/greet/greeting-message.ts +9 -9
  55. package/src/identity/identity-message.ts +4 -4
  56. package/src/keys/keyring-helpers.ts +4 -3
  57. package/src/keys/keyring.ts +2 -2
  58. package/src/party/party-credential.ts +10 -10
  59. package/src/proto/any.ts +3 -3
  60. package/src/proto/gen/dxos/credentials/auth.ts +16 -0
  61. package/src/proto/gen/index.ts +1 -1
  62. package/src/auth/auth.test.js +0 -515
@@ -55,7 +55,7 @@ it('Good invitation', async () => {
55
55
  {
56
56
  const message = codecLoop({
57
57
  payload: {
58
- __type_url: 'dxos.credentials.greet.Command',
58
+ '@type': 'dxos.credentials.greet.Command',
59
59
  command: Command.Type.BEGIN
60
60
  }
61
61
  });
@@ -71,7 +71,7 @@ it('Good invitation', async () => {
71
71
  {
72
72
  const message = codecLoop({
73
73
  payload: {
74
- __type_url: 'dxos.credentials.greet.Command',
74
+ '@type': 'dxos.credentials.greet.Command',
75
75
  command: Command.Type.HANDSHAKE,
76
76
  secret: await secretProvider()
77
77
  }
@@ -91,7 +91,7 @@ it('Good invitation', async () => {
91
91
  {
92
92
  const message = {
93
93
  payload: {
94
- __type_url: 'dxos.credentials.greet.Command',
94
+ '@type': 'dxos.credentials.greet.Command',
95
95
  command: Command.Type.NOTARIZE,
96
96
  secret: await secretProvider(),
97
97
  params: [
@@ -114,7 +114,7 @@ it('Good invitation', async () => {
114
114
  {
115
115
  const message = codecLoop({
116
116
  payload: {
117
- __type_url: 'dxos.credentials.greet.Command',
117
+ '@type': 'dxos.credentials.greet.Command',
118
118
  command: Command.Type.FINISH,
119
119
  secret: await secretProvider()
120
120
  }
@@ -139,7 +139,7 @@ it('Bad invitation secret', async () => {
139
139
  {
140
140
  const message = codecLoop({
141
141
  payload: {
142
- __type_url: 'dxos.credentials.greet.Command',
142
+ '@type': 'dxos.credentials.greet.Command',
143
143
  command: Command.Type.BEGIN
144
144
  }
145
145
  });
@@ -151,7 +151,7 @@ it('Bad invitation secret', async () => {
151
151
  {
152
152
  const message = codecLoop({
153
153
  payload: {
154
- __type_url: 'dxos.credentials.greet.Command',
154
+ '@type': 'dxos.credentials.greet.Command',
155
155
  command: Command.Type.HANDSHAKE,
156
156
  secret: Buffer.from('wrong')
157
157
  }
@@ -174,7 +174,7 @@ it('Attempt to re-use invitation', async () => {
174
174
  {
175
175
  const message = codecLoop({
176
176
  payload: {
177
- __type_url: 'dxos.credentials.greet.Command',
177
+ '@type': 'dxos.credentials.greet.Command',
178
178
  command: Command.Type.BEGIN
179
179
  }
180
180
  });
@@ -186,7 +186,7 @@ it('Attempt to re-use invitation', async () => {
186
186
  {
187
187
  const message = codecLoop({
188
188
  payload: {
189
- __type_url: 'dxos.credentials.greet.Command',
189
+ '@type': 'dxos.credentials.greet.Command',
190
190
  command: Command.Type.HANDSHAKE,
191
191
  secret: await secretProvider()
192
192
  }
@@ -201,7 +201,7 @@ it('Attempt to re-use invitation', async () => {
201
201
  {
202
202
  const message = {
203
203
  payload: {
204
- __type_url: 'dxos.credentials.greet.Command',
204
+ '@type': 'dxos.credentials.greet.Command',
205
205
  command: Command.Type.NOTARIZE,
206
206
  secret: await secretProvider(),
207
207
  params: [
@@ -249,14 +249,14 @@ it('WellKnownType params - BytesValue', async () => {
249
249
  const value = randomBytes();
250
250
 
251
251
  const command = codecLoop({
252
- __type_url: 'dxos.credentials.Message',
252
+ '@type': 'dxos.credentials.Message',
253
253
  payload: {
254
- __type_url: 'dxos.credentials.greet.Command',
254
+ '@type': 'dxos.credentials.greet.Command',
255
255
  command: Command.Type.CLAIM,
256
256
  secret: Buffer.from('123'),
257
257
  params: [
258
258
  {
259
- __type_url: 'google.protobuf.BytesValue',
259
+ '@type': 'google.protobuf.BytesValue',
260
260
  value
261
261
  }
262
262
  ]
@@ -193,14 +193,14 @@ export class Greeter {
193
193
  await invitation.begin();
194
194
 
195
195
  return {
196
- __type_url: 'dxos.credentials.greet.BeginResponse',
196
+ '@type': 'dxos.credentials.greet.BeginResponse',
197
197
  info: {
198
198
  id: {
199
- __type_url: 'google.protobuf.BytesValue',
199
+ '@type': 'google.protobuf.BytesValue',
200
200
  value: invitation.id
201
201
  },
202
202
  authNonce: {
203
- __type_url: 'google.protobuf.BytesValue',
203
+ '@type': 'google.protobuf.BytesValue',
204
204
  value: invitation.authNonce
205
205
  }
206
206
  }
@@ -214,7 +214,7 @@ export class Greeter {
214
214
 
215
215
  await invitation.handshake();
216
216
  return {
217
- __type_url: 'dxos.credentials.greet.HandshakeResponse',
217
+ '@type': 'dxos.credentials.greet.HandshakeResponse',
218
218
  partyKey: invitation.partyKey,
219
219
  nonce: invitation.nonce
220
220
  };
@@ -260,7 +260,7 @@ export class Greeter {
260
260
 
261
261
  await invitation.notarize();
262
262
  return {
263
- __type_url: 'dxos.credentials.greet.NotarizeResponse',
263
+ '@type': 'dxos.credentials.greet.NotarizeResponse',
264
264
  copies,
265
265
  hints
266
266
  };
@@ -10,11 +10,11 @@ const TYPE_URL_GREETING_COMMAND = 'dxos.credentials.greet.Command';
10
10
 
11
11
  /**
12
12
  * Create a Greeting 'BEGIN' command message.
13
- * @returns {{__type_url: string, command: *}}
13
+ * @returns {{'@type': string, command: *}}
14
14
  */
15
15
  export const createGreetingBeginMessage = (): WithTypeUrl<Command> => {
16
16
  return {
17
- __type_url: TYPE_URL_GREETING_COMMAND,
17
+ '@type': TYPE_URL_GREETING_COMMAND,
18
18
  command: Command.Type.BEGIN,
19
19
  params: []
20
20
  };
@@ -28,7 +28,7 @@ export const createGreetingHandshakeMessage = (secret: Buffer, params = []): Wit
28
28
  assert(Array.isArray(params));
29
29
 
30
30
  return {
31
- __type_url: TYPE_URL_GREETING_COMMAND,
31
+ '@type': TYPE_URL_GREETING_COMMAND,
32
32
  command: Command.Type.HANDSHAKE,
33
33
  params,
34
34
  secret
@@ -43,7 +43,7 @@ export const createGreetingNotarizeMessage = (secret: Buffer, credentialMessages
43
43
  assert(Array.isArray(credentialMessages));
44
44
 
45
45
  return {
46
- __type_url: TYPE_URL_GREETING_COMMAND,
46
+ '@type': TYPE_URL_GREETING_COMMAND,
47
47
  command: Command.Type.NOTARIZE,
48
48
  params: credentialMessages,
49
49
  secret
@@ -57,7 +57,7 @@ export const createGreetingFinishMessage = (secret: Buffer): WithTypeUrl<Command
57
57
  assert(Buffer.isBuffer(secret), 'Secret is not a buffer.');
58
58
 
59
59
  return {
60
- __type_url: TYPE_URL_GREETING_COMMAND,
60
+ '@type': TYPE_URL_GREETING_COMMAND,
61
61
  command: Command.Type.FINISH,
62
62
  secret,
63
63
  params: []
@@ -71,11 +71,11 @@ export const createGreetingClaimMessage = (invitationID: Buffer): WithTypeUrl<Co
71
71
  assert(Buffer.isBuffer(invitationID), 'invitationID is not a buffer.');
72
72
 
73
73
  return {
74
- __type_url: TYPE_URL_GREETING_COMMAND,
74
+ '@type': TYPE_URL_GREETING_COMMAND,
75
75
  command: Command.Type.CLAIM,
76
76
  params: [
77
77
  {
78
- __type_url: 'google.protobuf.BytesValue',
78
+ '@type': 'google.protobuf.BytesValue',
79
79
  value: invitationID
80
80
  }
81
81
  ]
@@ -86,14 +86,14 @@ export const createGreetingClaimMessage = (invitationID: Buffer): WithTypeUrl<Co
86
86
  * Crate a Greeting ClaimResponse message.
87
87
  * @param {Buffer} id The ID of the new invitation.
88
88
  * @param {Buffer} rendezvousKey The swarm key to use for Greeting.
89
- * @returns {{__type_url: string, payload: {__type_url: string, rendezvousKey: *, id: *}}}
89
+ * @returns {{'@type': string, payload: {'@type': string, rendezvousKey: *, id: *}}}
90
90
  */
91
91
  export const createGreetingClaimResponse = (id: Buffer, rendezvousKey: Buffer): WithTypeUrl<ClaimResponse> => {
92
92
  assert(id);
93
93
  assert(Buffer.isBuffer(rendezvousKey), 'rendezvousKey is not a buffer.');
94
94
 
95
95
  return {
96
- __type_url: 'dxos.credentials.greet.ClaimResponse',
96
+ '@type': 'dxos.credentials.greet.ClaimResponse',
97
97
  id,
98
98
  rendezvousKey
99
99
  };
@@ -9,12 +9,12 @@ import { unwrapEnvelopes, extractContents, unwrapMessage, wrapMessage } from '..
9
9
  import { DeviceInfo, IdentityInfo, KeyRecord, Message, SignedMessage, WithTypeUrl } from '../proto';
10
10
 
11
11
  /**
12
- * Return the __type_url, if present.
12
+ * Return the @type, if present.
13
13
  * @param message
14
14
  */
15
15
  function getTypeUrl (message: any) {
16
16
  // eslint-disable-next-line camelcase
17
- return message?.__type_url;
17
+ return message?.['@type'];
18
18
  }
19
19
 
20
20
  /**
@@ -26,7 +26,7 @@ export const createDeviceInfoMessage = (keyring: Keyring, displayName: string, d
26
26
  assert(deviceKey);
27
27
 
28
28
  const message: WithTypeUrl<DeviceInfo> = {
29
- __type_url: 'dxos.credentials.identity.DeviceInfo',
29
+ '@type': 'dxos.credentials.identity.DeviceInfo',
30
30
  publicKey: deviceKey.publicKey,
31
31
  displayName
32
32
  };
@@ -43,7 +43,7 @@ export const createIdentityInfoMessage = (keyring: Keyring, displayName: string,
43
43
  assert(identityKey);
44
44
 
45
45
  const message: WithTypeUrl<IdentityInfo> = {
46
- __type_url: 'dxos.credentials.identity.IdentityInfo',
46
+ '@type': 'dxos.credentials.identity.IdentityInfo',
47
47
  publicKey: identityKey.publicKey,
48
48
  displayName
49
49
  };
@@ -132,11 +132,12 @@ export const canonicalStringify = (obj: any) => {
132
132
  return stableStringify(obj, {
133
133
  /* The point of signing and verifying is not that the internal, private state of the objects be
134
134
  * identical, but that the public contents can be verified not to have been altered. For that reason,
135
- * really private fields (indicated by '__') are not included in the signature. In practice, this skips __type_url,
136
- * and it also gives a mechanism for attaching other attributes to an object without breaking the signature.
135
+ * really private fields (indicated by '__') are not included in the signature.
136
+ * This gives a mechanism for attaching other attributes to an object without breaking the signature.
137
+ * We also skip @type.
137
138
  */
138
139
  replacer: (key: any, value: any) => {
139
- if (key.toString().startsWith('__')) {
140
+ if (key.toString().startsWith('__') || key.toString() === '@type') {
140
141
  return undefined;
141
142
  }
142
143
  if (value) {
@@ -140,7 +140,7 @@ export class Keyring implements Signer {
140
140
  });
141
141
 
142
142
  return {
143
- __type_url: 'dxos.credentials.SignedMessage',
143
+ '@type': 'dxos.credentials.SignedMessage',
144
144
  signed,
145
145
  signatures
146
146
  };
@@ -564,7 +564,7 @@ export class Keyring implements Signer {
564
564
  });
565
565
 
566
566
  return canonicalStringify({
567
- __type_url: 'dxos.credentials.keys.KeyRecordList',
567
+ '@type': 'dxos.credentials.keys.KeyRecordList',
568
568
  keys
569
569
  });
570
570
  }
@@ -34,7 +34,7 @@ export const createPartyGenesisMessage = (
34
34
  assert(typeof admitKeyPair.type !== 'undefined');
35
35
 
36
36
  const message: WithTypeUrl<PartyCredential> = {
37
- __type_url: TYPE_URL_PARTY_CREDENTIAL,
37
+ '@type': TYPE_URL_PARTY_CREDENTIAL,
38
38
  type: PartyCredential.Type.PARTY_GENESIS,
39
39
  partyGenesis: {
40
40
  partyKey: partyKeyPair.publicKey,
@@ -61,7 +61,7 @@ export const createKeyAdmitMessage = (
61
61
  partyKey = PublicKey.from(partyKey);
62
62
 
63
63
  const message: WithTypeUrl<PartyCredential> = {
64
- __type_url: TYPE_URL_PARTY_CREDENTIAL,
64
+ '@type': TYPE_URL_PARTY_CREDENTIAL,
65
65
  type: PartyCredential.Type.KEY_ADMIT,
66
66
  keyAdmit: {
67
67
  partyKey,
@@ -87,7 +87,7 @@ export const createFeedAdmitMessage = (
87
87
  partyKey = PublicKey.from(partyKey);
88
88
 
89
89
  const message: WithTypeUrl<PartyCredential> = {
90
- __type_url: TYPE_URL_PARTY_CREDENTIAL,
90
+ '@type': TYPE_URL_PARTY_CREDENTIAL,
91
91
  type: PartyCredential.Type.FEED_ADMIT,
92
92
  feedAdmit: {
93
93
  partyKey,
@@ -115,7 +115,7 @@ export const createEnvelopeMessage = (
115
115
  partyKey = PublicKey.from(partyKey);
116
116
 
117
117
  const message: WithTypeUrl<PartyCredential> = {
118
- __type_url: TYPE_URL_PARTY_CREDENTIAL,
118
+ '@type': TYPE_URL_PARTY_CREDENTIAL,
119
119
  type: PartyCredential.Type.ENVELOPE,
120
120
  envelope: {
121
121
  partyKey,
@@ -134,7 +134,7 @@ export const createEnvelopeMessage = (
134
134
  export const isPartyCredentialMessage = (message: Message | SignedMessage) => {
135
135
  const signed = unwrapMessage(message) as SignedMessage;
136
136
  // eslint-disable-next-line camelcase
137
- return signed?.signed?.payload?.__type_url === TYPE_URL_PARTY_CREDENTIAL;
137
+ return signed?.signed?.payload?.['@type'] === TYPE_URL_PARTY_CREDENTIAL;
138
138
  };
139
139
 
140
140
  /**
@@ -166,7 +166,7 @@ export function isSignedMessage (message: any): message is SignedMessage {
166
166
  // TODO(burdon): Typespec is too loose.
167
167
  export function wrapMessage (message: Message | SignedMessage | Command | Auth): WithTypeUrl<Message> {
168
168
  const payload = message as any;
169
- return { __type_url: TYPE_URL_MESSAGE, payload } as WithTypeUrl<Message>;
169
+ return { '@type': TYPE_URL_MESSAGE, payload } as WithTypeUrl<Message>;
170
170
  }
171
171
 
172
172
  /**
@@ -286,10 +286,10 @@ export const createPartyInvitationMessage = (
286
286
  inviteeKey = PublicKey.from(inviteeKey);
287
287
 
288
288
  return {
289
- __type_url: TYPE_URL_MESSAGE,
289
+ '@type': TYPE_URL_MESSAGE,
290
290
  payload:
291
291
  signer.sign({
292
- __type_url: TYPE_URL_PARTY_INVITATION,
292
+ '@type': TYPE_URL_PARTY_INVITATION,
293
293
  id: randomBytes(),
294
294
  partyKey,
295
295
  issuerKey: issuerKey.publicKey,
@@ -307,8 +307,8 @@ export const isPartyInvitationMessage = (message: Message | SignedMessage) => {
307
307
  const signed = unwrapMessage(message);
308
308
 
309
309
  // eslint-disable-next-line camelcase
310
- const payloadType = signed?.__type_url;
310
+ const payloadType = signed?.['@type'];
311
311
  // eslint-disable-next-line camelcase
312
- const signedType = signed?.signed?.payload?.__type_url;
312
+ const signedType = signed?.signed?.payload?.['@type'];
313
313
  return payloadType === TYPE_URL_SIGNED_MESSAGE && signedType === TYPE_URL_PARTY_INVITATION;
314
314
  };
package/src/proto/any.ts CHANGED
@@ -5,17 +5,17 @@
5
5
  import { TYPES } from './gen';
6
6
 
7
7
  // eslint-disable-next-line camelcase
8
- export type WithTypeUrl<T> = T & { __type_url: string }
8
+ export type WithTypeUrl<T> = T & { '@type': string }
9
9
 
10
10
  export interface DecodedAny {
11
11
  // eslint-disable-next-line camelcase
12
- __type_url: string,
12
+ '@type': string,
13
13
  [key: string]: any,
14
14
  }
15
15
 
16
16
  export type KnownAny = {
17
17
  [K in keyof TYPES]: {
18
18
  // eslint-disable-next-line camelcase
19
- __type_url: K,
19
+ '@type': K,
20
20
  } & TYPES[K]
21
21
  }[keyof TYPES]
@@ -10,8 +10,24 @@ import * as google_protobuf from "../../google/protobuf";
10
10
  * The payload for a SignedMessage sent during handshake for replication authentication.
11
11
  */
12
12
  export interface Auth {
13
+ /**
14
+ * The publicKey of the target Party for these credentials.
15
+ */
13
16
  partyKey?: ReturnType<typeof substitutions["dxos.halo.keys.PubKey"]["decode"]>;
17
+ /**
18
+ * The publicKey of the authenticating Device.
19
+ */
14
20
  deviceKey?: ReturnType<typeof substitutions["dxos.halo.keys.PubKey"]["decode"]>;
21
+ /**
22
+ * The publicKey of the authenticating Identity.
23
+ */
15
24
  identityKey?: ReturnType<typeof substitutions["dxos.halo.keys.PubKey"]["decode"]>;
25
+ /**
26
+ * The publicKey of the authenticating Identity.
27
+ */
16
28
  feedKey?: ReturnType<typeof substitutions["dxos.halo.keys.PubKey"]["decode"]>;
29
+ /**
30
+ * FeedAdmit message to the should be written to a control feed in case the `feedKey` is not admitted to the party.
31
+ */
32
+ feedAdmit?: ReturnType<typeof substitutions["google.protobuf.Any"]["decode"]>;
17
33
  }
@@ -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,\"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},\"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_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);