mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-02 17:31:39 +00:00
feat: add enums.pulsar.go file for PermissionScope enum (#4)
* feat: add enums.pulsar.go file for PermissionScope enum
* refactor: remove PERMISSION_SCOPE_IDENTIFIERS_ENS enum value
* feat: Add MsgRegisterService to handle service registration
The commit message for these changes would be:
feat: Add MsgRegisterService to handle service registration
This commit adds a new message type `MsgRegisterService` to the DID module's transaction proto file. This message allows users to register a new service with a given permission scope and origin URI. The domain must have a valid TXT record containing the public key.
The changes include:
- Adding the `MsgRegisterService` message type with fields for authority, origin URI, and scopes
- Adding the `MsgRegisterServiceResponse` message type to handle the response
- Updating the Msg service to include a new `RegisterService` RPC method
- Implementing the `RegisterService` method in the keeper
This feature allows users to register new services on the DID chain, which is an important part of the overall DID functionality.
* (no commit message provided)
* fix: Add ProveWitness and SyncVault RPCs
The commit message should be:
feat: Add ProveWitness and SyncVault RPCs
This change adds two new RPCs to the DID module:
1. ProveWitness: An operation to prove the controller has a valid property using ZK Accumulators.
2. SyncVault: Synchronizes the controller with the Vault Motr DWN WASM Wallet.
These new RPCs allow for more advanced DID management functionality.
* fix: Remove unused `Meta` message from `genesis.proto`
* refactor: Simplify the types and properties to keep a consistent structure for the blockchain
* (no commit message provided)
* {}
* feat: add Equal methods for AssetInfo and ChainInfo types
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
syntax = "proto3";
|
||||
package did.v1;
|
||||
|
||||
option go_package = "github.com/onsonr/hway/x/did/types";
|
||||
@@ -0,0 +1,24 @@
|
||||
syntax = "proto3";
|
||||
package did.v1;
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
import "amino/amino.proto";
|
||||
option go_package = "github.com/onsonr/hway/x/did/types";
|
||||
|
||||
// PermissionScope define the Capabilities Controllers can grant for Services
|
||||
enum PermissionScope {
|
||||
PERMISSION_SCOPE_UNSPECIFIED = 0;
|
||||
PERMISSION_SCOPE_PROFILE_NAME = 1;
|
||||
PERMISSION_SCOPE_IDENTIFIERS_EMAIL = 2;
|
||||
PERMISSION_SCOPE_IDENTIFIERS_PHONE = 3;
|
||||
PERMISSION_SCOPE_TRANSACTIONS_READ = 4;
|
||||
PERMISSION_SCOPE_TRANSACTIONS_WRITE = 5;
|
||||
PERMISSION_SCOPE_WALLETS_READ = 6;
|
||||
PERMISSION_SCOPE_WALLETS_CREATE = 7;
|
||||
PERMISSION_SCOPE_WALLETS_SUBSCRIBE = 8;
|
||||
PERMISSION_SCOPE_WALLETS_UPDATE = 9;
|
||||
PERMISSION_SCOPE_TRANSACTIONS_VERIFY = 10;
|
||||
PERMISSION_SCOPE_TRANSACTIONS_BROADCAST = 11;
|
||||
PERMISSION_SCOPE_ADMIN_USER = 12;
|
||||
PERMISSION_SCOPE_ADMIN_VALIDATOR = 13;
|
||||
}
|
||||
@@ -3,11 +3,13 @@ package did.v1;
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
import "amino/amino.proto";
|
||||
import "did/v1/types.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 defines all the parameters of the module.
|
||||
Params params = 1 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
@@ -24,49 +26,4 @@ message Params {
|
||||
repeated ChainInfo whitelisted_chains = 2;
|
||||
}
|
||||
|
||||
// Meta represents
|
||||
message Meta {
|
||||
option (amino.name) = "did/meta";
|
||||
option (gogoproto.equal) = true;
|
||||
option (gogoproto.goproto_stringer) = false;
|
||||
|
||||
// Key value data for the Property
|
||||
map<string, string> data = 1;
|
||||
}
|
||||
|
||||
|
||||
message AssetInfo {
|
||||
string denom = 1;
|
||||
string asset_type = 2;
|
||||
string origin_chain = 3;
|
||||
string origin_denom = 4;
|
||||
string origin_type = 5;
|
||||
string symbol = 6;
|
||||
int32 decimals = 7;
|
||||
string description = 8;
|
||||
string image = 9;
|
||||
string coinGeckoId = 10;
|
||||
bool enable = 11;
|
||||
string path = 12;
|
||||
string channel = 13;
|
||||
string port = 14;
|
||||
Meta counter_party = 15;
|
||||
}
|
||||
|
||||
message ChainInfo {
|
||||
string chain_id_cosmos = 1;
|
||||
string chain_name = 2;
|
||||
string symbol = 3;
|
||||
string bechAccountPrefix = 4;
|
||||
string bechValidatorPrefix = 5;
|
||||
string origin_genesis_time = 6;
|
||||
repeated Meta accountType = 7;
|
||||
repeated Meta grpc_endpoint = 8;
|
||||
repeated Meta lcd_endpoint = 9;
|
||||
Meta explorer = 10;
|
||||
string fee_base = 11;
|
||||
repeated string fee_rate = 12;
|
||||
int32 fee_init_gas_limit = 13;
|
||||
bool fee_isSimulable = 14;
|
||||
double simul_gas_multiply = 15;
|
||||
}
|
||||
|
||||
+55
-18
@@ -3,6 +3,7 @@ package did.v1;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "did/v1/genesis.proto";
|
||||
import "did/v1/types.proto";
|
||||
|
||||
option go_package = "github.com/onsonr/hway/x/did/types";
|
||||
|
||||
@@ -13,14 +14,29 @@ service Query {
|
||||
option (google.api.http).get = "/did/params";
|
||||
}
|
||||
|
||||
// Resolve queries the DID document by its id.
|
||||
rpc ResolveIdentifier(QueryResolveRequest) returns (QueryResolveResponse) {
|
||||
option (google.api.http).get = "/did/resolve/{id}";
|
||||
// Accounts returns associated wallet accounts with the DID.
|
||||
rpc Accounts(QueryAccountsRequest) returns (QueryAccountsResponse) {
|
||||
option (google.api.http).get = "/did/{did}/accounts";
|
||||
}
|
||||
|
||||
// Credentials returns associated credentials with the DID and Service Origin.
|
||||
rpc Credentials(QueryCredentialsRequest) returns (QueryCredentialsResponse) {
|
||||
option (google.api.http).get = "/did/{did}/{origin}/credentials";
|
||||
}
|
||||
|
||||
// Identities returns associated identity with the DID.
|
||||
rpc Identities(QueryIdentitiesRequest) returns (QueryIdentitiesResponse) {
|
||||
option (google.api.http).get = "/did/{did}/identities";
|
||||
}
|
||||
|
||||
// Resolve queries the DID document by its id.
|
||||
rpc Resolve(QueryResolveRequest) returns (QueryResolveResponse) {
|
||||
option (google.api.http).get = "/did/resolve/{did}";
|
||||
}
|
||||
|
||||
// LoginOptions queries the PublicKeyCredentialAttestationOptions for starting a login flow.
|
||||
rpc WitnessCredential(QueryWitnessCredentialRequest) returns (QueryWitnessCredentialResponse) {
|
||||
option (google.api.http).get = "/did/assertion/{id}/witness";
|
||||
// Service returns associated ServiceInfo for a given Origin
|
||||
rpc Service(QueryServiceRequest) returns (QueryServiceResponse) {
|
||||
option (google.api.http).get = "/did/service/{origin}";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,35 +49,56 @@ message QueryParamsResponse {
|
||||
Params params = 1;
|
||||
}
|
||||
|
||||
// QueryExistsRequest is the request type for the Query/Exists RPC method.
|
||||
message QueryExistsRequest {
|
||||
string kind = 1;
|
||||
string value = 2;
|
||||
// QueryAccountsRequest is the request type for the Query/Exists RPC method.
|
||||
message QueryAccountsRequest {
|
||||
string did = 1;
|
||||
}
|
||||
|
||||
// QueryExistsResponse is the response type for the Query/Exists RPC method.
|
||||
message QueryExistsResponse {
|
||||
// QueryAccountsResponse is the response type for the Query/Exists RPC method.
|
||||
message QueryAccountsResponse {
|
||||
bool exists = 1;
|
||||
}
|
||||
|
||||
// QueryCredentialsRequest is the request type for the Query/Exists RPC method.
|
||||
message QueryCredentialsRequest {
|
||||
string did = 1;
|
||||
string origin = 2;
|
||||
}
|
||||
|
||||
// QueryCredentialsResponse is the response type for the Query/Exists RPC method.
|
||||
message QueryCredentialsResponse {
|
||||
map<string, bytes> credentials = 1;
|
||||
}
|
||||
|
||||
// QueryIdentitiesRequest is the request type for the Query/Exists RPC method.
|
||||
message QueryIdentitiesRequest {
|
||||
string did = 1;
|
||||
}
|
||||
|
||||
// QueryIdentitiesResponse is the response type for the Query/Exists RPC method.
|
||||
message QueryIdentitiesResponse {
|
||||
bool exists = 1;
|
||||
repeated VerificationMethod verificationMethod = 2;
|
||||
}
|
||||
|
||||
// QueryResolveRequest is the request type for the Query/Resolve RPC method.
|
||||
message QueryResolveRequest {
|
||||
string id = 1;
|
||||
string did = 1;
|
||||
}
|
||||
|
||||
// QueryResolveResponse is the response type for the Query/Resolve RPC method.
|
||||
message QueryResolveResponse {
|
||||
// document is the DID document
|
||||
string document = 1;
|
||||
Document document = 1;
|
||||
}
|
||||
|
||||
// QueryLoginOptionsRequest is the request type for the Query/LoginOptions RPC method.
|
||||
message QueryWitnessCredentialRequest {
|
||||
string id = 1;
|
||||
// QueryServiceRequest is the request type for the Query/LoginOptions RPC method.
|
||||
message QueryServiceRequest {
|
||||
string origin = 1;
|
||||
}
|
||||
|
||||
// QueryLoginOptionsResponse is the response type for the Query/LoginOptions RPC method.
|
||||
message QueryWitnessCredentialResponse {
|
||||
message QueryServiceResponse {
|
||||
// options is the PublicKeyCredentialAttestationOptions
|
||||
string options = 1;
|
||||
}
|
||||
|
||||
@@ -5,13 +5,14 @@ option go_package = "github.com/onsonr/hway/x/did/types";
|
||||
|
||||
import "cosmos/orm/v1/orm.proto";
|
||||
import "did/v1/genesis.proto";
|
||||
import "did/v1/enums.proto";
|
||||
|
||||
// Aliases represents the `alsoKnownAs` property associated with a DID Controller
|
||||
message Aliases {
|
||||
option (cosmos.orm.v1.table) = {
|
||||
id: 1
|
||||
primary_key: {fields: "id"}
|
||||
index: { id: 1, fields: "handle", unique: true }
|
||||
index: { id: 1, fields: "subject", unique: true }
|
||||
};
|
||||
|
||||
// The unique identifier of the alias
|
||||
@@ -20,8 +21,8 @@ message Aliases {
|
||||
// Origin is the Alias provider
|
||||
string origin = 2;
|
||||
|
||||
// Handle is the user defined alias
|
||||
string handle = 3;
|
||||
// Subject is the user defined alias
|
||||
string subject = 3;
|
||||
|
||||
// Controller of the alias
|
||||
string controller = 4;
|
||||
@@ -146,9 +147,15 @@ message Service {
|
||||
// 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;
|
||||
string controller_did = 3;
|
||||
|
||||
// The domain name of the service
|
||||
string origin_uri = 4;
|
||||
|
||||
// The service endpoint
|
||||
map<string, string> service_endpoints = 5;
|
||||
|
||||
// Scopes is the Authorization Grants of the service
|
||||
repeated PermissionScope scopes = 6;
|
||||
}
|
||||
|
||||
+100
-30
@@ -3,6 +3,7 @@ syntax = "proto3";
|
||||
package did.v1;
|
||||
|
||||
import "cosmos/msg/v1/msg.proto";
|
||||
import "did/v1/enums.proto";
|
||||
import "did/v1/genesis.proto";
|
||||
import "gogoproto/gogo.proto";
|
||||
import "cosmos_proto/cosmos.proto";
|
||||
@@ -16,11 +17,20 @@ service Msg {
|
||||
// Since: cosmos-sdk 0.47
|
||||
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
|
||||
|
||||
// RegisterController initializes a controller with the given authentication set, address, cid, publicKey, and user-defined alias.
|
||||
rpc RegisterController(MsgInitializeController) returns (MsgInitializeControllerResponse);
|
||||
// Authenticate asserts the given controller is the owner of the given address.
|
||||
rpc Authenticate(MsgAuthenticate) returns (MsgAuthenticateResponse);
|
||||
|
||||
// AuthenticateController asserts the given controller is the owner of the given address.
|
||||
rpc AuthenticateController(MsgAuthenticateController) returns (MsgAuthenticateControllerResponse);
|
||||
// ProveWitness is an operation to prove the controller has a valid property using ZK Accumulators.
|
||||
rpc ProveWitness(MsgProveWitness) returns (MsgProveWitnessResponse);
|
||||
|
||||
// SyncVault synchronizes the controller with the Vault Motr DWN WASM Wallet.
|
||||
rpc SyncVault(MsgSyncVault) returns (MsgSyncVaultResponse);
|
||||
|
||||
// RegisterController initializes a controller with the given authentication set, address, cid, publicKey, and user-defined alias.
|
||||
rpc RegisterController(MsgRegisterController) returns (MsgRegisterControllerResponse);
|
||||
|
||||
// RegisterService initializes a Service with a given permission scope and URI. The domain must have a valid TXT record containing the public key.
|
||||
rpc RegisterService(MsgRegisterService) returns (MsgRegisterServiceResponse);
|
||||
}
|
||||
|
||||
// MsgUpdateParams is the Msg/UpdateParams request type.
|
||||
@@ -44,31 +54,8 @@ message MsgUpdateParams {
|
||||
// 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 {
|
||||
message MsgAuthenticate {
|
||||
option (cosmos.msg.v1.signer) = "authority";
|
||||
|
||||
// authority is the address of the governance account.
|
||||
@@ -84,6 +71,89 @@ message MsgAuthenticateController {
|
||||
string origin = 4;
|
||||
}
|
||||
|
||||
// MsgAuthenticateControllerResponse is the response type for the Authenticate RPC.
|
||||
message MsgAuthenticateControllerResponse {}
|
||||
// MsgAuthenticateResponse is the response type for the Authenticate RPC.
|
||||
message MsgAuthenticateResponse {}
|
||||
|
||||
// MsgProveWitness is the message type for the ProveWitness RPC.
|
||||
message MsgProveWitness {
|
||||
option (cosmos.msg.v1.signer) = "authority";
|
||||
|
||||
// authority is the address of the governance account.
|
||||
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
|
||||
// property is key to prove.
|
||||
string property = 2;
|
||||
|
||||
// Witness Value is the bytes of the witness.
|
||||
bytes witness = 3;
|
||||
}
|
||||
|
||||
// MsgProveWitnessResponse is the response type for the ProveWitness RPC.
|
||||
message MsgProveWitnessResponse {
|
||||
bool success = 1;
|
||||
string property = 2;
|
||||
}
|
||||
|
||||
// MsgSyncVault is the message type for the SyncVault RPC.
|
||||
message MsgSyncVault {
|
||||
option (cosmos.msg.v1.signer) = "controller";
|
||||
|
||||
// controller is the address of the controller to sync.
|
||||
string controller = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
|
||||
// cid is the IPFS content identifier.
|
||||
string cid = 2;
|
||||
|
||||
// Macroon is the public token to authenticate the operation.
|
||||
bytes macron = 3;
|
||||
}
|
||||
|
||||
// MsgSyncVaultResponse is the response type for the SyncVault RPC.
|
||||
message MsgSyncVaultResponse {
|
||||
bool success = 1;
|
||||
}
|
||||
|
||||
// MsgRegisterController is the message type for the InitializeController RPC.
|
||||
message MsgRegisterController {
|
||||
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;
|
||||
}
|
||||
|
||||
// MsgRegisterControllerResponse is the response type for the InitializeController RPC.
|
||||
message MsgRegisterControllerResponse {
|
||||
// Controller is the address of the initialized controller.
|
||||
string controller = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
|
||||
// Accounts are a Address Map and Supported coin Denoms for the controller
|
||||
map<string, string> accounts = 2;
|
||||
}
|
||||
|
||||
// MsgRegisterService is the message type for the RegisterService RPC.
|
||||
message MsgRegisterService {
|
||||
option (cosmos.msg.v1.signer) = "authority";
|
||||
|
||||
// authority is the address of the governance account.
|
||||
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
|
||||
// origin is the origin of the request in wildcard form.
|
||||
string origin_uri = 2;
|
||||
|
||||
// PermissionScope is the scope of the service.
|
||||
repeated PermissionScope scopes = 3;
|
||||
}
|
||||
|
||||
// MsgRegisterServiceResponse is the response type for the RegisterService RPC.
|
||||
message MsgRegisterServiceResponse {
|
||||
bool success = 1;
|
||||
}
|
||||
|
||||
@@ -3,15 +3,56 @@ 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";
|
||||
|
||||
// AssetInfo defines the asset info
|
||||
message AssetInfo {
|
||||
string id = 1;
|
||||
string denom = 2;
|
||||
string symbol = 3;
|
||||
string asset_type = 4;
|
||||
string origin_chain = 5;
|
||||
string origin_denom = 6;
|
||||
int32 decimals = 7;
|
||||
string description = 8;
|
||||
string image_url = 9;
|
||||
string coingecko_id = 10;
|
||||
bool is_enabled = 11;
|
||||
string ibc_path = 12;
|
||||
string ibc_channel = 13;
|
||||
string ibc_port = 14;
|
||||
}
|
||||
|
||||
// BaseDocument defines a DID document
|
||||
message BaseDocument {
|
||||
// ChainInfo defines the chain info
|
||||
message ChainInfo {
|
||||
string id = 1;
|
||||
string chain_id = 2;
|
||||
string name = 3;
|
||||
string symbol = 4;
|
||||
string bech32_prefix = 5;
|
||||
string genesis_time = 6;
|
||||
repeated Endpoint grpc_endpoints = 7;
|
||||
repeated Endpoint rest_endpoints = 8;
|
||||
ExplorerInfo explorer = 9;
|
||||
FeeInfo fee_info = 10;
|
||||
}
|
||||
|
||||
// Credential defines a WebAuthn credential
|
||||
message Credential {
|
||||
string id = 1;
|
||||
string credential_type = 2;
|
||||
bytes credential_id = 3;
|
||||
repeated string transport = 4;
|
||||
string attestation_type = 5;
|
||||
string display_name = 6;
|
||||
string controller = 7;
|
||||
}
|
||||
|
||||
// Document defines a DID document
|
||||
message Document {
|
||||
string id = 1;
|
||||
repeated VerificationMethod verification_methods = 2;
|
||||
repeated string authentication = 4;
|
||||
@@ -20,6 +61,44 @@ message BaseDocument {
|
||||
repeated string capability_invocation = 8;
|
||||
}
|
||||
|
||||
// Endpoint defines an endpoint
|
||||
message Endpoint {
|
||||
string url = 1;
|
||||
bool is_primary = 2;
|
||||
}
|
||||
|
||||
// ExplorerInfo defines the explorer info
|
||||
message ExplorerInfo {
|
||||
string name = 1;
|
||||
string url = 2;
|
||||
}
|
||||
|
||||
// FeeInfo defines a fee info
|
||||
message FeeInfo {
|
||||
string base_denom = 1;
|
||||
repeated string fee_rates = 2;
|
||||
int32 init_gas_limit = 3;
|
||||
bool is_simulable = 4;
|
||||
double gas_multiply = 5;
|
||||
}
|
||||
|
||||
// Identity defines an associated profile for a did subject
|
||||
message Identity {
|
||||
string id = 1;
|
||||
string subject = 2;
|
||||
string controller = 3;
|
||||
repeated Credential credentials = 4;
|
||||
repeated VerificationMethod verification_methods = 5;
|
||||
}
|
||||
|
||||
// PubKey defines a public key for a did
|
||||
message PubKey {
|
||||
string id = 1;
|
||||
bytes key = 2;
|
||||
string key_type = 3;
|
||||
string controller = 4;
|
||||
}
|
||||
|
||||
// VerificationMethod defines a verification method
|
||||
message VerificationMethod {
|
||||
string id = 1;
|
||||
|
||||
Reference in New Issue
Block a user