Skip to content

Commit

Permalink
chore(grpc): enhance domain grpc services (#1381)
Browse files Browse the repository at this point in the history
  • Loading branch information
itsyaasir authored Jun 21, 2024
1 parent e1e2542 commit 2af02da
Show file tree
Hide file tree
Showing 7 changed files with 253 additions and 148 deletions.
79 changes: 51 additions & 28 deletions bindings/grpc/proto/domain_linkage.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,52 @@
syntax = "proto3";
package domain_linkage;

message ValidateDidResponse {
string did = 1;
message Domains {
message ValidDomain {
string url = 1;
string credential = 2;
string service_id = 3;
}

repeated ValidDomain valid = 1;

message InvalidDomain {
string url = 1;
optional string credential = 2;
string service_id = 3;
string error = 4;
}

repeated InvalidDomain invalid = 2;
}
Domains domains = 2;
}

message ValidateDomainResponse {
string domain = 1;
message LinkedDids {
message ValidDid {
string did = 1;
string credential = 2;
string service_id = 3;
}

repeated ValidDid valid = 1;

message InvalidDid {
optional string did = 1;
optional string credential = 2;
optional string service_id = 3;
string error = 4;
}

repeated InvalidDid invalid = 2;
}
LinkedDids linked_dids = 2;
}

message ValidateDomainRequest {
// domain to validate
string domain = 1;
Expand All @@ -16,27 +62,6 @@ message ValidateDomainAgainstDidConfigurationRequest {
string did_configuration = 2;
}

message LinkedDidValidationStatus {
// validation succeeded or not, `error` property is added for `false` cases
bool valid = 1;
// credential from `linked_dids` as compact JWT domain linkage credential if it could be retrieved
optional string document = 2;
// an error message, that occurred when validated, omitted if valid
optional string error = 3;
}

message ValidateDomainResponse {
// list of JWT domain linkage credential, uses the same order as the `did-configuration.json` file for domain
repeated LinkedDidValidationStatus linked_dids = 1;
}

message LinkedDidEndpointValidationStatus {
// id of service endpoint entry
string id = 1;
// list of JWT domain linkage credential, uses the same order as the `did-configuration.json` file for domain
repeated LinkedDidValidationStatus service_endpoint = 2;
}

message ValidateDidRequest {
// DID to validate
string did = 1;
Expand All @@ -49,15 +74,13 @@ message ValidateDidAgainstDidConfigurationsRequest {
repeated ValidateDomainAgainstDidConfigurationRequest did_configurations = 2;
}

message ValidateDidResponse {
// mapping of service entries from DID with validation status for endpoint URLs
repeated LinkedDidEndpointValidationStatus service = 1;
}

service DomainLinkage {
rpc validate_domain(ValidateDomainRequest) returns (ValidateDomainResponse);
rpc validate_domain_against_did_configuration(ValidateDomainAgainstDidConfigurationRequest) returns (ValidateDomainResponse);
rpc validate_domain_against_did_configuration(
ValidateDomainAgainstDidConfigurationRequest)
returns (ValidateDomainResponse);

rpc validate_did(ValidateDidRequest) returns (ValidateDidResponse);
rpc validate_did_against_did_configurations(ValidateDidAgainstDidConfigurationsRequest) returns (ValidateDidResponse);
rpc validate_did_against_did_configurations(
ValidateDidAgainstDidConfigurationsRequest) returns (ValidateDidResponse);
}
8 changes: 8 additions & 0 deletions bindings/grpc/rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
comment_width = 120
format_code_in_doc_comments = true
max_width = 120
normalize_comments = false
normalize_doc_attributes = false
tab_spaces = 2
wrap_comments = true
imports_granularity = "Item"
Loading

0 comments on commit 2af02da

Please sign in to comment.