(no commit message provided)

This commit is contained in:
Prad Nukala
2024-07-05 22:20:13 -04:00
committed by Prad Nukala (aider)
commit 5fd43dfd6b
457 changed files with 115535 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
syntax = "proto3";
package didao.sonr.did.module.v1;
import "cosmos/app/v1alpha1/module.proto";
// Module is the app config object of the module.
// Learn more: https://docs.cosmos.network/main/building-modules/depinject
message Module {
option (cosmos.app.v1alpha1.module) = {
go_import : "github.com/onsonr/hway"
};
}
+50
View File
@@ -0,0 +1,50 @@
// Copyright Tharsis Labs Ltd.(Evmos)
// SPDX-License-Identifier:ENCL-1.0(https://github.com/evmos/evmos/blob/main/LICENSE)
syntax = "proto3";
package did.v1;
import "cosmos/auth/v1beta1/auth.proto";
import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";
import "did/v1/genesis.proto";
option go_package = "github.com/onsonr/hway/x/did/types";
// EthAccount implements the authtypes.AccountI interface and embeds an
// authtypes.BaseAccount type. It is compatible with the auth AccountKeeper.
message EthAccount {
option (gogoproto.goproto_getters) = false;
option (gogoproto.goproto_stringer) = false;
option (gogoproto.equal) = false;
option (cosmos_proto.implements_interface) = "github.com/cosmos/cosmos-sdk/x/auth/types.cosmos.auth.v1beta1.AccountI";
// base_account is an authtypes.BaseAccount
cosmos.auth.v1beta1.BaseAccount base_account = 1
[(gogoproto.embed) = true, (gogoproto.moretags) = "yaml:\"base_account\""];
// code_hash is the hash calculated from the code contents
string code_hash = 2 [(gogoproto.moretags) = "yaml:\"code_hash\""];
// controller is the address of the controller
string controller = 3 [(gogoproto.moretags) = "yaml:\"controller\""];
}
// DIDDocument defines a DID document
message DIDDocument {
string id = 1;
repeated VerificationMethod verification_methods = 2;
repeated string authentication = 4;
repeated string assertion_method = 5;
repeated string capability_delegation = 7;
repeated string capability_invocation = 8;
}
// VerificationMethod defines a verification method
message VerificationMethod {
string id = 1;
string controller = 2;
PublicKey public_key = 3;
}
+47
View File
@@ -0,0 +1,47 @@
syntax = "proto3";
package did.v1;
import "gogoproto/gogo.proto";
import "amino/amino.proto";
option go_package = "github.com/onsonr/hway/x/did/types";
// GenesisState defines the module genesis state
message GenesisState {
// Params defines all the paramaters of the module.
Params params = 1 [(gogoproto.nullable) = false];
}
// Params defines the set of module parameters.
message Params {
option (amino.name) = "did/params";
option (gogoproto.equal) = true;
option (gogoproto.goproto_stringer) = false;
// Property Allowlist
repeated string property_allowlist = 2;
// Whitelisted Verifications
repeated string whitelisted_origins = 3;
// Assertion Reward Rate
double assertion_reward_rate = 4;
// Encryption Reward Rate
double encryption_reward_rate = 5;
}
// PublicKey is the struct that represents a public key
message PublicKey {
option (amino.name) = "did/publickey";
option (amino.message_encoding) = "key_field";
option (gogoproto.goproto_stringer) = false;
// Key is the public key
bytes key = 1;
// Type is the type of the public key
string key_type = 2;
// DID is the DID of the public key
string did = 3;
}
+90
View File
@@ -0,0 +1,90 @@
syntax = "proto3";
package did.v1;
import "google/api/annotations.proto";
import "did/v1/genesis.proto";
option go_package = "github.com/onsonr/hway/x/did/types";
// Query provides defines the gRPC querier service.
service Query {
// Params queries all parameters of the module.
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/did/params";
}
// Exists queries if an id exists.
rpc PropertyExists(QueryExistsRequest) returns (QueryExistsResponse) {
option (google.api.http).get = "/did/exists/{kind}/{value}";
}
// Resolve queries the DID document by its id.
rpc ResolveIdentifier(QueryResolveRequest) returns (QueryResolveResponse) {
option (google.api.http).get = "/did/resolve/{id}";
}
// LoginOptions queries the PublicKeyCredentialAttestationOptions for starting a login flow.
rpc LoginOptions(QueryLoginOptionsRequest) returns (QueryLoginOptionsResponse) {
option (google.api.http).get = "/did/login/{origin}/{handle}/options";
}
// RegisterOptions queries the PublicKeyCredentialCreationOptions for starting a register flow.
rpc RegisterOptions(QueryRegisterOptionsRequest) returns (QueryRegisterOptionsResponse) {
option (google.api.http).get = "/did/register/{origin}/{handle}/options";
}
}
// QueryParamsRequest is the request type for the Query/Params RPC method.
message QueryParamsRequest {}
// QueryParamsResponse is the response type for the Query/Params RPC method.
message QueryParamsResponse {
// params defines the parameters of the module.
Params params = 1;
}
// QueryExistsRequest is the request type for the Query/Exists RPC method.
message QueryExistsRequest {
string kind = 1;
string value = 2;
}
// QueryExistsResponse is the response type for the Query/Exists RPC method.
message QueryExistsResponse {
bool exists = 1;
}
// QueryResolveRequest is the request type for the Query/Resolve RPC method.
message QueryResolveRequest {
string id = 1;
}
// QueryResolveResponse is the response type for the Query/Resolve RPC method.
message QueryResolveResponse {
// document is the DID document
string document = 1;
}
// QueryLoginOptionsRequest is the request type for the Query/LoginOptions RPC method.
message QueryLoginOptionsRequest {
string origin = 1;
string handle = 2;
}
// QueryLoginOptionsResponse is the response type for the Query/LoginOptions RPC method.
message QueryLoginOptionsResponse {
// options is the PublicKeyCredentialAttestationOptions
string options = 1;
}
// QueryRegisterOptionsRequest is the request type for the Query/RegisterOptions RPC method.
message QueryRegisterOptionsRequest {
string origin = 1;
string handle = 2;
}
// QueryRegisterOptionsResponse is the response type for the Query/RegisterOptions RPC method.
message QueryRegisterOptionsResponse {
string options = 1;
}
+102
View File
@@ -0,0 +1,102 @@
syntax = "proto3";
package did.v1;
option go_package = "github.com/onsonr/hway/x/did/types";
import "cosmos/orm/v1/orm.proto";
import "did/v1/genesis.proto";
// Attestation represents linked identifiers (e.g., Crypto Accounts, Github, Email, Phone)
message Attestation {
option (cosmos.orm.v1.table) = {
id: 1
primary_key: {fields: "id"}
};
// The unique identifier of the attestation
string id = 1;
// The type of the linked identifier (e.g., "crypto", "github", "email", "phone")
string key_type = 2;
// The value of the linked identifier
string value = 3;
// The proof or verification method for this attestation
string proof = 4;
// The controller of the attestation
string controller = 5;
}
// Controller represents a Sonr DWN Vault
message Controller {
option (cosmos.orm.v1.table) = {
id: 2
primary_key: {fields: "id"}
};
// The unique identifier of the controller
string id = 1;
// The DID of the controller
string did = 2;
// The public key of the controller
PublicKey public_key = 3;
// The vault address or identifier
string vault_cid = 4;
// Fingerprint is the Accumulator of discrete credential identifiers
bytes fingerprint = 5;
}
// Delegation represents IBC Account Controllers for various chains (e.g., ETH, BTC)
message Delegation {
option (cosmos.orm.v1.table) = {
id: 3
primary_key: {fields: "id"}
};
// The unique identifier of the delegation
string id = 1;
// The Decentralized Identifier of the delegated account
string did = 2;
// The chain type (e.g., "ETH", "BTC")
string chain_type = 3;
// The address on the target chain
string chain_address = 4;
// The controller DID
string controller_did = 5;
// The delegation proof or verification method
PublicKey public_key = 6;
// IBC Channel ID
uint64 channel_id = 7;
}
// Service represents a service in a DID Document
message Service {
option (cosmos.orm.v1.table) = {
id: 4
primary_key: {fields: "id"}
};
// The ID of the service
string id = 1;
// The type of the service
string service_type = 2;
// The service endpoint
string service_endpoint = 3;
// The controller DID of the service
string controller_did = 4;
}
+89
View File
@@ -0,0 +1,89 @@
syntax = "proto3";
package did.v1;
import "cosmos/msg/v1/msg.proto";
import "did/v1/genesis.proto";
import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
option go_package = "github.com/onsonr/hway/x/did/types";
// Msg defines the Msg service.
service Msg {
option (cosmos.msg.v1.service) = true;
// UpdateParams defines a governance operation for updating the parameters.
//
// Since: cosmos-sdk 0.47
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
// InitializeController initializes a controller with the given assertions, keyshares, and verifications.
rpc InitializeController(MsgInitializeController) returns (MsgInitializeControllerResponse);
// AuthenticateController asserts the given controller is the owner of the given address.
rpc AuthenticateController(MsgAuthenticateController) returns (MsgAuthenticateControllerResponse);
}
// MsgUpdateParams is the Msg/UpdateParams request type.
//
// Since: cosmos-sdk 0.47
message MsgUpdateParams {
option (cosmos.msg.v1.signer) = "authority";
// authority is the address of the governance account.
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// params defines the parameters to update.
//
// NOTE: All parameters must be supplied.
Params params = 2 [(gogoproto.nullable) = false];
}
// MsgUpdateParamsResponse defines the response structure for executing a
// MsgUpdateParams message.
//
// Since: cosmos-sdk 0.47
message MsgUpdateParamsResponse {}
// MsgInitializeController is the message type for the InitializeController RPC.
message MsgInitializeController {
option (cosmos.msg.v1.signer) = "authority";
// authority is the address of the governance account.
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// Assertions is the list of assertions to initialize the controller with.
repeated bytes assertions = 2;
// Keyshares is the list of keyshares to initialize the controller with.
repeated bytes keyshares = 3;
// Verifications is the list of verifications to initialize the controller with.
repeated bytes verifications = 4;
}
// MsgInitializeControllerResponse is the response type for the InitializeController RPC.
message MsgInitializeControllerResponse {
// Controller is the address of the initialized controller.
string controller = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}
// MsgAuthenticate is the message type for the Authenticate RPC.
message MsgAuthenticateController {
option (cosmos.msg.v1.signer) = "authority";
// authority is the address of the governance account.
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// Controller is the address of the controller to authenticate.
string controller = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// Address is the address to authenticate.
string address = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// Origin is the origin of the request in wildcard form.
string origin = 4;
}
// MsgAuthenticateControllerResponse is the response type for the Authenticate RPC.
message MsgAuthenticateControllerResponse {}