@tdxvolt/volt-client-grpc 0.11.8 → 0.14.60

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.
@@ -24,12 +24,18 @@ service VoltAPI {
24
24
 
25
25
  rpc CheckCompatibility(CheckCompatibilityRequest) returns (CheckCompatibilityResponse);
26
26
 
27
- // Creates a long-lived, bi-directional connection (session) to the Volt.
27
+ // Creates a long-lived, bi-directional connection to the Volt.
28
28
  // The connection stream serves several purposes, including remote invocations via a Relay, Volt event notifications, pings and service registration management.
29
- // A connection session is required in order for a client to be able to register services with the Volt.
29
+ // A connection stream is required in order for a client to be able to register services with the Volt.
30
30
  // When the stream is closed, any services registered on it will be set to offline.
31
31
  rpc Connect(stream ConnectRequest) returns (stream ConnectResponse);
32
32
 
33
+ // Copy a resource from one folder to another.
34
+ // The resource metadata, attributes and store are copied.
35
+ // The shares attributed to the resource are **not** currently copied.
36
+ // n.b. Copy resources between Volts is not supported by this API. This is achieved by creating an API instance for the source and target Volts, getting the resource from the source and creating it on the target.
37
+ rpc CopyResource(CopyResourceRequest) returns (CopyResourceResponse);
38
+
33
39
  // This is a work in progress - do not use.
34
40
  rpc CreateVerifiableCredentialSession(CreateVerifiableCredentialSessionRequest) returns (CreateVerifiableCredentialSessionResponse);
35
41
 
@@ -84,10 +90,14 @@ service VoltAPI {
84
90
  // Get descendants of a resource.
85
91
  rpc GetResourceDescendants(GetResourceDescendantsRequest) returns (GetResourceDescendantsResponse);
86
92
 
93
+ // Get session(s).
94
+ rpc GetSession(GetSessionRequest) returns (GetSessionResponse);
95
+
87
96
  // Invoke a method.
88
97
  // This is primarily for use by Relay connections when proxying invocations.
89
98
  rpc Invoke(stream InvokeRequest) returns (stream InvokeResponse);
90
99
 
100
+ // Move a resource from one folder to another.
91
101
  rpc MoveResource(MoveResourceRequest) returns (MoveResourceResponse);
92
102
 
93
103
  // Request access to a resource.
@@ -97,8 +107,7 @@ service VoltAPI {
97
107
  // Create or update an access rule.
98
108
  rpc SaveAccess(SaveAccessRequest) returns (SaveAccessResponse);
99
109
 
100
- // Create or update a cloud connection resource.
101
- rpc SaveCloudConnection(SaveCloudConnectionRequest) returns (SaveCloudConnectionResponse);
110
+ rpc SaveAuthentication(SaveAuthenticationRequest) returns (SaveAuthenticationResponse);
102
111
 
103
112
  // Create or update an identity.
104
113
  rpc SaveIdentity(SaveIdentityRequest) returns (SaveIdentityResponse);
@@ -110,6 +119,12 @@ service VoltAPI {
110
119
  // Create or update resource in this volt.
111
120
  rpc SaveResource(SaveResourceRequest) returns (SaveResourceResponse);
112
121
 
122
+ // Save a session.
123
+ rpc SaveSession(SaveSessionRequest) returns (SaveSessionResponse);
124
+
125
+ // Experimental - please ignore.
126
+ rpc Session(SessionRequest) returns (SessionResponse);
127
+
113
128
  // Set Volt access request decision.
114
129
  // This is a privileged call that requires Volt root access.
115
130
  rpc SetAccessRequestDecision(SetAccessRequestDecisionRequest) returns (SetAccessRequestDecisionResponse);
@@ -144,17 +159,17 @@ message BindRequest {
144
159
 
145
160
  // The host name to add as a SAN to the issued certificate.
146
161
  // This is optional, if you don't intend to host services with the certificate this can be omitted.
147
- string host = 5;
162
+ string host = 4;
148
163
 
149
164
  // DO NOT USE
150
165
  // Additional credentials to support the bind request.
151
166
  // If a certificate chain is presented (in the form of a concatenated list of PEM format x509 certificates) that includes a certificate with a public key matching the `public_key` field and that certificate is signed by another certificate for which the volt policy has a trust rule, this can be used to automatically permit/deny the request.
152
167
  // This is probably deprecated in favour of verifiable credentials.
153
- repeated string x509_credential = 6;
168
+ repeated string x509_credential = 5;
154
169
 
155
170
  // Optional verifiable credentials describing the client.
156
171
  // This is a work in progress.
157
- repeated VerifiablePresentation verifiable_presentation = 7;
172
+ repeated VerifiablePresentation verifiable_presentation = 6;
158
173
  }
159
174
 
160
175
  message BindResponse {
@@ -245,19 +260,28 @@ message ConnectHello {
245
260
  // Set to receive notification of resource events.
246
261
  bool subscribe_resource_events = 3;
247
262
 
248
- // Set this to support Relayled service invocation.
263
+ // Set this to support Relayed service invocation.
249
264
  // This indicates that the callee is happy to receive method invocations from other clients of the Relay.
250
265
  // Currently this will usually be set to the `id` of the calling Volt, but in theory any client could receive remote invocation requests in this way.
251
266
  string relay_id = 4;
252
267
 
253
- // A friendly name to present to other Relay clients.
268
+ // A friendly name to present to Relay clients.
254
269
  string relay_name = 5;
255
270
 
256
- // The certificate authority to present to other Relay clients.
271
+ // The certificate authority to present to Relay clients.
257
272
  string relay_ca_pem = 6;
258
273
 
259
274
  // Set to indicate the connection is discoverable to other Relay clients.
260
275
  bool relay_discoverable = 7;
276
+
277
+ // Set to receive notification of authentication requests.
278
+ bool subscribe_auth_requests = 8;
279
+
280
+ bool accept_invocation = 9;
281
+ }
282
+
283
+ message ConnectAcknowledge {
284
+ string connection_id = 1;
261
285
  }
262
286
 
263
287
  // A session ping message.
@@ -285,25 +309,25 @@ enum ConnectMessageRelay {
285
309
  message ConnectMessage {
286
310
  string id = 1;
287
311
  string thread_id = 2;
288
- string to_id = 4;
289
- string to_identity_id = 5;
290
- string to_name = 6;
291
- string message = 7;
292
- uint64 timestamp = 8;
293
- string from_id = 9;
294
- string from_identity_id = 10;
295
- string from_name = 11;
312
+ string to_id = 3;
313
+ string to_identity_id = 4;
314
+ string to_name = 5;
315
+ string message = 6;
316
+ uint64 timestamp = 7;
317
+ string from_id = 8;
318
+ string from_identity_id = 9;
319
+ string from_name = 10;
296
320
 
297
- repeated string receipt = 12;
298
- ConnectMessageType message_type = 15;
299
- ConnectMessageRelay message_relay = 16;
321
+ repeated string receipt = 11;
322
+ ConnectMessageType message_type = 12;
323
+ ConnectMessageRelay message_relay = 13;
300
324
  }
301
325
 
302
326
  message ConnectGoodbye {
303
327
  // Details of any error that occurred on the call.
304
328
  tdx.volt_api.volt.v1.Status status = 1;
305
329
 
306
- // Set if the session was ended gracefully, as opposed to errored.
330
+ // Set if the connection was ended gracefully, as opposed to errored.
307
331
  bool ended = 2;
308
332
  }
309
333
 
@@ -323,19 +347,28 @@ enum ConnectResourceEvent {
323
347
 
324
348
  message ConnectResource {
325
349
  // The type of resource event that has occurred.
326
- ConnectResourceEvent resource_event = 1;
350
+ ConnectResourceEvent event = 1;
327
351
 
328
352
  // Details of the resource.
329
353
  Resource resource = 2;
330
354
  }
331
355
 
356
+ message ConnectAuthRequest {
357
+ Session session = 1;
358
+
359
+ string context = 5;
360
+
361
+ string challenge = 6;
362
+
363
+ uint64 timestamp = 7;
364
+ }
365
+
332
366
  message ConnectEvent {
333
367
  oneof event {
334
- // A resource event notification, such as updated or deleted.
335
- ConnectResource connect_resource = 3;
368
+ ConnectAuthRequest connect_auth_request = 1;
336
369
 
337
- // Events relating to Relay connections.
338
- ConnectRelay relay = 6;
370
+ // A resource event notification, such as updated or deleted.
371
+ ConnectResource connect_resource = 2;
339
372
  }
340
373
  }
341
374
 
@@ -345,7 +378,7 @@ message ConnectRequest {
345
378
  // A ConnectHello message is the first message a client sends to the target upon successfully starting the call.
346
379
  ConnectHello hello = 1;
347
380
 
348
- // Indicates the client is closing the session.
381
+ // Indicates the client is closing the connection.
349
382
  ConnectGoodbye goodbye = 2;
350
383
 
351
384
  // Reserved for internal use.
@@ -366,32 +399,63 @@ message ConnectRequest {
366
399
 
367
400
  // One of the following payloads will be present in a given ConnectResponse message.
368
401
  message ConnectResponse {
402
+ // Details of any error that occurred on the call.
403
+ tdx.volt_api.volt.v1.Status status = 1;
404
+
369
405
  oneof payload {
370
406
  // Server response to initial handshake.
371
- ConnectHello hello = 1;
407
+ ConnectAcknowledge acknowledge = 2;
372
408
 
373
- // Indicates the server is ending the session.
374
- ConnectGoodbye goodbye = 2;
409
+ // Indicates the server is ending the connection.
410
+ ConnectGoodbye goodbye = 3;
375
411
 
376
412
  // Notifies clients of various events on the Volt.
377
- ConnectEvent evt = 3;
413
+ ConnectEvent evt = 4;
378
414
 
379
415
  // Reserved for internal use.
380
- ConnectMessage msg = 4;
416
+ ConnectMessage msg = 5;
381
417
 
382
418
  // Periodic ping response.
383
- ConnectPing ping = 5;
419
+ ConnectPing ping = 6;
384
420
 
385
421
  // Send an invocation request to a remote target.
386
422
  // n.b. The 'request' and 'response' semantics are inverted for remote invocations because the Relayed connection is established by a request **from** the 'target' Volt to the Relay. Hence any invocation on behalf of a client of the Relay involves sending a **response** back down the Relay connection to the 'target' Volt.
387
- InvokeRequest invoke_request = 6;
423
+ InvokeRequest invoke_request = 7;
388
424
 
389
425
  // Send an HTTP request to a remote target.
390
426
  // n.b. The 'request' and 'response' semantics are inverted for HTTP requests for the same reason as `invoke_request` above.
391
- HttpRequest http_request = 7;
427
+ HttpRequest http_request = 8;
392
428
  }
393
429
  }
394
430
 
431
+ enum CopyResourceMode {
432
+ COPY_RESOURCE_MODE_UNKNOWN = 0;
433
+ COPY_RESOURCE_MODE_COPY = 1;
434
+ COPY_RESOURCE_MODE_LINK = 2;
435
+ }
436
+
437
+ message CopyResourceRequest {
438
+ // The id of the resource to copy.
439
+ string resource_id = 1;
440
+
441
+ // The id of the resource to receive the new copy.
442
+ string to_resource_id = 2;
443
+
444
+ // The copy mode to use.
445
+ CopyResourceMode mode = 3;
446
+
447
+ // Indicates if all descendants of the resource should be copied too. Only relevant for COPY_RESOURCE_MODE_COPY mode.
448
+ bool recursive = 4;
449
+
450
+ // The parent resource to link from, only relevant for COPY_RESOURCE_MODE_LINK mode.
451
+ string from_resource_id = 5;
452
+ }
453
+
454
+ message CopyResourceResponse {
455
+ // Details of any error that occurred on the call.
456
+ tdx.volt_api.volt.v1.Status status = 1;
457
+ }
458
+
395
459
  message CreateVerifiableCredentialSessionRequest {
396
460
  string presentation = 1;
397
461
  }
@@ -434,13 +498,13 @@ message DiscoverServicesRequest {
434
498
  // List the service APIs that should be discovered.
435
499
  // The response will include services that match **any of** the terms given.
436
500
  // Use of '*' to indicate wildcards is supported.
437
- repeated string service_api = 2;
501
+ repeated string service_api = 1;
438
502
 
439
503
  // Set to indicate that offline services should be included in the response.
440
- bool include_offline = 3;
504
+ bool include_offline = 2;
441
505
 
442
506
  // Set to include the service protobuf in the response.
443
- bool include_protobuf = 4;
507
+ bool include_protobuf = 3;
444
508
  }
445
509
 
446
510
  message DiscoverServicesResponse {
@@ -571,7 +635,7 @@ message GetResourceRequest {
571
635
  string resource_id = 1;
572
636
 
573
637
  // Set to include service description protobuf in the response, if applicable.
574
- bool include_protobuf = 3;
638
+ bool include_protobuf = 2;
575
639
  }
576
640
 
577
641
  message GetResourceResponse {
@@ -603,22 +667,22 @@ message GetResourcesRequest {
603
667
  // Wildcards permitted.
604
668
  repeated string service_api = 6;
605
669
 
606
- repeated string owner = 8;
670
+ repeated string owner = 7;
607
671
 
608
- repeated string store = 9;
672
+ repeated string store = 8;
609
673
 
610
674
  // Indicates that the above terms should be combined using 'or' rather than 'and' (the default).
611
- bool combine_terms_exclusive = 10;
675
+ bool combine_terms_exclusive = 9;
612
676
 
613
677
  // Attributes to search by.
614
678
  // n.b. currently this API is mutually exclusive in that if any attribute queries are specified the rpc will only search on those attributes, ignoring any parameters defined above.
615
- repeated ResourceAttributeQuery attribute = 100;
679
+ repeated ResourceAttributeQuery attribute = 10;
616
680
 
617
681
  // If set, will return resources where *any of* the attribute queries apply, otherwise will only return resources where *all of* the attribute queries apply.
618
- bool any_of = 101;
682
+ bool any_of = 11;
619
683
 
620
684
  // Set to include service description protobuf in the response where applicable.
621
- bool include_protobuf = 102;
685
+ bool include_protobuf = 12;
622
686
  }
623
687
 
624
688
  message GetResourcesResponse {
@@ -686,16 +750,31 @@ message GetResourceDescendantsResponse {
686
750
  repeated Resource descendant = 2;
687
751
  }
688
752
 
753
+ message GetSessionRequest {
754
+ string id = 1;
755
+
756
+ string identity_id = 2;
757
+ }
758
+
759
+ message GetSessionResponse {
760
+ // Details of any error that occurred on the call.
761
+ tdx.volt_api.volt.v1.Status status = 1;
762
+
763
+ repeated Session session = 2;
764
+ }
765
+
689
766
  message InvokeRequest {
690
767
  // Client-assigned identifier for the request. Will be used to match responses and any subsequent requests.
691
768
  uint64 invoke_id = 1;
692
769
 
693
770
  // The client token to use for the invocation.
771
+ // This contains the key and iv used to encrypt the payload, which only the token audience can access because the key and iv are themselves encrypted using the public key of the invocation target.
694
772
  string token = 2;
695
773
 
696
774
  // Key fingerprint of the target Volt.
697
775
  // This is used by Relays to route the request.
698
- string identity_fingerprint = 3;
776
+ // We can't (currently) use the target Volt id here, since there is currently no way to universally 'reason about' a given identity (Volt). For example, Alice may have assigned Bob an identity of 123, whereas Carol assigned Bob an identity of 456.
777
+ repeated string target_fingerprint = 3;
699
778
 
700
779
  oneof request_payload {
701
780
  // A serialised and encrypted instance of `RemoteResponse` in pure binary format.
@@ -707,6 +786,10 @@ message InvokeRequest {
707
786
 
708
787
  // Indicates the client has ended the invocation.
709
788
  bool client_end = 6;
789
+
790
+ uint32 hop_index = 7;
791
+
792
+ string target_service_id = 8;
710
793
  }
711
794
 
712
795
  message InvokeResponse {
@@ -728,18 +811,15 @@ message InvokeResponse {
728
811
  bool server_end = 5;
729
812
  }
730
813
 
731
- enum MoveResourceMode {
732
- MOVE_RESOURCE_MODE_UNKNOWN = 0;
733
- MOVE_RESOURCE_MODE_MOVE = 1;
734
- MOVE_RESOURCE_MODE_LINK = 2;
735
- MOVE_RESOURCE_MODE_COPY = 3;
736
- }
737
-
738
814
  message MoveResourceRequest {
815
+ // The id of the resource to move.
739
816
  string resource_id = 1;
817
+
818
+ // The resource the parent folder to move the resource from.
740
819
  string from_resource_id = 2;
820
+
821
+ // The target folder to move the resource into.
741
822
  string to_resource_id = 3;
742
- MoveResourceMode move_mode = 4;
743
823
  }
744
824
 
745
825
  message MoveResourceResponse {
@@ -763,25 +843,25 @@ message RequestAccessResponse {
763
843
  string resource_id = 2;
764
844
 
765
845
  // The identity attempting access.
766
- string identity_id = 4;
846
+ string identity_id = 3;
767
847
 
768
848
  // The identity of the issuer of the access.
769
- string issuer_id = 5;
849
+ string issuer_id = 4;
770
850
 
771
851
  // Requested access.
772
- string access = 7;
852
+ string access = 5;
773
853
 
774
854
  // Assigned decision.
775
- PolicyDecision decision = 9;
855
+ PolicyDecision decision = 6;
776
856
 
777
857
  // Time at which the request was made.
778
- int64 request_time = 10;
858
+ int64 request_time = 7;
779
859
 
780
860
  // Time at which the decision was taken.
781
- int64 decision_time = 11;
861
+ int64 decision_time = 8;
782
862
 
783
863
  // Counter of number times this access was requested.
784
- int32 request_count = 12;
864
+ int32 request_count = 9;
785
865
  }
786
866
 
787
867
  message ResourceAttributeQuery {
@@ -800,23 +880,25 @@ message SaveAccessResponse {
800
880
  tdx.volt_api.volt.v1.Status status = 1;
801
881
  }
802
882
 
803
- message SaveCloudConnectionRequest {
804
- // Details of the cloud connection.
805
- ProxyConnection connection = 1;
883
+ message SaveAuthenticationRequest {
884
+ string id = 1;
806
885
 
807
- // Set to indicate that this is a new cloud connection.
808
- bool create = 2;
886
+ string identity_id = 2;
809
887
 
810
- // Reserved for system use.
811
- string create_in_parent_id = 3;
888
+ string identity_did = 3;
889
+
890
+ string public_key = 4;
891
+
892
+ string encrypt_key = 5;
893
+
894
+ string encrypt_iv = 6;
895
+
896
+ PolicyDecision decision = 7;
812
897
  }
813
898
 
814
- message SaveCloudConnectionResponse {
899
+ message SaveAuthenticationResponse {
815
900
  // Details of any error that occurred on the call.
816
901
  tdx.volt_api.volt.v1.Status status = 1;
817
-
818
- // The updated connection details.
819
- ProxyConnection connection = 2;
820
902
  }
821
903
 
822
904
  message SaveIdentityRequest {
@@ -890,6 +972,32 @@ message SaveResourceResponse {
890
972
  Resource resource = 2;
891
973
  }
892
974
 
975
+ message SaveSessionRequest {
976
+ Session session = 1;
977
+ }
978
+
979
+ message SaveSessionResponse {
980
+ // Details of any error that occurred on the call.
981
+ tdx.volt_api.volt.v1.Status status = 1;
982
+
983
+ Session session = 2;
984
+ }
985
+
986
+ message SessionRequest {
987
+ string session_id = 1;
988
+ oneof payload {
989
+ string fingerprint = 2;
990
+ string signature = 3;
991
+ }
992
+ }
993
+
994
+ message SessionResponse {
995
+ // Details of any error that occurred on the call.
996
+ tdx.volt_api.volt.v1.Status status = 1;
997
+ string proof = 2;
998
+ string session_id = 3;
999
+ }
1000
+
893
1001
  message SetServiceStatusRequest {
894
1002
  // The service description details.
895
1003
  Resource service = 2;
@@ -968,9 +1076,9 @@ message SignVerifyResponse {
968
1076
 
969
1077
  oneof payload {
970
1078
  // The signature in raw binary form.
971
- bytes digest = 3;
1079
+ bytes digest = 2;
972
1080
 
973
1081
  // The signature encoded using base64.
974
- string digest_encoded = 4;
1082
+ string digest_encoded = 3;
975
1083
  }
976
1084
  }
@@ -6,7 +6,7 @@ import "tdx/volt_api/volt/v1/status.proto";
6
6
 
7
7
  // The Wire API allows clients to subscribe and publish to Volt wire resources.
8
8
  service WireAPI {
9
- // Establishes a client-streaming call to the wire resource.
9
+ // Establishes a bi-directional streaming call to the wire resource.
10
10
  rpc PublishWire(stream PublishWireRequest) returns (stream PublishWireResponse);
11
11
 
12
12
  // Establishes a bi-directional streaming call to the wire resource.
@@ -42,10 +42,10 @@ function issueBind(bindRequest, ttl) {
42
42
  // This is the certificate assigned to us by the volt.
43
43
  this._credential.cache.cert = bindResponse.cert;
44
44
 
45
- // This is the signing CA used by the volt (don't ov)
45
+ // This is the signing CA used by the volt.
46
46
  this._credential.cache.ca = bindResponse.chain;
47
47
 
48
- // Resource id is assigned by the volt.
48
+ // Identity resource id is assigned by the volt.
49
49
  this._credential.cache.client_id = bindResponse.identity_id;
50
50
  this._credential.saveCache();
51
51
  break;
@@ -187,7 +187,7 @@ export async function bindInternal() {
187
187
  }
188
188
  }
189
189
 
190
- export function connectInternal() {
190
+ export function connectInternal(helloPayload) {
191
191
  try {
192
192
  if (this._voltConnection) {
193
193
  log("connectInternal - Volt connection already exists");
@@ -217,7 +217,7 @@ export function connectInternal() {
217
217
  if (!this._connected) {
218
218
  onDisconnected();
219
219
  }
220
- this.emit("connected", !!session);
220
+ this.emit("connected", session);
221
221
  });
222
222
 
223
223
  this._voltConnection.on("error", (err) => {
@@ -233,7 +233,7 @@ export function connectInternal() {
233
233
  this.emit("evt", evt);
234
234
  });
235
235
 
236
- return this._voltConnection.connect();
236
+ return this._voltConnection.connect(helloPayload);
237
237
  } catch (err) {
238
238
  log("connect - error [%s]", err.message);
239
239
  throw err;
@@ -189,10 +189,10 @@ export class VoltClient extends EventEmitter {
189
189
  }
190
190
  }
191
191
 
192
- initialiseAndConnect(configPath, extras = {}) {
192
+ initialiseAndConnect(configPath, helloPayload = undefined, extras = {}) {
193
193
  return this.initialise(configPath, extras)
194
194
  .then(() => {
195
- return connectInternal.call(this);
195
+ return connectInternal.call(this, helloPayload);
196
196
  })
197
197
  .catch((err) => {
198
198
  log("initialiseAndConnect failure: %s", err.message);
@@ -265,8 +265,8 @@ export class VoltClient extends EventEmitter {
265
265
  return this.isRemote && !this._voltConfig?.relay.cloud;
266
266
  }
267
267
 
268
- connect() {
269
- return connectInternal.call(this);
268
+ connect(helloPayload) {
269
+ return connectInternal.call(this, helloPayload);
270
270
  }
271
271
 
272
272
  disconnect() {