forked from hyperledger/aries-vcx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(feat) Cheqd DID resolver hyperledger#1300 (hyperledger#1305)
* try permissions in CI Signed-off-by: George Mulhearn <gmulhearn@anonyome.com> * new crate Signed-off-by: George Mulhearn <gmulhearn@anonyome.com> * resolution working Signed-off-by: George Mulhearn <gmulhearn@anonyome.com> * check in the proto types and have a standalone generator helper (rather than generate at build time) Signed-off-by: George Mulhearn <gmulhearn@anonyome.com> * regen lock Signed-off-by: George Mulhearn <gmulhearn@anonyome.com> * cheqd did parser Signed-off-by: George Mulhearn <gmulhearn@anonyome.com> * cheqd did url tests Signed-off-by: George Mulhearn <gmulhearn@anonyome.com> * re-gen lock Signed-off-by: George Mulhearn <gmulhearn@anonyome.com> * resolver system tests are working Signed-off-by: George Mulhearn <gmulhearn@anonyome.com> * run int tests in CI Signed-off-by: George Mulhearn <gmulhearn@anonyome.com> * clippy Signed-off-by: George Mulhearn <gmulhearn@anonyome.com> * resolution with contexts Signed-off-by: George Mulhearn <gmulhearn@anonyome.com> * finish some TODOs, and add doc metadata Signed-off-by: George Mulhearn <gmulhearn@anonyome.com> * update readme Signed-off-by: George Mulhearn <gmulhearn@anonyome.com> * try bumping rust ver on vdrproxy Signed-off-by: George Mulhearn <gmulhearn@anonyome.com> * lock auto update Signed-off-by: George Mulhearn <gmulhearn@anonyome.com> * readme updates Signed-off-by: George Mulhearn <gmulhearn@anonyome.com> * remove some debugs Signed-off-by: George Mulhearn <gmulhearn@anonyome.com> * more error info Signed-off-by: George Mulhearn <gmulhearn@anonyome.com> * updated hyper in did:web. fixes clients Signed-off-by: George Mulhearn <gmulhearn@anonyome.com> * fix up tls. works on android Signed-off-by: George Mulhearn <gmulhearn@anonyome.com> * some cleaning Signed-off-by: George Mulhearn <gmulhearn@anonyome.com> --------- Signed-off-by: George Mulhearn <gmulhearn@anonyome.com> Co-authored-by: George Mulhearn <gmulhearn@anonyome.com>
- Loading branch information
1 parent
b84d1f9
commit 0e3bed0
Showing
44 changed files
with
4,815 additions
and
61 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
[package] | ||
name = "did_cheqd" | ||
authors.workspace = true | ||
description.workspace = true | ||
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 = [ | ||
"codegen", | ||
"prost", | ||
"channel", | ||
] } | ||
prost = { version = "0.13.3", default-features = false } | ||
prost-types = "0.13.3" | ||
native-tls = { version = "0.2.12", features = ["alpn"] } | ||
hyper-tls = "0.6.0" | ||
hyper-util = { version = "0.1.10", features = ["client-legacy", "http2"] } | ||
http-body-util = "0.1.2" | ||
async-trait = "0.1.68" | ||
serde_json = "1.0.96" | ||
serde = { version = "1.0.160", features = ["derive"] } | ||
thiserror = "1.0.40" | ||
tokio = { version = "1.38.0" } | ||
chrono = { version = "0.4.24", default-features = false } | ||
url = { version = "2.3.1", default-features = false } | ||
bytes = "1.8.0" | ||
|
||
[dev-dependencies] | ||
tokio = { version = "1.38.0", default-features = false, features = [ | ||
"macros", | ||
"rt", | ||
] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# DID Cheqd Resolver | ||
This crate contains a resolver for DIDs of the [did:cheqd](https://docs.cheqd.io/product/architecture/adr-list/adr-001-cheqd-did-method) method. The implementation resolves DIDs via gRPC network requests to the configured nodes. Default nodes for cheqd's `mainnet` & `testnet` can be used, or custom nodes can be opt-in by supplying a different gRPC URL configuration. | ||
|
||
The implementations in this crate are largely inspired from cheqd's own typescript [sdk](https://github.com/cheqd/sdk/blob/main/src/modules/did.ts). | ||
|
||
This crate uses gRPC types and clients generated using [tonic](https://github.com/hyperium/tonic). The generated rust code is checked-in to this repository for monitoring, [see here](./src/proto/mod.rs). These generated rust files are checked-in alongside the V2 cheqd proto files & dependencies, [here](./cheqd_proto_gen/proto/), which are sourced from [cheqd's Buf registry](https://buf.build/cheqd/proto/docs). | ||
|
||
Since the generated code & proto files are not relatively large nor overwhelming in content, they are checked-in rather than pulled and/or generated at build time. The benefit is that the contents of the files can be monitored with each update, making supply-chain attacks obvious. It also reduces the build time complexity for consumers - such as reducing requirements for any 3rd party build tools to be installed (`protobuf`). The drawback is that it introduces some more manual maintainence. | ||
|
||
## Crate Maintainence | ||
If there is an update to the `.proto` files, or `tonic` had a breaking update, the checked-in files may be due for a manual update. To do so, update any proto files in the [proto dir](./cheqd_proto_gen/proto/), then re-generate the rust files by using the [cheqd-proto-gen](./cheqd_proto_gen/) binary within this directory: | ||
``` | ||
cargo run --bin cheqd-proto-gen | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" |
138 changes: 138 additions & 0 deletions
138
did_core/did_methods/did_cheqd/cheqd_proto_gen/proto/cheqd/did/v2/diddoc.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
syntax = "proto3"; | ||
|
||
package cheqd.did.v2; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "google/protobuf/timestamp.proto"; | ||
|
||
option go_package = "github.com/cheqd/cheqd-node/x/did/types"; | ||
|
||
// DidDoc defines a DID Document, as defined in the DID Core specification. | ||
// Documentation: https://www.w3.org/TR/did-core/ | ||
message DidDoc { | ||
// context is a list of URIs used to identify the context of the DID document. | ||
// Default: https://www.w3.org/ns/did/v1 | ||
repeated string context = 1; | ||
|
||
// id is the DID of the DID document. | ||
// Format: did:cheqd:<namespace>:<unique-identifier> | ||
string id = 2; | ||
|
||
// controller is a list of DIDs that are allowed to control the DID document. | ||
repeated string controller = 3; | ||
|
||
// verificationMethod is a list of verification methods that can be used to | ||
// verify a digital signature or cryptographic proof. | ||
repeated VerificationMethod verification_method = 4; | ||
|
||
// authentication is a list of verification methods that can be used to | ||
// authenticate as the DID subject. | ||
repeated string authentication = 5; | ||
|
||
// assertionMethod is a list of verification methods that can be used to | ||
// assert statements as the DID subject. | ||
repeated string assertion_method = 6; | ||
|
||
// capabilityInvocation is a list of verification methods that can be used to | ||
// invoke capabilities as the DID subject. | ||
repeated string capability_invocation = 7; | ||
|
||
// capabilityDelegation is a list of verification methods that can be used to | ||
// delegate capabilities as the DID subject. | ||
repeated string capability_delegation = 8; | ||
|
||
// keyAgreement is a list of verification methods that can be used to perform | ||
// key agreement as the DID subject. | ||
repeated string key_agreement = 9; | ||
|
||
// service is a list of services that can be used to interact with the DID subject. | ||
repeated Service service = 10; | ||
|
||
// alsoKnownAs is a list of DIDs that are known to refer to the same DID subject. | ||
repeated string also_known_as = 11; | ||
} | ||
|
||
// VerificationMethod defines a verification method, as defined in the DID Core specification. | ||
// Documentation: https://www.w3.org/TR/did-core/#verification-methods | ||
message VerificationMethod { | ||
// id is the unique identifier of the verification method. | ||
// Format: did:cheqd:<namespace>:<unique-identifier>#<key-id> | ||
string id = 1; | ||
|
||
// type is the type of the verification method. | ||
// Example: Ed25519VerificationKey2020 | ||
string verification_method_type = 2 [(gogoproto.jsontag) = "type,omitempty"]; | ||
|
||
// controller is the DID of the controller of the verification method. | ||
// Format: did:cheqd:<namespace>:<unique-identifier> | ||
string controller = 3; | ||
|
||
// verification_material is the public key of the verification method. | ||
// Commonly used verification material types: publicJwk, publicKeyBase58, publicKeyMultibase | ||
string verification_material = 4; | ||
} | ||
|
||
// Service defines a service, as defined in the DID Core specification. | ||
// Documentation: https://www.w3.org/TR/did-core/#services | ||
message Service { | ||
// id is the unique identifier of the service. | ||
// Format: did:cheqd:<namespace>:<unique-identifier>#<service-id> | ||
string id = 1; | ||
|
||
// type is the type of the service. | ||
// Example: LinkedResource | ||
string service_type = 2 [(gogoproto.jsontag) = "type,omitempty"]; | ||
|
||
// serviceEndpoint is the endpoint of the service. | ||
// Example: https://example.com/endpoint | ||
repeated string service_endpoint = 3; | ||
} | ||
|
||
// DidDocWithMetadata defines a DID Document with metadata, as defined in the DID Core specification. | ||
// Contains the DID Document, as well as DID Document metadata. | ||
message DidDocWithMetadata { | ||
// didDocument is the DID Document. | ||
DidDoc did_doc = 1 [(gogoproto.jsontag) = "didDocument"]; | ||
|
||
// didDocumentMetadata is the DID Document metadata. | ||
Metadata metadata = 2 [(gogoproto.jsontag) = "didDocumentMetadata"]; | ||
} | ||
|
||
// Metadata defines DID Document metadata, as defined in the DID Core specification. | ||
// Documentation: https://www.w3.org/TR/did-core/#did-document-metadata-properties | ||
message Metadata { | ||
// created is the timestamp of the creation of the DID Document. | ||
// Format: RFC3339 | ||
// Example: 2021-03-10T15:16:17Z | ||
google.protobuf.Timestamp created = 1 [ | ||
(gogoproto.nullable) = false, | ||
(gogoproto.stdtime) = true | ||
]; | ||
|
||
// updated is the timestamp of the last update of the DID Document. | ||
// Format: RFC3339 | ||
// Example: 2021-03-10T15:16:17Z | ||
google.protobuf.Timestamp updated = 2 [ | ||
(gogoproto.nullable) = true, | ||
(gogoproto.stdtime) = true | ||
]; | ||
|
||
// deactivated is a flag that indicates whether the DID Document is deactivated. | ||
// Default: false | ||
bool deactivated = 3; | ||
|
||
// version_id is the version identifier of the DID Document. | ||
// Format: UUID | ||
// Example: 123e4567-e89b-12d3-a456-426655440000 | ||
string version_id = 4; | ||
|
||
// next_version_id is the version identifier of the next version of the DID Document. | ||
// Format: UUID | ||
// Example: 123e4567-e89b-12d3-a456-426655440000 | ||
string next_version_id = 5 [(gogoproto.nullable) = true]; | ||
|
||
// previous_version_id is the version identifier of the previous version of the DID Document. | ||
// Format: UUID | ||
// Example: 123e4567-e89b-12d3-a456-426655440000 | ||
string previous_version_id = 6 [(gogoproto.nullable) = true]; | ||
} |
Oops, something went wrong.