feat: add vault module

This commit is contained in:
Prad Nukala
2024-09-25 19:49:16 -04:00
parent 94f1a7e581
commit 607af1e76d
354 changed files with 22222 additions and 20921 deletions
+41 -43
View File
@@ -12,52 +12,25 @@ option go_package = "github.com/onsonr/sonr/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);
// AuthorizeService asserts the given controller is the owner of the given address.
// AuthorizeService asserts the given controller is the owner of the given
// address.
rpc AuthorizeService(MsgAuthorizeService) returns (MsgAuthorizeServiceResponse);
// AllocateVault assembles a sqlite3 database in a local directory and returns the CID of the database.
// this operation is called by services initiating a controller registration.
rpc AllocateVault(MsgAllocateVault) returns (MsgAllocateVaultResponse);
// ExecuteTx executes a transaction on the Sonr Blockchain. It leverages
// Macaroon for verification.
rpc ExecuteTx(MsgExecuteTx) returns (MsgExecuteTxResponse);
// RegisterController initializes a controller with the given authentication set, address, cid, publicKey, and user-defined alias.
// 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.
// 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);
}
// MsgAllocateVault is the message type for the AllocateVault RPC.
message MsgAllocateVault {
option (cosmos.msg.v1.signer) = "authority";
// authority is the address of the service account.
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// subject is a unique human-defined identifier to associate with the vault.
string subject = 2;
// origin is the origin of the request in wildcard form.
string origin = 3;
}
// MsgAllocateVaultResponse is the response type for the AllocateVault RPC.
message MsgAllocateVaultResponse {
// CID is the content identifier of the vault.
string cid = 1;
// ExpiryBlock is the block number at which the vault will expire.
int64 expiry_block = 2;
// RegistrationOptions is a json string of the PublicKeyCredentialCreationOptions for WebAuthn
string token = 3;
// IsLocalhost is a flag to indicate if the vault is localhost
bool localhost = 4;
// UpdateParams defines a governance operation for updating the parameters.
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
}
// MsgRegisterController is the message type for the InitializeController RPC.
@@ -73,13 +46,16 @@ message MsgRegisterController {
// 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.
// Verifications is the list of verifications to initialize the controller
// with.
repeated bytes verifications = 4;
}
// MsgRegisterControllerResponse is the response type for the InitializeController RPC.
// MsgRegisterControllerResponse is the response type for the
// InitializeController RPC.
message MsgRegisterControllerResponse {
// Success returns true if the specified cid is valid and not already encrypted.
// Success returns true if the specified cid is valid and not already
// encrypted.
bool success = 1;
// Controller is the address of the initialized controller.
@@ -89,6 +65,26 @@ message MsgRegisterControllerResponse {
map<string, string> accounts = 3;
}
// MsgExecuteTx is the message type for the ExecuteTx RPC.
message MsgExecuteTx {
option (cosmos.msg.v1.signer) = "controller";
// Controller is the address of the controller to authenticate.
string controller = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// Messages is the list of messages to execute.
map<string, bytes> messages = 2;
// MacaroonToken is the macaroon token to authenticate the operation.
string macaroon_token = 3;
}
// MsgExecuteTxResponse is the response type for the ExecuteTx RPC.
message MsgExecuteTxResponse {
bool success = 1;
string tx_hash = 2;
}
// MsgAuthorizeService is the message type for the AuthorizeService RPC.
message MsgAuthorizeService {
option (cosmos.msg.v1.signer) = "controller";
@@ -106,7 +102,8 @@ message MsgAuthorizeService {
string token = 4;
}
// MsgAuthorizeServiceResponse is the response type for the AuthorizeService RPC.
// MsgAuthorizeServiceResponse is the response type for the AuthorizeService
// RPC.
message MsgAuthorizeServiceResponse {
bool success = 1;
string token = 2;
@@ -119,7 +116,8 @@ message MsgRegisterService {
// authority is the address of the governance account.
string controller = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// origin is the origin of the request in wildcard form. Requires valid TXT record in DNS.
// origin is the origin of the request in wildcard form. Requires valid TXT
// record in DNS.
Service service = 2;
}