@tdxvolt/volt-client-grpc 0.15.1 → 0.16.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.15.1",
6
+ "version": "0.16.0-beta.10",
7
7
  "description": "tdx Volt library for nodejs clients",
8
8
  "type": "module",
9
9
  "exports": {
@@ -45,7 +45,7 @@
45
45
  "jsonwebtoken": "^8.5.1",
46
46
  "lodash": "^4.17.15",
47
47
  "minimist": "^1.2.0",
48
- "node-forge": "^0.9.0",
48
+ "node-forge": "^1.3.1",
49
49
  "uuid": "^8.1.0"
50
50
  }
51
- }
51
+ }
@@ -50,9 +50,9 @@ message SqlExecuteRequest {
50
50
  // This can be used to limit the number of rows returned by `SELECT` statements to avoid overloading a client. It is similar to using 'LIMIT/OFFSET' clauses on the 'SELECT' statement, but this method is easier to manage and the entire result set will be prepared on the Volt, and the client can then page through it by sending successive messages.
51
51
  uint32 page_size = 3;
52
52
 
53
- // The list of values to set for each parameter defined in a database query.
53
+ // The values to set for each parameter defined in a database query.
54
54
  // This field is only relevant to 'query' databases, i.e. those with kind `tdx:sqlite-query`.
55
- // The values in the list should be in the same order as the parameters defined by the query attributes.
55
+ // The values in the map should be keyed by parameter name.
56
56
  // A query may have no parameters defined, in which case leave this field empty.
57
57
  map<string, tdx.volt_api.volt.v1.AttributeValue> parameter = 4;
58
58
  }
@@ -37,6 +37,8 @@ message DownloadFileRequest {
37
37
  string file_path = 2;
38
38
  }
39
39
 
40
+ // The response stream will contain one or more of the following messages.
41
+ // Each response message will contain one of the following fields.
40
42
  message DownloadFileResponse {
41
43
  oneof payload {
42
44
  // A chunk of file data.
@@ -0,0 +1,40 @@
1
+ syntax = "proto3";
2
+
3
+ package tdx.volt_api.volt.v1;
4
+
5
+ message DIDRegistryUpdate {
6
+ // The id of the update.
7
+ // This is populated and maintained by the Volt.
8
+ uint64 id = 1;
9
+
10
+ // The id of the identity.
11
+ string did = 2;
12
+
13
+ // The type of update.
14
+ string operation = 3;
15
+
16
+ // The DID document contained in the update.
17
+ string document = 4;
18
+
19
+ // The signature extracted from the DID document.
20
+ string signature = 5;
21
+
22
+ // The signature of the update.
23
+ string update_signature = 6;
24
+
25
+ uint64 timestamp = 7;
26
+
27
+ // The vector clocks for this DID.
28
+ // The vector clocks are a map of the peer ID to the id of the last update received for this DID.
29
+ map<string, uint64> vector_clock = 8;
30
+
31
+ string origin_volt = 9;
32
+
33
+ string description = 10;
34
+ }
35
+
36
+ message VerifiablePresentation {
37
+ string credential = 1;
38
+ string signature = 2;
39
+ }
40
+
@@ -0,0 +1,126 @@
1
+ syntax = "proto3";
2
+
3
+ package tdx.volt_api.volt.v1;
4
+
5
+ import "tdx/volt_api/volt/v1/ssi.proto";
6
+ import "tdx/volt_api/volt/v1/status.proto";
7
+
8
+ service SsiAPI {
9
+ rpc DeleteDID(DeleteDIDRequest) returns (DeleteDIDResponse);
10
+ rpc GetDIDDocument(GetDIDDocumentRequest) returns (GetDIDDocumentResponse);
11
+ rpc GetDIDRegistryUpdates(GetDIDRegistryUpdatesRequest) returns (GetDIDRegistryUpdatesResponse);
12
+ rpc ParseCredential(ParseCredentialRequest) returns (ParseCredentialResponse);
13
+ rpc ResolveDID(ResolveDIDRequest) returns (ResolveDIDResponse);
14
+ rpc RegisterDIDDocument(RegisterDIDDocumentRequest) returns (RegisterDIDDocumentResponse);
15
+ }
16
+
17
+ message DeleteDIDRequest {
18
+ // The id of the identity to delete.
19
+ string did = 1;
20
+ }
21
+
22
+ message DeleteDIDResponse {
23
+ // Details of any error that occurred on the call.
24
+ tdx.volt_api.volt.v1.Status status = 1;
25
+ }
26
+
27
+ message GetDIDDocumentRequest {
28
+ // The id of the identity to retrieve.
29
+ string did = 1;
30
+
31
+ // If set, the search is restricted to the local registry only, otherwise all configured registries are searched.
32
+ bool local_only = 2;
33
+ }
34
+
35
+ message GetDIDDocumentResponse {
36
+ // Details of any error that occurred on the call.
37
+ tdx.volt_api.volt.v1.Status status = 1;
38
+
39
+ DIDRegistryUpdate did_document = 2;
40
+ }
41
+
42
+ message GetDIDRegistryUpdatesRequest {
43
+ // The id of the last update received.
44
+ // All updates since this id will be returned, limited to the maximum number of updates specified in the request.
45
+ // To fully synchronise, clients should continue calling this method until the response contains no updates.
46
+ // If this is the first call, then this should be set to 0.
47
+ uint64 since_id = 1;
48
+
49
+ // The maximum number of updates to return, defaults to 1000.
50
+ uint32 max_updates = 2;
51
+
52
+ string origin_volt = 3;
53
+ }
54
+
55
+ message GetDIDRegistryUpdatesResponse {
56
+ // Details of any error that occurred on the call.
57
+ tdx.volt_api.volt.v1.Status status = 1;
58
+
59
+ // The updates.
60
+ repeated DIDRegistryUpdate update = 2;
61
+ }
62
+
63
+ message ResolveDIDRequest {
64
+ // The DID to resolve.
65
+ string did = 1;
66
+
67
+ // Set to search all known registries rather than just the local registry.
68
+ bool include_registries = 2;
69
+ }
70
+
71
+ message ResolveDIDResponse {
72
+ tdx.volt_api.volt.v1.Status status = 1;
73
+
74
+ // The JSON representation of the DID document.
75
+ string did_document = 2;
76
+
77
+ // The signature used to save this version of the DID document.
78
+ string update_signature = 3;
79
+
80
+ // The DID of the Volt that saved this version of the DID document.
81
+ string origin_volt = 4;
82
+ }
83
+
84
+ message RegisterDIDDocumentRequest {
85
+ bool create = 1;
86
+
87
+ // The DID document to save.
88
+ DIDRegistryUpdate did_update = 2;
89
+
90
+ // When updating an existing DID document, it is necessary to include a signature of the document JSON, signed by the DID document's current owner.
91
+ // This is different from the proof contained in the DID document itself.
92
+ string update_signature = 3;
93
+ }
94
+
95
+ message RegisterDIDDocumentResponse {
96
+ // Details of any error that occurred on the call.
97
+ tdx.volt_api.volt.v1.Status status = 1;
98
+
99
+ DIDRegistryUpdate did_document = 2;
100
+ }
101
+
102
+
103
+ // Empty ATM - a VC is issued for the authenticated identity.
104
+ message TrustVerifiableCredentialRequest {
105
+ }
106
+
107
+ message TrustVerifiableCredentialResponse {
108
+ tdx.volt_api.volt.v1.Status status = 1;
109
+ string verifiable_credential_json = 2;
110
+ }
111
+
112
+ message ParseCredentialRequest {
113
+ oneof credential {
114
+ VerifiablePresentation verifiable_presentation = 1;
115
+ string url = 2;
116
+ }
117
+ string public_key = 3;
118
+ }
119
+
120
+ message ParseCredentialResponse {
121
+ tdx.volt_api.volt.v1.Status status = 1;
122
+ string id = 2;
123
+ string issuer_id = 3;
124
+ string subject_id = 4;
125
+ string claim_json = 5;
126
+ }
@@ -24,18 +24,6 @@ enum OnlineStatus {
24
24
  ONLINE_STATUS_OFFLINE = 2;
25
25
  }
26
26
 
27
- // @todo currently this must align with AuthorisationDecision enum in policy library, but some of the values are irrelevant outside of the public API so we need a public-facing enum and some translation.
28
- enum PolicyDecision {
29
- POLICY_DECISION_UNKNOWN = 0;
30
- POLICY_DECISION_PROMPT = 1;
31
- POLICY_DECISION_PERMIT = 2;
32
- POLICY_DECISION_DENY = 3;
33
- POLICY_DECISION_INDETERMINATE = 4;
34
- POLICY_DECISION_NOT_APPLICABLE = 5;
35
- POLICY_DECISION_APPLICABLE = 6;
36
- POLICY_DECISION_PENDING = 7;
37
- }
38
-
39
27
  // Not used ATM.
40
28
  enum ResourceStatus {
41
29
  RESOURCE_STATUS_UNKNOWN = 0;
@@ -51,6 +39,31 @@ enum ShareMode {
51
39
  SHARE_MODE_PUBLIC_READ = 2;
52
40
  }
53
41
 
42
+ // @todo currently this must align with AuthorisationDecision enum in policy library, but some of the values are irrelevant outside of the public API so we need a public-facing enum and some translation.
43
+ enum PolicyDecision {
44
+ POLICY_DECISION_UNKNOWN = 0;
45
+ POLICY_DECISION_PROMPT = 1;
46
+ POLICY_DECISION_PERMIT = 2;
47
+ POLICY_DECISION_DENY = 3;
48
+ POLICY_DECISION_INDETERMINATE = 4;
49
+ POLICY_DECISION_NOT_APPLICABLE = 5;
50
+ POLICY_DECISION_APPLICABLE = 6;
51
+ POLICY_DECISION_PENDING = 7;
52
+ }
53
+
54
+ // Attribute data types.
55
+ enum AttributeDataType {
56
+ ATTRIBUTE_DATA_TYPE_UNKNOWN = 0;
57
+ ATTRIBUTE_DATA_TYPE_STRING = 1;
58
+ ATTRIBUTE_DATA_TYPE_INTEGER = 2;
59
+ ATTRIBUTE_DATA_TYPE_REAL = 3;
60
+ ATTRIBUTE_DATA_TYPE_BOOLEAN = 4;
61
+ ATTRIBUTE_DATA_TYPE_BYTES = 5;
62
+
63
+ ATTRIBUTE_DATA_TYPE_IDENTITY = 100;
64
+ ATTRIBUTE_DATA_TYPE_RESOURCE = 101;
65
+ }
66
+
54
67
  // Represents an outbound connection from a Volt to a remote service that will act as a proxy for that Volt.
55
68
  // This enables Volts to bypass firewall and NATs.
56
69
  // Example - connection from a Volt to a Relay Volt running on the public internet, such as tdxvolt.com
@@ -81,6 +94,15 @@ message ProxyConnection {
81
94
 
82
95
  // Optional challenge that can be presented in the bind phase when initialising the connection.
83
96
  string challenge = 10;
97
+
98
+ // Indicates that this connection hosts a DID registry that we should synchronise with.
99
+ bool sync_did_registry = 11;
100
+
101
+ // The id of the last DID registry operation that was synchronised.
102
+ uint64 did_registry_sync_id = 12;
103
+
104
+ // The id of the target Volt that this connection is bound to.
105
+ string target_id = 13;
84
106
  }
85
107
 
86
108
  enum SecureMode {
@@ -192,6 +214,13 @@ message VoltParameters {
192
214
  // The certificate authority of the Relay if this is a remote connection via a Relay.
193
215
  string relay_ca_pem = 33;
194
216
 
217
+ // Optional override of the http address, rather than using the default of fixed_host:http_port.
218
+ // This is useful if the Volt is behind a firewall or NAT, and the http server is listening on a different port
219
+ // from 80 or 443 but this is hidden by the proxy. For example, if the `fixed_host` is `coreid.com` and http server is
220
+ // listening on 2115, but the proxy is forwarding 443 to 2115, then the http_address_override would be set to
221
+ // `https://coreid.com`.
222
+ string http_address_override = 34;
223
+
195
224
  // An optional alias that can be used to refer to the Volt rather than the `id` field.
196
225
  // This alias must be unique within the scope of the Battery in which the Volt is stored.
197
226
  string alias = 35;
@@ -201,6 +230,12 @@ message VoltParameters {
201
230
 
202
231
  // If set, indicates that any client that provides the correct challenge in the bind phase will automatically be approved to access the Volt.
203
232
  bool approve_on_challenge = 37;
233
+
234
+ // Maintain and expose a database of DIDs.
235
+ bool enable_did_registry = 38;
236
+
237
+ // Zero or more URLs of trusted peer DID registries.
238
+ repeated string did_registry = 40;
204
239
  }
205
240
 
206
241
  message VoltEndpoint {
@@ -261,8 +296,11 @@ message ProtoFile {
261
296
 
262
297
  enum ServiceHostType {
263
298
  SERVICE_HOST_TYPE_UNKNOWN = 0;
299
+ // A built-in service hosted by the Volt.
264
300
  SERVICE_HOST_TYPE_BUILTIN = 1;
301
+ // A service hosted by a grpc server other than the Volt.
265
302
  SERVICE_HOST_TYPE_SERVER = 2;
303
+ // A service hosted by a Volt client via a relay connection, i.e. the service is not exposed by a server as such, rather a Volt client implements the service and a Volt acts as a proxy, calling back to the client to implement the methods.
266
304
  SERVICE_HOST_TYPE_RELAYED = 3;
267
305
  }
268
306
 
@@ -270,16 +308,19 @@ enum ServiceHostType {
270
308
  message ServiceDescription {
271
309
  ServiceHostType host_type = 1;
272
310
 
273
- // The id of the server resource that is hosting this service.
274
- // For built-in services, i.e. those hosted by the Volt, this will set to the Volt id.
275
- string host_service_id = 2;
311
+ // The identity of the client that is exposing the service.
312
+ // For example, if a third party is exposing a database service via a Volt, it will first bind to the Volt and obtain a client DID and credentials in order to be able to create service resource(s).
313
+ // Any resources that are owned by this client will be marked as online if the client itself is online, i.e. has a live connection to the Volt.
314
+ // This will be empty if the service is a built-in Volt service.
315
+ string host_client_id = 2;
276
316
 
277
- // The identity of the client that is exposing the service via a relay connection.
278
- // This will be empty if the service is exposed via a grpc server.
279
- string host_client_id = 3;
317
+ // The id of the resource that holds the protobuf definition for this resource.
318
+ // For example, if a third party is exposing a database service via a Volt, it will create a service resource that holds details of the protobuf methods exposed by the service.
319
+ // For built-in services, i.e. those hosted by the Volt, this will set to the Volt id.
320
+ string host_service_id = 3;
280
321
 
281
322
  // The address of the grpc server hosting this service.
282
- // This will be empty if the service is hosted by a relay client (see `relay_public_key` below).
323
+ // Only relevant to grpc-hosted services.
283
324
  string host_address = 4;
284
325
 
285
326
  // The certificate authority (chain) that signed the service server certificate.
@@ -290,9 +331,6 @@ message ServiceDescription {
290
331
  // This may change as the service comes and goes online.
291
332
  string host_public_key = 6;
292
333
 
293
- // The fingerprint derived from `host_public_key`, included for convenience.
294
- string host_fingerprint = 7;
295
-
296
334
  // The connection id currently used to host this service.
297
335
  string host_connection_id = 8;
298
336
 
@@ -312,24 +350,11 @@ message ServiceDescription {
312
350
  repeated MethodDescription method = 100;
313
351
  }
314
352
 
315
- // Resource attribute data types.
316
- enum AttributeDataType {
317
- ATTRIBUTE_DATA_TYPE_UNKNOWN = 0;
318
- ATTRIBUTE_DATA_TYPE_STRING = 1;
319
- ATTRIBUTE_DATA_TYPE_INTEGER = 2;
320
- ATTRIBUTE_DATA_TYPE_REAL = 3;
321
- ATTRIBUTE_DATA_TYPE_BOOLEAN = 4;
322
- ATTRIBUTE_DATA_TYPE_BYTES = 5;
323
-
324
- ATTRIBUTE_DATA_TYPE_IDENTITY = 100;
325
- ATTRIBUTE_DATA_TYPE_RESOURCE = 101;
326
- }
327
-
328
- // Resource attribute value will be one of the following fields, depending on the data type.
353
+ // Attribute value will be one of the following fields, depending on the data type.
329
354
  message AttributeValue {
330
355
  oneof value {
331
356
  string string = 1;
332
- int32 integer = 2;
357
+ int64 integer = 2;
333
358
  double real = 3;
334
359
  bool boolean = 4;
335
360
  bytes bytes = 5;
@@ -429,32 +454,38 @@ enum IdentityType {
429
454
  }
430
455
 
431
456
  message IdentityAlias {
457
+ // The alias id.
458
+ uint32 id = 1;
459
+
432
460
  // The corresponding identity id.
433
- string identity_id = 1;
461
+ string identity_id = 2;
434
462
 
435
463
  // The actual alias, e.g. a common name or key fingerprint.
436
- string alias = 2;
437
-
438
- // This will only be populated if alias_type == tdx:public-key
439
- string public_key = 3;
464
+ string alias = 3;
440
465
 
441
466
  // This will only be populated if alias_type == tdx:public-key
442
- string private_key = 4;
467
+ string public_key = 4;
443
468
 
444
- string alias_type = 5;
469
+ // This will only be populated if alias_type == tdx:public-key, and the key is stored in the Volt.
470
+ string private_key = 5;
445
471
 
446
- string issuer_id = 6;
472
+ // The alias type, for example public key, email, phone number etc.
473
+ string alias_type = 6;
447
474
 
448
- // Indicates if this alias has an 'authenticate' policy decision assigned.
449
- PolicyDecision authenticate = 7;
475
+ // The identity that issued this alias.
476
+ string issuer_id = 7;
450
477
 
451
478
  // Indicates if this alias has an 'bind' policy decision assigned.
452
479
  PolicyDecision bind = 8;
480
+
481
+ // Optional description of this alias.
482
+ string description = 9;
453
483
  }
454
484
 
455
485
  // A Volt identity encompasses a Resource and a set of identity aliases.
456
486
  message Identity {
457
487
  Resource resource = 1;
488
+
458
489
  repeated IdentityAlias alias = 2;
459
490
  }
460
491
 
@@ -514,6 +545,10 @@ message Binding {
514
545
 
515
546
  // Set if the bind request presented a valid challenge code.
516
547
  bool volt_challenge = 15;
548
+
549
+ string did_document = 16;
550
+
551
+ string did_document_signature = 17;
517
552
  }
518
553
 
519
554
  message Access {
@@ -571,27 +606,49 @@ enum SessionStatus {
571
606
  SESSION_STATUS_REJECTED = 3;
572
607
  }
573
608
 
609
+ message SessionCredential {
610
+ // The alias id.
611
+ uint32 id = 1;
612
+
613
+ // The corresponding session id.
614
+ string session_id = 2;
615
+
616
+ // The actual credential, e.g. a key fingerprint or VC.
617
+ string credential = 3;
618
+
619
+ // The credential type, for example public key, email, phone number etc.
620
+ string credential_type = 4;
621
+
622
+ // The identity that issued this alias.
623
+ string issuer_id = 5;
624
+
625
+ // Optional description of this alias.
626
+ string description = 6;
627
+
628
+ // Type-specific extra data stored with the credential.
629
+ string extra = 7;
630
+
631
+ // More type-specific data stored with the credential.
632
+ string extra_2 = 8;
633
+ }
634
+
574
635
  message Session {
575
636
  string id = 1;
576
637
 
577
- string identity_id = 2;
638
+ // string public_key = 2;
578
639
 
579
- string identity_name = 3;
640
+ string identity_id = 3;
580
641
 
581
- string ip = 4;
642
+ string identity_name = 4;
582
643
 
583
- uint64 created = 5;
644
+ string ip = 5;
584
645
 
585
- uint64 modified = 6;
646
+ repeated SessionCredential credential = 6;
586
647
 
587
- SessionStatus status = 7;
588
- }
648
+ uint64 created = 7;
589
649
 
590
- message VerifiableCredential {
591
- string encoded = 1;
592
- }
650
+ uint64 modified = 8;
593
651
 
594
- message VerifiablePresentation {
595
- VerifiableCredential credential = 1;
596
- string signature = 2;
652
+ SessionStatus status = 9;
597
653
  }
654
+