diff --git a/Cargo.lock b/Cargo.lock index 2f6772686b..509641e36e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1328,6 +1328,13 @@ dependencies = [ "zeroize", ] +[[package]] +name = "cheqd_proto_gen" +version = "0.1.0" +dependencies = [ + "tonic-build", +] + [[package]] name = "chrono" version = "0.4.38" @@ -1917,7 +1924,6 @@ dependencies = [ "thiserror", "tokio", "tonic", - "tonic-build", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index b996c1766d..b53c85c997 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,6 +31,7 @@ members = [ "misc/simple_message_relay", "misc/display_as_json", "did_core/did_methods/did_cheqd", + "did_core/did_methods/did_cheqd/cheqd_proto_gen", ] [workspace.package] diff --git a/did_core/did_methods/did_cheqd/Cargo.toml b/did_core/did_methods/did_cheqd/Cargo.toml index 819af9d16a..8c8569735c 100644 --- a/did_core/did_methods/did_cheqd/Cargo.toml +++ b/did_core/did_methods/did_cheqd/Cargo.toml @@ -6,6 +6,10 @@ license.workspace = true version = "0.1.0" edition = "2021" +[lib] +name = "did_cheqd" +path = "src/lib.rs" + [dependencies] did_resolver = { path = "../../did_resolver" } tonic = { version = "0.12.3", default-features = false, features = [ @@ -27,6 +31,3 @@ tokio = { version = "1.38.0", default-features = false, features = [ "macros", "rt", ] } - -[build-dependencies] -tonic-build = "0.12.3" diff --git a/did_core/did_methods/did_cheqd/README.md b/did_core/did_methods/did_cheqd/README.md new file mode 100644 index 0000000000..d68f4eff01 --- /dev/null +++ b/did_core/did_methods/did_cheqd/README.md @@ -0,0 +1,3 @@ +# DID Cheqd Resolver + +TODO - explain dev maintainence of generated protos \ No newline at end of file diff --git a/did_core/did_methods/did_cheqd/build.rs b/did_core/did_methods/did_cheqd/build.rs deleted file mode 100644 index 73dfbc9cf5..0000000000 --- a/did_core/did_methods/did_cheqd/build.rs +++ /dev/null @@ -1,12 +0,0 @@ -fn main() -> Result<(), Box> { - tonic_build::configure() - .build_server(false) - .compile_protos( - &[ - "proto/cheqd/did/v2/query.proto", - "proto/cheqd/resource/v2/query.proto", - ], - &["proto"], - )?; - Ok(()) -} diff --git a/did_core/did_methods/did_cheqd/cheqd_proto_gen/Cargo.toml b/did_core/did_methods/did_cheqd/cheqd_proto_gen/Cargo.toml new file mode 100644 index 0000000000..4efd515880 --- /dev/null +++ b/did_core/did_methods/did_cheqd/cheqd_proto_gen/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "cheqd_proto_gen" +version = "0.1.0" +edition = "2021" + +[[bin]] +name = "cheqd-proto-gen" +path = "src/main.rs" + +[dependencies] +tonic-build = "0.12.3" diff --git a/did_core/did_methods/did_cheqd/proto/cheqd/did/v2/diddoc.proto b/did_core/did_methods/did_cheqd/cheqd_proto_gen/proto/cheqd/did/v2/diddoc.proto similarity index 100% rename from did_core/did_methods/did_cheqd/proto/cheqd/did/v2/diddoc.proto rename to did_core/did_methods/did_cheqd/cheqd_proto_gen/proto/cheqd/did/v2/diddoc.proto diff --git a/did_core/did_methods/did_cheqd/proto/cheqd/did/v2/query.proto b/did_core/did_methods/did_cheqd/cheqd_proto_gen/proto/cheqd/did/v2/query.proto similarity index 100% rename from did_core/did_methods/did_cheqd/proto/cheqd/did/v2/query.proto rename to did_core/did_methods/did_cheqd/cheqd_proto_gen/proto/cheqd/did/v2/query.proto diff --git a/did_core/did_methods/did_cheqd/proto/cheqd/resource/v2/query.proto b/did_core/did_methods/did_cheqd/cheqd_proto_gen/proto/cheqd/resource/v2/query.proto similarity index 100% rename from did_core/did_methods/did_cheqd/proto/cheqd/resource/v2/query.proto rename to did_core/did_methods/did_cheqd/cheqd_proto_gen/proto/cheqd/resource/v2/query.proto diff --git a/did_core/did_methods/did_cheqd/proto/cheqd/resource/v2/resource.proto b/did_core/did_methods/did_cheqd/cheqd_proto_gen/proto/cheqd/resource/v2/resource.proto similarity index 100% rename from did_core/did_methods/did_cheqd/proto/cheqd/resource/v2/resource.proto rename to did_core/did_methods/did_cheqd/cheqd_proto_gen/proto/cheqd/resource/v2/resource.proto diff --git a/did_core/did_methods/did_cheqd/proto/cosmos/base/query/v1beta1/pagination.proto b/did_core/did_methods/did_cheqd/cheqd_proto_gen/proto/cosmos/base/query/v1beta1/pagination.proto similarity index 100% rename from did_core/did_methods/did_cheqd/proto/cosmos/base/query/v1beta1/pagination.proto rename to did_core/did_methods/did_cheqd/cheqd_proto_gen/proto/cosmos/base/query/v1beta1/pagination.proto diff --git a/did_core/did_methods/did_cheqd/proto/gogoproto/gogo.proto b/did_core/did_methods/did_cheqd/cheqd_proto_gen/proto/gogoproto/gogo.proto similarity index 100% rename from did_core/did_methods/did_cheqd/proto/gogoproto/gogo.proto rename to did_core/did_methods/did_cheqd/cheqd_proto_gen/proto/gogoproto/gogo.proto diff --git a/did_core/did_methods/did_cheqd/proto/google/api/annotations.proto b/did_core/did_methods/did_cheqd/cheqd_proto_gen/proto/google/api/annotations.proto similarity index 100% rename from did_core/did_methods/did_cheqd/proto/google/api/annotations.proto rename to did_core/did_methods/did_cheqd/cheqd_proto_gen/proto/google/api/annotations.proto diff --git a/did_core/did_methods/did_cheqd/proto/google/api/http.proto b/did_core/did_methods/did_cheqd/cheqd_proto_gen/proto/google/api/http.proto similarity index 100% rename from did_core/did_methods/did_cheqd/proto/google/api/http.proto rename to did_core/did_methods/did_cheqd/cheqd_proto_gen/proto/google/api/http.proto diff --git a/did_core/did_methods/did_cheqd/proto/google/protobuf/descriptor.proto b/did_core/did_methods/did_cheqd/cheqd_proto_gen/proto/google/protobuf/descriptor.proto similarity index 100% rename from did_core/did_methods/did_cheqd/proto/google/protobuf/descriptor.proto rename to did_core/did_methods/did_cheqd/cheqd_proto_gen/proto/google/protobuf/descriptor.proto diff --git a/did_core/did_methods/did_cheqd/proto/google/protobuf/timestamp.proto b/did_core/did_methods/did_cheqd/cheqd_proto_gen/proto/google/protobuf/timestamp.proto similarity index 100% rename from did_core/did_methods/did_cheqd/proto/google/protobuf/timestamp.proto rename to did_core/did_methods/did_cheqd/cheqd_proto_gen/proto/google/protobuf/timestamp.proto diff --git a/did_core/did_methods/did_cheqd/cheqd_proto_gen/src/main.rs b/did_core/did_methods/did_cheqd/cheqd_proto_gen/src/main.rs new file mode 100644 index 0000000000..0c2126a9c7 --- /dev/null +++ b/did_core/did_methods/did_cheqd/cheqd_proto_gen/src/main.rs @@ -0,0 +1,16 @@ +//! Binary for re-generating the cheqd proto types +fn main() -> Result<(), Box> { + let crate_dir = env!("CARGO_MANIFEST_DIR").to_string(); + + tonic_build::configure() + .build_server(false) + .out_dir(crate_dir.clone() + "/../src/proto") + .compile_protos( + &[ + crate_dir.clone() + "/proto/cheqd/did/v2/query.proto", + crate_dir.clone() + "/proto/cheqd/resource/v2/query.proto", + ], + &[crate_dir + "/proto"], + )?; + Ok(()) +} diff --git a/did_core/did_methods/did_cheqd/proto/greeter.proto b/did_core/did_methods/did_cheqd/proto/greeter.proto deleted file mode 100644 index 7adcec0643..0000000000 --- a/did_core/did_methods/did_cheqd/proto/greeter.proto +++ /dev/null @@ -1,15 +0,0 @@ -syntax = "proto3"; - -package greeter; - -service Greeter { - rpc SayHello (HelloRequest) returns (HelloResponse); -} - -message HelloRequest { - string name = 1; -} - -message HelloResponse { - string message = 1; -} diff --git a/did_core/did_methods/did_cheqd/src/proto/cheqd.did.v2.rs b/did_core/did_methods/did_cheqd/src/proto/cheqd.did.v2.rs new file mode 100644 index 0000000000..58e4eefc60 --- /dev/null +++ b/did_core/did_methods/did_cheqd/src/proto/cheqd.did.v2.rs @@ -0,0 +1,387 @@ +// This file is @generated by prost-build. +/// DidDoc defines a DID Document, as defined in the DID Core specification. +/// Documentation: +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DidDoc { + /// context is a list of URIs used to identify the context of the DID document. + /// Default: + #[prost(string, repeated, tag = "1")] + pub context: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + /// id is the DID of the DID document. + /// Format: did:cheqd:: + #[prost(string, tag = "2")] + pub id: ::prost::alloc::string::String, + /// controller is a list of DIDs that are allowed to control the DID document. + #[prost(string, repeated, tag = "3")] + pub controller: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + /// verificationMethod is a list of verification methods that can be used to + /// verify a digital signature or cryptographic proof. + #[prost(message, repeated, tag = "4")] + pub verification_method: ::prost::alloc::vec::Vec, + /// authentication is a list of verification methods that can be used to + /// authenticate as the DID subject. + #[prost(string, repeated, tag = "5")] + pub authentication: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + /// assertionMethod is a list of verification methods that can be used to + /// assert statements as the DID subject. + #[prost(string, repeated, tag = "6")] + pub assertion_method: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + /// capabilityInvocation is a list of verification methods that can be used to + /// invoke capabilities as the DID subject. + #[prost(string, repeated, tag = "7")] + pub capability_invocation: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + /// capabilityDelegation is a list of verification methods that can be used to + /// delegate capabilities as the DID subject. + #[prost(string, repeated, tag = "8")] + pub capability_delegation: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + /// keyAgreement is a list of verification methods that can be used to perform + /// key agreement as the DID subject. + #[prost(string, repeated, tag = "9")] + pub key_agreement: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + /// service is a list of services that can be used to interact with the DID subject. + #[prost(message, repeated, tag = "10")] + pub service: ::prost::alloc::vec::Vec, + /// alsoKnownAs is a list of DIDs that are known to refer to the same DID subject. + #[prost(string, repeated, tag = "11")] + pub also_known_as: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +/// VerificationMethod defines a verification method, as defined in the DID Core specification. +/// Documentation: +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct VerificationMethod { + /// id is the unique identifier of the verification method. + /// Format: did:cheqd::# + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// type is the type of the verification method. + /// Example: Ed25519VerificationKey2020 + #[prost(string, tag = "2")] + pub verification_method_type: ::prost::alloc::string::String, + /// controller is the DID of the controller of the verification method. + /// Format: did:cheqd:: + #[prost(string, tag = "3")] + pub controller: ::prost::alloc::string::String, + /// verification_material is the public key of the verification method. + /// Commonly used verification material types: publicJwk, publicKeyBase58, publicKeyMultibase + #[prost(string, tag = "4")] + pub verification_material: ::prost::alloc::string::String, +} +/// Service defines a service, as defined in the DID Core specification. +/// Documentation: +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Service { + /// id is the unique identifier of the service. + /// Format: did:cheqd::# + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// type is the type of the service. + /// Example: LinkedResource + #[prost(string, tag = "2")] + pub service_type: ::prost::alloc::string::String, + /// serviceEndpoint is the endpoint of the service. + /// Example: + #[prost(string, repeated, tag = "3")] + pub service_endpoint: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +/// DidDocWithMetadata defines a DID Document with metadata, as defined in the DID Core specification. +/// Contains the DID Document, as well as DID Document metadata. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DidDocWithMetadata { + /// didDocument is the DID Document. + #[prost(message, optional, tag = "1")] + pub did_doc: ::core::option::Option, + /// didDocumentMetadata is the DID Document metadata. + #[prost(message, optional, tag = "2")] + pub metadata: ::core::option::Option, +} +/// Metadata defines DID Document metadata, as defined in the DID Core specification. +/// Documentation: +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Metadata { + /// created is the timestamp of the creation of the DID Document. + /// Format: RFC3339 + /// Example: 2021-03-10T15:16:17Z + #[prost(message, optional, tag = "1")] + pub created: ::core::option::Option<::prost_types::Timestamp>, + /// updated is the timestamp of the last update of the DID Document. + /// Format: RFC3339 + /// Example: 2021-03-10T15:16:17Z + #[prost(message, optional, tag = "2")] + pub updated: ::core::option::Option<::prost_types::Timestamp>, + /// deactivated is a flag that indicates whether the DID Document is deactivated. + /// Default: false + #[prost(bool, tag = "3")] + pub deactivated: bool, + /// version_id is the version identifier of the DID Document. + /// Format: UUID + /// Example: 123e4567-e89b-12d3-a456-426655440000 + #[prost(string, tag = "4")] + pub version_id: ::prost::alloc::string::String, + /// next_version_id is the version identifier of the next version of the DID Document. + /// Format: UUID + /// Example: 123e4567-e89b-12d3-a456-426655440000 + #[prost(string, tag = "5")] + pub next_version_id: ::prost::alloc::string::String, + /// previous_version_id is the version identifier of the previous version of the DID Document. + /// Format: UUID + /// Example: 123e4567-e89b-12d3-a456-426655440000 + #[prost(string, tag = "6")] + pub previous_version_id: ::prost::alloc::string::String, +} +/// QueryDidDocRequest is the request type for the Query/DidDoc method +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryDidDocRequest { + /// DID unique identifier of the DID Document to fetch. + /// UUID-style DIDs as well as Indy-style DID are supported. + /// + /// Format: did:cheqd:: + /// + /// Examples: + /// - did:cheqd:mainnet:c82f2b02-bdab-4dd7-b833-3e143745d612 + /// - did:cheqd:testnet:wGHEXrZvJxR8vw5P3UWH1j + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, +} +/// QueryDidDocResponse is the response type for the Query/DidDoc method +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryDidDocResponse { + /// Successful resolution of the DID Document returns the following: + /// - did_doc is the latest version of the DID Document + /// - metadata is is the DID Document metadata associated with the latest version of the DID Document + #[prost(message, optional, tag = "1")] + pub value: ::core::option::Option, +} +/// QueryDidDocVersionRequest is the request type for the Query/DidDocVersion method +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryDidDocVersionRequest { + /// DID unique identifier of the DID Document to fetch. + /// UUID-style DIDs as well as Indy-style DID are supported. + /// + /// Format: did:cheqd:: + /// + /// Examples: + /// - did:cheqd:mainnet:c82f2b02-bdab-4dd7-b833-3e143745d612 + /// - did:cheqd:testnet:wGHEXrZvJxR8vw5P3UWH1j + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// Unique version identifier of the DID Document to fetch. + /// Returns the specified version of the DID Document. + /// + /// Format: + /// + /// Example: 93f2573c-eca9-4098-96cb-a1ec676a29ed + #[prost(string, tag = "2")] + pub version: ::prost::alloc::string::String, +} +/// QueryDidDocVersionResponse is the response type for the Query/DidDocVersion method +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryDidDocVersionResponse { + /// Successful resolution of the DID Document returns the following: + /// - did_doc is the requested version of the DID Document + /// - metadata is DID Document metadata associated with the requested version of the DID Document + #[prost(message, optional, tag = "1")] + pub value: ::core::option::Option, +} +/// QueryAllDidDocVersionsMetadataRequest is the request type for the Query/AllDidDocVersionsMetadata method +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllDidDocVersionsMetadataRequest { + /// DID unique identifier of the DID Document to fetch version metadata. + /// UUID-style DIDs as well as Indy-style DID are supported. + /// + /// Format: did:cheqd:: + /// + /// Examples: + /// - did:cheqd:mainnet:c82f2b02-bdab-4dd7-b833-3e143745d612 + /// - did:cheqd:testnet:wGHEXrZvJxR8vw5P3UWH1j + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// pagination defines an optional pagination for the request. + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::super::cosmos::base::query::v1beta1::PageRequest, + >, +} +/// QueryAllDidDocVersionsMetadataResponse is the response type for the Query/AllDidDocVersionsMetadata method +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllDidDocVersionsMetadataResponse { + /// versions is the list of all versions of the requested DID Document + #[prost(message, repeated, tag = "1")] + pub versions: ::prost::alloc::vec::Vec, + /// pagination defines the pagination in the response. + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::super::cosmos::base::query::v1beta1::PageResponse, + >, +} +/// Generated client implementations. +pub mod query_client { + #![allow( + unused_variables, + dead_code, + missing_docs, + clippy::wildcard_imports, + clippy::let_unit_value, + )] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Query defines the gRPC querier service for the DID module + #[derive(Debug, Clone)] + pub struct QueryClient { + inner: tonic::client::Grpc, + } + impl QueryClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl QueryClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + std::marker::Send + 'static, + ::Error: Into + std::marker::Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> QueryClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + std::marker::Send + std::marker::Sync, + { + QueryClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Fetch latest version of a DID Document for a given DID + pub async fn did_doc( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/cheqd.did.v2.Query/DidDoc", + ); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("cheqd.did.v2.Query", "DidDoc")); + self.inner.unary(req, path, codec).await + } + /// Fetch specific version of a DID Document for a given DID + pub async fn did_doc_version( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/cheqd.did.v2.Query/DidDocVersion", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cheqd.did.v2.Query", "DidDocVersion")); + self.inner.unary(req, path, codec).await + } + /// Fetch list of all versions of DID Documents for a given DID + pub async fn all_did_doc_versions_metadata( + &mut self, + request: impl tonic::IntoRequest< + super::QueryAllDidDocVersionsMetadataRequest, + >, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/cheqd.did.v2.Query/AllDidDocVersionsMetadata", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("cheqd.did.v2.Query", "AllDidDocVersionsMetadata"), + ); + self.inner.unary(req, path, codec).await + } + } +} diff --git a/did_core/did_methods/did_cheqd/src/proto/cheqd.resource.v2.rs b/did_core/did_methods/did_cheqd/src/proto/cheqd.resource.v2.rs new file mode 100644 index 0000000000..52c1b7d2e2 --- /dev/null +++ b/did_core/did_methods/did_cheqd/src/proto/cheqd.resource.v2.rs @@ -0,0 +1,344 @@ +// This file is @generated by prost-build. +/// Resource stores the contents of a DID-Linked Resource +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Resource { + /// bytes is the raw data of the Resource + #[prost(bytes = "vec", tag = "1")] + pub data: ::prost::alloc::vec::Vec, +} +/// Metadata stores the metadata of a DID-Linked Resource +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Metadata { + /// collection_id is the ID of the collection that the Resource belongs to. Defined client-side. + /// This field is the unique identifier of the DID linked to this Resource + /// Format: + /// + /// Examples: + /// - c82f2b02-bdab-4dd7-b833-3e143745d612 + /// - wGHEXrZvJxR8vw5P3UWH1j + #[prost(string, tag = "1")] + pub collection_id: ::prost::alloc::string::String, + /// id is the ID of the Resource. Defined client-side. + /// This field is a unique identifier for this specific version of the Resource. + /// Format: + #[prost(string, tag = "2")] + pub id: ::prost::alloc::string::String, + /// name is a human-readable name for the Resource. Defined client-side. + /// Does not change between different versions. + /// Example: PassportSchema, EducationTrustRegistry + #[prost(string, tag = "3")] + pub name: ::prost::alloc::string::String, + /// version is a human-readable semantic version for the Resource. Defined client-side. + /// Stored as a string. OPTIONAL. + /// Example: 1.0.0, v2.1.0 + #[prost(string, tag = "4")] + pub version: ::prost::alloc::string::String, + /// resource_type is a Resource type that identifies what the Resource is. Defined client-side. + /// This is NOT the same as the resource's media type. + /// Example: AnonCredsSchema, StatusList2021 + #[prost(string, tag = "5")] + pub resource_type: ::prost::alloc::string::String, + /// List of alternative URIs for the SAME Resource. + #[prost(message, repeated, tag = "6")] + pub also_known_as: ::prost::alloc::vec::Vec, + /// media_type is IANA media type of the Resource. Defined ledger-side. + /// Example: application/json, image/png + #[prost(string, tag = "7")] + pub media_type: ::prost::alloc::string::String, + /// created is the time at which the Resource was created. Defined ledger-side. + /// Format: RFC3339 + /// Example: 2021-01-01T00:00:00Z + #[prost(message, optional, tag = "8")] + pub created: ::core::option::Option<::prost_types::Timestamp>, + /// checksum is a SHA-256 checksum hash of the Resource. Defined ledger-side. + /// Example: d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f + #[prost(string, tag = "9")] + pub checksum: ::prost::alloc::string::String, + /// previous_version_id is the ID of the previous version of the Resource. Defined ledger-side. + /// This is based on the Resource's name and Resource type to determine whether it's the same Resource. + /// Format: + #[prost(string, tag = "10")] + pub previous_version_id: ::prost::alloc::string::String, + /// next_version_id is the ID of the next version of the Resource. Defined ledger-side. + /// This is based on the Resource's name and Resource type to determine whether it's the same Resource. + /// Format: + #[prost(string, tag = "11")] + pub next_version_id: ::prost::alloc::string::String, +} +/// AlternativeUri are alternative URIs that can be used to access the Resource. +/// By default, at least the DID URI equivalent of the Resource is populated. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AlternativeUri { + /// uri is the URI of the Resource. + /// Examples: + /// - did:cheqd:testnet:MjYxNzYKMjYxNzYK/resources/4600ea35-8916-4ac4-b412-55b8f49dd94e + /// - + /// - + /// - + /// - ipfs://bafybeihetj2ng3d74k7t754atv2s5dk76pcqtvxls6dntef3xa6rax25xe + #[prost(string, tag = "1")] + pub uri: ::prost::alloc::string::String, + /// description is a human-readable description of the URI. Defined client-side. + /// Examples: + /// - did-uri + /// - http-uri + /// - ipfs-uri + #[prost(string, tag = "2")] + pub description: ::prost::alloc::string::String, +} +/// ResourceWithMetadata describes the overall structure of a DID-Linked Resource +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ResourceWithMetadata { + #[prost(message, optional, tag = "1")] + pub resource: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub metadata: ::core::option::Option, +} +/// QueryResourceRequest is the request type for the Query/Resource RPC method +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryResourceRequest { + /// collection_id is an identifier of the DidDocument the resource belongs to. + /// Format: + /// + /// Examples: + /// - c82f2b02-bdab-4dd7-b833-3e143745d612 + /// - wGHEXrZvJxR8vw5P3UWH1j + #[prost(string, tag = "1")] + pub collection_id: ::prost::alloc::string::String, + /// id is a unique id of the resource. + /// Format: + #[prost(string, tag = "2")] + pub id: ::prost::alloc::string::String, +} +/// QueryResourceResponse is the response type for the Query/Resource RPC method +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryResourceResponse { + /// Successful resolution of the resource returns the following: + /// - resource is the requested resource + /// - metadata is the resource metadata associated with the requested resource + #[prost(message, optional, tag = "1")] + pub resource: ::core::option::Option, +} +/// QueryResourceMetadataRequest is the request type for the Query/ResourceMetadata RPC method +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryResourceMetadataRequest { + /// collection_id is an identifier of the DidDocument the resource belongs to. + /// Format: + /// + /// Examples: + /// - c82f2b02-bdab-4dd7-b833-3e143745d612 + /// - wGHEXrZvJxR8vw5P3UWH1j + #[prost(string, tag = "1")] + pub collection_id: ::prost::alloc::string::String, + /// id is a unique id of the resource. + /// Format: + #[prost(string, tag = "2")] + pub id: ::prost::alloc::string::String, +} +/// QueryResourceMetadataResponse is the response type for the Query/ResourceMetadata RPC method +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryResourceMetadataResponse { + /// resource is the requested resource metadata + #[prost(message, optional, tag = "1")] + pub resource: ::core::option::Option, +} +/// QueryCollectionResourcesRequest is the request type for the Query/CollectionResources RPC method +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryCollectionResourcesRequest { + /// collection_id is an identifier of the DidDocument the resource belongs to. + /// Format: + /// + /// Examples: + /// - c82f2b02-bdab-4dd7-b833-3e143745d612 + /// - wGHEXrZvJxR8vw5P3UWH1j + #[prost(string, tag = "1")] + pub collection_id: ::prost::alloc::string::String, + /// pagination defines an optional pagination for the request. + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::super::cosmos::base::query::v1beta1::PageRequest, + >, +} +/// QueryCollectionResourcesResponse is the response type for the Query/CollectionResources RPC method +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryCollectionResourcesResponse { + /// resources is the requested collection of resource metadata + #[prost(message, repeated, tag = "1")] + pub resources: ::prost::alloc::vec::Vec, + /// pagination defines the pagination in the response. + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option< + super::super::super::cosmos::base::query::v1beta1::PageResponse, + >, +} +/// Generated client implementations. +pub mod query_client { + #![allow( + unused_variables, + dead_code, + missing_docs, + clippy::wildcard_imports, + clippy::let_unit_value, + )] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Query defines the gRPC querier service for the resource module + #[derive(Debug, Clone)] + pub struct QueryClient { + inner: tonic::client::Grpc, + } + impl QueryClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl QueryClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + std::marker::Send + 'static, + ::Error: Into + std::marker::Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> QueryClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + std::marker::Send + std::marker::Sync, + { + QueryClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Fetch data/payload for a specific resource (without metadata) + pub async fn resource( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/cheqd.resource.v2.Query/Resource", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cheqd.resource.v2.Query", "Resource")); + self.inner.unary(req, path, codec).await + } + /// Fetch only metadata for a specific resource + pub async fn resource_metadata( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/cheqd.resource.v2.Query/ResourceMetadata", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cheqd.resource.v2.Query", "ResourceMetadata")); + self.inner.unary(req, path, codec).await + } + /// Fetch metadata for all resources in a collection + pub async fn collection_resources( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/cheqd.resource.v2.Query/CollectionResources", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("cheqd.resource.v2.Query", "CollectionResources"), + ); + self.inner.unary(req, path, codec).await + } + } +} diff --git a/did_core/did_methods/did_cheqd/src/proto/cosmos.base.query.v1beta1.rs b/did_core/did_methods/did_cheqd/src/proto/cosmos.base.query.v1beta1.rs new file mode 100644 index 0000000000..22ce08b530 --- /dev/null +++ b/did_core/did_methods/did_cheqd/src/proto/cosmos.base.query.v1beta1.rs @@ -0,0 +1,55 @@ +// This file is @generated by prost-build. +/// PageRequest is to be embedded in gRPC request messages for efficient +/// pagination. Ex: +/// +/// message SomeRequest { +/// Foo some_parameter = 1; +/// PageRequest pagination = 2; +/// } +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PageRequest { + /// key is a value returned in PageResponse.next_key to begin + /// querying the next page most efficiently. Only one of offset or key + /// should be set. + #[prost(bytes = "vec", tag = "1")] + pub key: ::prost::alloc::vec::Vec, + /// offset is a numeric offset that can be used when key is unavailable. + /// It is less efficient than using key. Only one of offset or key should + /// be set. + #[prost(uint64, tag = "2")] + pub offset: u64, + /// limit is the total number of results to be returned in the result page. + /// If left empty it will default to a value to be set by each app. + #[prost(uint64, tag = "3")] + pub limit: u64, + /// count_total is set to true to indicate that the result set should include + /// a count of the total number of items available for pagination in UIs. + /// count_total is only respected when offset is used. It is ignored when key + /// is set. + #[prost(bool, tag = "4")] + pub count_total: bool, + /// reverse is set to true if results are to be returned in the descending order. + /// + /// Since: cosmos-sdk 0.43 + #[prost(bool, tag = "5")] + pub reverse: bool, +} +/// PageResponse is to be embedded in gRPC response messages where the +/// corresponding request message has used PageRequest. +/// +/// message SomeResponse { +/// repeated Bar results = 1; +/// PageResponse page = 2; +/// } +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PageResponse { + /// next_key is the key to be passed to PageRequest.key to + /// query the next page most efficiently. It will be empty if + /// there are no more results. + #[prost(bytes = "vec", tag = "1")] + pub next_key: ::prost::alloc::vec::Vec, + /// total is total number of results available if PageRequest.count_total + /// was set, its value is undefined otherwise + #[prost(uint64, tag = "2")] + pub total: u64, +} diff --git a/did_core/did_methods/did_cheqd/src/proto/google.api.rs b/did_core/did_methods/did_cheqd/src/proto/google.api.rs new file mode 100644 index 0000000000..635ce371a6 --- /dev/null +++ b/did_core/did_methods/did_cheqd/src/proto/google.api.rs @@ -0,0 +1,360 @@ +// This file is @generated by prost-build. +/// Defines the HTTP configuration for an API service. It contains a list of +/// [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method +/// to one or more HTTP REST API methods. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Http { + /// A list of HTTP configuration rules that apply to individual API methods. + /// + /// **NOTE:** All service configuration rules follow "last one wins" order. + #[prost(message, repeated, tag = "1")] + pub rules: ::prost::alloc::vec::Vec, + /// When set to true, URL path parameters will be fully URI-decoded except in + /// cases of single segment matches in reserved expansion, where "%2F" will be + /// left encoded. + /// + /// The default behavior is to not decode RFC 6570 reserved characters in multi + /// segment matches. + #[prost(bool, tag = "2")] + pub fully_decode_reserved_expansion: bool, +} +/// gRPC Transcoding +/// +/// gRPC Transcoding is a feature for mapping between a gRPC method and one or +/// more HTTP REST endpoints. It allows developers to build a single API service +/// that supports both gRPC APIs and REST APIs. Many systems, including [Google +/// APIs](), +/// [Cloud Endpoints](), [gRPC +/// Gateway](), +/// and [Envoy]() proxy support this feature +/// and use it for large scale production services. +/// +/// `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies +/// how different portions of the gRPC request message are mapped to the URL +/// path, URL query parameters, and HTTP request body. It also controls how the +/// gRPC response message is mapped to the HTTP response body. `HttpRule` is +/// typically specified as an `google.api.http` annotation on the gRPC method. +/// +/// Each mapping specifies a URL path template and an HTTP method. The path +/// template may refer to one or more fields in the gRPC request message, as long +/// as each field is a non-repeated field with a primitive (non-message) type. +/// The path template controls how fields of the request message are mapped to +/// the URL path. +/// +/// Example: +/// +/// service Messaging { +/// rpc GetMessage(GetMessageRequest) returns (Message) { +/// option (google.api.http) = { +/// get: "/v1/{name=messages/*}" +/// }; +/// } +/// } +/// message GetMessageRequest { +/// string name = 1; // Mapped to URL path. +/// } +/// message Message { +/// string text = 1; // The resource content. +/// } +/// +/// This enables an HTTP REST to gRPC mapping as below: +/// +/// - HTTP: `GET /v1/messages/123456` +/// - gRPC: `GetMessage(name: "messages/123456")` +/// +/// Any fields in the request message which are not bound by the path template +/// automatically become HTTP query parameters if there is no HTTP request body. +/// For example: +/// +/// service Messaging { +/// rpc GetMessage(GetMessageRequest) returns (Message) { +/// option (google.api.http) = { +/// get:"/v1/messages/{message_id}" +/// }; +/// } +/// } +/// message GetMessageRequest { +/// message SubMessage { +/// string subfield = 1; +/// } +/// string message_id = 1; // Mapped to URL path. +/// int64 revision = 2; // Mapped to URL query parameter `revision`. +/// SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. +/// } +/// +/// This enables a HTTP JSON to RPC mapping as below: +/// +/// - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo` +/// - gRPC: `GetMessage(message_id: "123456" revision: 2 sub: +/// SubMessage(subfield: "foo"))` +/// +/// Note that fields which are mapped to URL query parameters must have a +/// primitive type or a repeated primitive type or a non-repeated message type. +/// In the case of a repeated type, the parameter can be repeated in the URL +/// as `...?param=A¶m=B`. In the case of a message type, each field of the +/// message is mapped to a separate parameter, such as +/// `...?foo.a=A&foo.b=B&foo.c=C`. +/// +/// For HTTP methods that allow a request body, the `body` field +/// specifies the mapping. Consider a REST update method on the +/// message resource collection: +/// +/// service Messaging { +/// rpc UpdateMessage(UpdateMessageRequest) returns (Message) { +/// option (google.api.http) = { +/// patch: "/v1/messages/{message_id}" +/// body: "message" +/// }; +/// } +/// } +/// message UpdateMessageRequest { +/// string message_id = 1; // mapped to the URL +/// Message message = 2; // mapped to the body +/// } +/// +/// The following HTTP JSON to RPC mapping is enabled, where the +/// representation of the JSON in the request body is determined by +/// protos JSON encoding: +/// +/// - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` +/// - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })` +/// +/// The special name `*` can be used in the body mapping to define that +/// every field not bound by the path template should be mapped to the +/// request body. This enables the following alternative definition of +/// the update method: +/// +/// service Messaging { +/// rpc UpdateMessage(Message) returns (Message) { +/// option (google.api.http) = { +/// patch: "/v1/messages/{message_id}" +/// body: "*" +/// }; +/// } +/// } +/// message Message { +/// string message_id = 1; +/// string text = 2; +/// } +/// +/// +/// The following HTTP JSON to RPC mapping is enabled: +/// +/// - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` +/// - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")` +/// +/// Note that when using `*` in the body mapping, it is not possible to +/// have HTTP parameters, as all fields not bound by the path end in +/// the body. This makes this option more rarely used in practice when +/// defining REST APIs. The common usage of `*` is in custom methods +/// which don't use the URL at all for transferring data. +/// +/// It is possible to define multiple HTTP methods for one RPC by using +/// the `additional_bindings` option. Example: +/// +/// service Messaging { +/// rpc GetMessage(GetMessageRequest) returns (Message) { +/// option (google.api.http) = { +/// get: "/v1/messages/{message_id}" +/// additional_bindings { +/// get: "/v1/users/{user_id}/messages/{message_id}" +/// } +/// }; +/// } +/// } +/// message GetMessageRequest { +/// string message_id = 1; +/// string user_id = 2; +/// } +/// +/// This enables the following two alternative HTTP JSON to RPC mappings: +/// +/// - HTTP: `GET /v1/messages/123456` +/// - gRPC: `GetMessage(message_id: "123456")` +/// +/// - HTTP: `GET /v1/users/me/messages/123456` +/// - gRPC: `GetMessage(user_id: "me" message_id: "123456")` +/// +/// Rules for HTTP mapping +/// +/// 1. Leaf request fields (recursive expansion nested messages in the request +/// message) are classified into three categories: +/// - Fields referred by the path template. They are passed via the URL path. +/// - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They +/// are passed via the HTTP +/// request body. +/// - All other fields are passed via the URL query parameters, and the +/// parameter name is the field path in the request message. A repeated +/// field can be represented as multiple query parameters under the same +/// name. +/// 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL +/// query parameter, all fields +/// are passed via URL path and HTTP request body. +/// 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP +/// request body, all +/// fields are passed via URL path and URL query parameters. +/// +/// Path template syntax +/// +/// Template = "/" Segments \[ Verb \] ; +/// Segments = Segment { "/" Segment } ; +/// Segment = "*" | "**" | LITERAL | Variable ; +/// Variable = "{" FieldPath \[ "=" Segments \] "}" ; +/// FieldPath = IDENT { "." IDENT } ; +/// Verb = ":" LITERAL ; +/// +/// The syntax `*` matches a single URL path segment. The syntax `**` matches +/// zero or more URL path segments, which must be the last part of the URL path +/// except the `Verb`. +/// +/// The syntax `Variable` matches part of the URL path as specified by its +/// template. A variable template must not contain other variables. If a variable +/// matches a single path segment, its template may be omitted, e.g. `{var}` +/// is equivalent to `{var=*}`. +/// +/// The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` +/// contains any reserved character, such characters should be percent-encoded +/// before the matching. +/// +/// If a variable contains exactly one path segment, such as `"{var}"` or +/// `"{var=*}"`, when such a variable is expanded into a URL path on the client +/// side, all characters except `\[-_.~0-9a-zA-Z\]` are percent-encoded. The +/// server side does the reverse decoding. Such variables show up in the +/// [Discovery +/// Document]() as +/// `{var}`. +/// +/// If a variable contains multiple path segments, such as `"{var=foo/*}"` +/// or `"{var=**}"`, when such a variable is expanded into a URL path on the +/// client side, all characters except `\[-_.~/0-9a-zA-Z\]` are percent-encoded. +/// The server side does the reverse decoding, except "%2F" and "%2f" are left +/// unchanged. Such variables show up in the +/// [Discovery +/// Document]() as +/// `{+var}`. +/// +/// Using gRPC API Service Configuration +/// +/// gRPC API Service Configuration (service config) is a configuration language +/// for configuring a gRPC service to become a user-facing product. The +/// service config is simply the YAML representation of the `google.api.Service` +/// proto message. +/// +/// As an alternative to annotating your proto file, you can configure gRPC +/// transcoding in your service config YAML files. You do this by specifying a +/// `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same +/// effect as the proto annotation. This can be particularly useful if you +/// have a proto that is reused in multiple services. Note that any transcoding +/// specified in the service config will override any matching transcoding +/// configuration in the proto. +/// +/// The following example selects a gRPC method and applies an `HttpRule` to it: +/// +/// http: +/// rules: +/// - selector: example.v1.Messaging.GetMessage +/// get: /v1/messages/{message_id}/{sub.subfield} +/// +/// Special notes +/// +/// When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the +/// proto to JSON conversion must follow the [proto3 +/// specification](). +/// +/// While the single segment variable follows the semantics of +/// [RFC 6570]() Section 3.2.2 Simple String +/// Expansion, the multi segment variable **does not** follow RFC 6570 Section +/// 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion +/// does not expand special characters like `?` and `#`, which would lead +/// to invalid URLs. As the result, gRPC Transcoding uses a custom encoding +/// for multi segment variables. +/// +/// The path variables **must not** refer to any repeated or mapped field, +/// because client libraries are not capable of handling such variable expansion. +/// +/// The path variables **must not** capture the leading "/" character. The reason +/// is that the most common use case "{var}" does not capture the leading "/" +/// character. For consistency, all path variables must share the same behavior. +/// +/// Repeated message fields must not be mapped to URL query parameters, because +/// no client library can support such complicated mapping. +/// +/// If an API needs to use a JSON array for request or response body, it can map +/// the request or response body to a repeated field. However, some gRPC +/// Transcoding implementations may not support this feature. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct HttpRule { + /// Selects a method to which this rule applies. + /// + /// Refer to [selector][google.api.DocumentationRule.selector] for syntax + /// details. + #[prost(string, tag = "1")] + pub selector: ::prost::alloc::string::String, + /// The name of the request field whose value is mapped to the HTTP request + /// body, or `*` for mapping all request fields not captured by the path + /// pattern to the HTTP body, or omitted for not having any HTTP request body. + /// + /// NOTE: the referred field must be present at the top-level of the request + /// message type. + #[prost(string, tag = "7")] + pub body: ::prost::alloc::string::String, + /// Optional. The name of the response field whose value is mapped to the HTTP + /// response body. When omitted, the entire response message will be used + /// as the HTTP response body. + /// + /// NOTE: The referred field must be present at the top-level of the response + /// message type. + #[prost(string, tag = "12")] + pub response_body: ::prost::alloc::string::String, + /// Additional HTTP bindings for the selector. Nested bindings must + /// not contain an `additional_bindings` field themselves (that is, + /// the nesting may only be one level deep). + #[prost(message, repeated, tag = "11")] + pub additional_bindings: ::prost::alloc::vec::Vec, + /// Determines the URL pattern is matched by this rules. This pattern can be + /// used with any of the {get|put|post|delete|patch} methods. A custom method + /// can be defined using the 'custom' field. + #[prost(oneof = "http_rule::Pattern", tags = "2, 3, 4, 5, 6, 8")] + pub pattern: ::core::option::Option, +} +/// Nested message and enum types in `HttpRule`. +pub mod http_rule { + /// Determines the URL pattern is matched by this rules. This pattern can be + /// used with any of the {get|put|post|delete|patch} methods. A custom method + /// can be defined using the 'custom' field. + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Pattern { + /// Maps to HTTP GET. Used for listing and getting information about + /// resources. + #[prost(string, tag = "2")] + Get(::prost::alloc::string::String), + /// Maps to HTTP PUT. Used for replacing a resource. + #[prost(string, tag = "3")] + Put(::prost::alloc::string::String), + /// Maps to HTTP POST. Used for creating a resource or performing an action. + #[prost(string, tag = "4")] + Post(::prost::alloc::string::String), + /// Maps to HTTP DELETE. Used for deleting a resource. + #[prost(string, tag = "5")] + Delete(::prost::alloc::string::String), + /// Maps to HTTP PATCH. Used for updating a resource. + #[prost(string, tag = "6")] + Patch(::prost::alloc::string::String), + /// The custom pattern is used for specifying an HTTP method that is not + /// included in the `pattern` field, such as HEAD, or "*" to leave the + /// HTTP method unspecified for this rule. The wild-card rule is useful + /// for services that provide content to Web (HTML) clients. + #[prost(message, tag = "8")] + Custom(super::CustomHttpPattern), + } +} +/// A custom pattern is used for defining custom HTTP verb. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CustomHttpPattern { + /// The name of this custom HTTP verb. + #[prost(string, tag = "1")] + pub kind: ::prost::alloc::string::String, + /// The path matched by this custom verb. + #[prost(string, tag = "2")] + pub path: ::prost::alloc::string::String, +} diff --git a/did_core/did_methods/did_cheqd/src/proto.rs b/did_core/did_methods/did_cheqd/src/proto/mod.rs similarity index 55% rename from did_core/did_methods/did_cheqd/src/proto.rs rename to did_core/did_methods/did_cheqd/src/proto/mod.rs index 386671f18f..70748162f3 100644 --- a/did_core/did_methods/did_cheqd/src/proto.rs +++ b/did_core/did_methods/did_cheqd/src/proto/mod.rs @@ -1,12 +1,14 @@ +//! module structure wrapper over the generated proto types + pub mod cheqd { pub mod did { pub mod v2 { - tonic::include_proto!("cheqd.did.v2"); + include!("cheqd.did.v2.rs"); } } pub mod resource { pub mod v2 { - tonic::include_proto!("cheqd.resource.v2"); + include!("cheqd.resource.v2.rs"); } } } @@ -15,7 +17,7 @@ pub mod cosmos { pub mod base { pub mod query { pub mod v1beta1 { - tonic::include_proto!("cosmos.base.query.v1beta1"); + include!("cosmos.base.query.v1beta1.rs"); } } }