Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: ADR-024: Decentralized identifiers resolver #1289

Merged
merged 8 commits into from
Feb 2, 2024
144 changes: 144 additions & 0 deletions docs/architecture/adr-024-decentralized-identifiers-resolver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# ADR 024: Decentralized Identifiers resolver

## Changelog

- Jan 16th, 2024: First draft;
- Jan 23th, 2024: First review;

## Status

ACCEPTED Not Implemented
RiccardoM marked this conversation as resolved.
Show resolved Hide resolved

## Abstract

This ADR proposes the integration of a new functionality into Desmos to resolve Desmos Profiles into DID documents, incorporating Decentralized Identifiers (DIDs) for enhanced digital identity verification.

## Context

Decentralized identifiers (DIDs) are a new type of identifier that enables verifiable, decentralized digital identity. Via verifiable credential, DID enables individuals to assert control over their personal information, aligning with principles of privacy, and user empowerment. Furthermore, as DIDs emerge as a universal standard, they are poised to play a pivotal role in identity authentication across various applications. Desmos serves as a decentralized social platform infrastructure, DID would contribute to an improved user experience in identity management.

## Decision

We will implement a query method `DidDoc` within the Desmos Profiles module to resolve Desmos Profiles into DID documents. In addition, A DID that uses this method MUST begin with the following prefix: `did:desmos`.

The example of the resolver's response would be like as follows:

```json
{
"context": [
"https://www.w3.org/ns/did/v1",
"https://w3id.org/security/suites/secp256k1-2019/v1"
],
"id": "did:desmos:<desmos-address>",
"alsoKnownAs": [
"dtag:<DTag>", /* Desmos Dtag */
"application:<application-name>:<id-in-application>", /* application link */
"blockchain:<chain-name>:<chain-address>", /* chain link */
],
"verificationMethod": [
{
"id": "did:desmos:<desmos-address>#DESMOS-KEY-1",
"type": "EcdsaSecp256k1VerificationKey2019",
"publicKeyMultibase": "<multibase-encoded-public-key>"
}
],
"authentication": [
"did:desmos:<desmos-address>#DESMOS-KEY-1"
],
"assertionMethod": [
"did:desmos:<desmos-address>#DESMOS-KEY-1"
],
}
```

### `Query` service

```protobuf
service Query{
// DidDoc queries for a single DID document.
rpc DidDoc(QueryDidDocRequest) returns(QueryDidDocResponse) {
option (google.http.get) = "/desmos/profiles/v3/did/{id}";
};
}

// QueryDidDocRequest is the request type for the Query/DidDoc RPC method
message QueryDidDocRequest {
string id = 1;
}

// QueryDidDocResponse is the response type for the Query/DidDoc RPC method
message QueryDidDocResponse {
// URIs used to identify the context of DID document.
// Default: ["https://www.w3.org/ns/did/v1", "https://w3id.org/security/suites/secp256k1-2019/v1"]
repeated string context = 1;

// The unique identifier in DID syntax of DID document.
// Example: did:desmos:<desmos-address>
string id = 2;

// The assertion that resources refer to the DID.
// In Desmos, it shows chain links and application links linked to profile.
// Documentation: https://www.w3.org/TR/did-core/#also-known-as
string also_known_as = 3;

// Keys of verification methods for verifying digital signature.
// In Desmos, it must be the public key(s) that associated to the profile owner.
repeated VerificationMethod verification_methods = 4;

// Id of keys for authentication within verification methods.
// Documentation: https://www.w3.org/TR/did-core/#authentication
repeated string authentication = 5;

// Id of keys for assertion method within verification methods.
// Documentation: https://www.w3.org/TR/did-core/#assertion
repeated string assertion_method = 6;
}

// VerificationMethod represents the cryptographic public keys, which can be used to authenticate interaction.
// Documentation: https://www.w3.org/TR/did-core/#verification-methods
message VerificationMethod {
// Unique identifier in DID URL syntax.
// Example: did:desmos:<desmos-address>#DESMOS-KEY-1
string id = 1;

// Type of the verification method.
// Example: "EcdsaSecp256k1VerificationKey2019"
string type = 2;

// Hex-encoded of the public key in the multibase format.
// Documentation: https://w3c-ccg.github.io/multibase
string public_key_multibase = 3;
}
```

### Limitation

Due to the necessity of public key(s) being directly controlled by the profile owner, any profile owner lacking public keys, such as those associated with a contract, cannot be resolved into a DID.
RiccardoM marked this conversation as resolved.
Show resolved Hide resolved
Future versions may explore alternative methods to accommodate profiles without direct public key control, enhancing inclusivity.

## Consequences

### Backwards Compatibility

The solution outlined above is fully backward compatible since we are just adding a new query method.
RiccardoM marked this conversation as resolved.
Show resolved Hide resolved

### Positive

- Enable the usage of Desmos in applications that support DID.

### Negative

(none known)

### Neutral

(none known)

## Further Discussions

To be compatible to DID universal resolver, we SHOULD implement resolver driver for Desmos in the future.
RiccardoM marked this conversation as resolved.
Show resolved Hide resolved

## References

- [W3C Decentralized Identifiers (DIDs) v1.0](https://www.w3.org/TR/did-core/)
- [DID universal resolver](https://github.com/decentralized-identity/universal-resolver)
Loading