feature/implement did state (#15)

* refactor: update model proto

* feat: add status field to Controller

* feat: add Verification.Kind field to state protobuf to support different verification types

* fix: remove QueryService and QueryResolve RPCs from query.proto
This commit is contained in:
Prad Nukala
2024-09-18 17:27:30 -04:00
committed by GitHub
parent 2c1cf56e3c
commit 6d8bd8fc85
18 changed files with 1348 additions and 5998 deletions
-7
View File
@@ -7,13 +7,6 @@ import "gogoproto/gogo.proto";
option go_package = "github.com/onsonr/sonr/x/did/types";
// Alias defines a subject/origin pair
message Alias {
string subject = 1;
string origin = 2;
string controller = 3;
}
message Credential {
string subject = 1;
string attestation_type = 2;
-21
View File
@@ -19,13 +19,6 @@ service Query {
option (google.api.http).get = "/did/{did}";
}
// Service returns associated ServiceInfo for a given Origin
// if the servie is not found, a fingerprint is generated to be used
// as a TXT record in DNS. v=sonr, o=origin, p=protocol
rpc Service(QueryRequest) returns (QueryServiceResponse) {
option (google.api.http).get = "/service/{origin}";
}
// Sync queries the DID document by its id. And returns the required PKL information
rpc Sync(SyncRequest) returns (SyncResponse) {
option (google.api.http).post = "/sync";
@@ -54,20 +47,6 @@ message QueryParamsResponse {
Params params = 1;
}
// QueryResolveResponse is the response type for the Query/Resolve RPC method.
message QueryResolveResponse {
// document is the DID document
Document document = 1;
}
// QueryLoginOptionsResponse is the response type for the Query/LoginOptions RPC method.
message QueryServiceResponse {
// options is the PublicKeyCredentialAttestationOptions
bool existing = 1;
ServiceInfo service = 2;
string txt_record = 3;
}
// SyncRequest is the request type for the Sync RPC method.
message SyncRequest {
string did = 1;
+24 -99
View File
@@ -8,29 +8,14 @@ import "did/v1/models.proto";
option go_package = "github.com/onsonr/sonr/x/did/types";
// Account represents a wallet account associated with a DID Controller
message Account {
// Alias represents a DID alias
message Alias {
option (cosmos.orm.v1.table) = {
id: 1
primary_key: {fields: "id"}
index: {
id: 1
fields: "controller,label"
unique: true
}
index: {
id: 2
fields: "controller,address"
unique: true
}
index: {
id: 3
fields: "controller,chain_code,index"
unique: true
}
index: {
id: 4
fields: "namespace,address"
fields: "did,alias"
unique: true
}
};
@@ -38,20 +23,20 @@ message Account {
// The unique identifier of the alias
string id = 1;
// Origin is the Alias provider
string address = 2;
// The DID of the alias
string did = 2;
// Subject is the user defined alias
string label = 3;
// The alias of the DID
string alias = 3;
// Controller of the alias
string controller = 4;
// Origin of the alias
string origin = 4;
string namespace = 5;
// Permissions of the alias
repeated string scopes = 5;
uint32 chain_code = 6;
uint32 index = 7;
// Expiration of the alias
int64 expiration = 6;
}
// Controller represents a Sonr DWN Vault
@@ -69,6 +54,11 @@ message Controller {
fields: "vault_cid"
unique: true
}
index: {
id: 3
fields: "status,vault_cid"
unique: true
}
};
// The unique identifier of the controller
@@ -88,80 +78,13 @@ message Controller {
// The Authentications of the controller
repeated Credential authentication = 6;
}
// Proof represents a verifiable credential
message Proof {
option (cosmos.orm.v1.table) = {
id: 4
primary_key: {fields: "id"}
index: {
id: 1
fields: "controller,issuer,property"
unique: true
}
};
// The unique identifier of the proof
string id = 1;
// The controller of the proof
string controller = 2;
// The value of the linked identifier
string issuer = 3;
// The property of the proof
string property = 4;
// The accumulator of the proof
bytes accumulator = 5;
// The secret key of the proof
bytes key = 6;
}
// ServiceRecord represents a decentralized service in a DID Document
message ServiceRecord {
option (cosmos.orm.v1.table) = {
id: 3
primary_key: {fields: "id"}
index: {
id: 1
fields: "origin"
unique: true
}
index: {
id: 2
fields: "authority,origin"
unique: true
}
};
// The ID of the service
string id = 1;
// The type of the service
string service_type = 2;
// The authority DID of the service
string authority = 3;
// The domain name of the service
string origin = 4;
// The description of the service
string description = 5;
// The service endpoint
map<string, string> service_endpoints = 6;
// Scopes is the Authorization Grants of the service
Permissions permissions = 7;
// The Status of the claims for the controller
string status = 7;
}
// Verification reprsents a method of verifying membership in a DID
message VerificationMethod {
message Verification {
option (cosmos.orm.v1.table) = {
id: 5
primary_key: {fields: "id"}
@@ -189,5 +112,7 @@ message VerificationMethod {
// The public key of the verification
PubKey public_key = 6;
// The controller DID of the service
// The Verification Kind (Authentication, Assertion, CapabilityDelegation, CapabilityInvocation)
string kind = 7;
}