mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-03 01:41:44 +00:00
feat: add vault module
This commit is contained in:
@@ -35,17 +35,11 @@ message Params {
|
||||
// Whitelisted Key Types
|
||||
map<string, KeyInfo> allowed_public_keys = 2;
|
||||
|
||||
// IpfsActive is a flag to enable/disable ipfs
|
||||
bool ipfs_active = 3;
|
||||
|
||||
// Localhost Registration Enabled
|
||||
bool localhost_registration_enabled = 4;
|
||||
|
||||
// ConveyancePreference defines the conveyance preference
|
||||
string conveyance_preference = 5;
|
||||
string conveyance_preference = 3;
|
||||
|
||||
// AttestationFormats defines the attestation formats
|
||||
repeated string attestation_formats = 6;
|
||||
repeated string attestation_formats = 4;
|
||||
}
|
||||
|
||||
// AssetInfo defines the asset info
|
||||
@@ -85,7 +79,8 @@ message KeyInfo {
|
||||
string role = 1;
|
||||
string algorithm = 2; // e.g., "ES256", "EdDSA", "ES256K"
|
||||
string encoding = 3; // e.g., "hex", "base64", "multibase"
|
||||
string curve = 4; // e.g., "P256", "P384", "P521", "X25519", "X448", "Ed25519", "Ed448", "secp256k1"
|
||||
string curve = 4; // e.g., "P256", "P384", "P521", "X25519", "X448",
|
||||
// "Ed25519", "Ed448", "secp256k1"
|
||||
string type = 5; // e.g., "Octet", "Elliptic", "RSA", "Symmetric", "HMAC"
|
||||
}
|
||||
|
||||
|
||||
@@ -17,11 +17,6 @@ service Query {
|
||||
rpc Resolve(QueryRequest) returns (QueryResolveResponse) {
|
||||
option (google.api.http).get = "/did/{did}";
|
||||
}
|
||||
|
||||
// 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";
|
||||
}
|
||||
}
|
||||
|
||||
// Queryequest is the request type for the Query/Params RPC method.
|
||||
@@ -32,14 +27,6 @@ message QueryRequest {
|
||||
string asset = 4;
|
||||
}
|
||||
|
||||
// QueryResolveResponse is the response type for the Query/Resolve RPC method.
|
||||
message QueryResponse {
|
||||
bool success = 1;
|
||||
string query = 2;
|
||||
Document document = 3;
|
||||
Params params = 5;
|
||||
}
|
||||
|
||||
// QueryParamsResponse is the response type for the Query/Params RPC method.
|
||||
message QueryParamsResponse {
|
||||
// params defines the parameters of the module.
|
||||
@@ -51,13 +38,3 @@ message QueryResolveResponse {
|
||||
// document is the DID document
|
||||
Document document = 1;
|
||||
}
|
||||
|
||||
// SyncRequest is the request type for the Sync RPC method.
|
||||
message SyncRequest {
|
||||
string did = 1;
|
||||
}
|
||||
|
||||
// SyncResponse is the response type for the Sync RPC method.
|
||||
message SyncResponse {
|
||||
bool success = 1;
|
||||
}
|
||||
|
||||
+20
-24
@@ -33,7 +33,10 @@ message Alias {
|
||||
message Controller {
|
||||
option (cosmos.orm.v1.table) = {
|
||||
id: 2
|
||||
primary_key: {fields: "id"}
|
||||
primary_key: {
|
||||
fields: "number"
|
||||
auto_increment: true
|
||||
}
|
||||
index: {
|
||||
id: 1
|
||||
fields: "sonr_address"
|
||||
@@ -51,49 +54,41 @@ message Controller {
|
||||
}
|
||||
index: {
|
||||
id: 4
|
||||
fields: "vault_cid"
|
||||
unique: true
|
||||
}
|
||||
index: {
|
||||
id: 5
|
||||
fields: "status,vault_cid"
|
||||
fields: "did"
|
||||
unique: true
|
||||
}
|
||||
};
|
||||
|
||||
// The unique identifier of the controller
|
||||
string id = 1;
|
||||
uint64 number = 1;
|
||||
|
||||
// The unique identifier of the controller
|
||||
string did = 2;
|
||||
|
||||
// The DID of the controller
|
||||
string sonr_address = 2;
|
||||
string sonr_address = 3;
|
||||
|
||||
// The DID of the controller
|
||||
string eth_address = 3;
|
||||
string eth_address = 4;
|
||||
|
||||
// The DID of the controller
|
||||
string btc_address = 4;
|
||||
|
||||
// Aliases of the controller
|
||||
repeated string aliases = 5;
|
||||
string btc_address = 5;
|
||||
|
||||
// PubKey is the verification method
|
||||
PubKey public_key = 6;
|
||||
bytes public_key = 6;
|
||||
|
||||
// The vault address or identifier
|
||||
string vault_cid = 7;
|
||||
|
||||
// The Authentications of the controller
|
||||
repeated string authentication = 8;
|
||||
// Val Keyshare
|
||||
string ks_val = 7;
|
||||
|
||||
// The Status of the claims for the controller
|
||||
string status = 9;
|
||||
bool claimed = 8;
|
||||
}
|
||||
|
||||
// Verification reprsents a method of verifying membership in a DID
|
||||
message Verification {
|
||||
option (cosmos.orm.v1.table) = {
|
||||
id: 4
|
||||
primary_key: {fields: "id"}
|
||||
primary_key: {fields: "did"}
|
||||
index: {
|
||||
id: 1
|
||||
fields: "issuer,subject"
|
||||
@@ -112,7 +107,7 @@ message Verification {
|
||||
};
|
||||
|
||||
// The unique identifier of the verification
|
||||
string id = 1;
|
||||
string did = 1;
|
||||
|
||||
// The controller of the verification
|
||||
string controller = 2;
|
||||
@@ -129,6 +124,7 @@ message Verification {
|
||||
// The public key of the verification
|
||||
PubKey public_key = 6;
|
||||
|
||||
// The Verification Type (Authentication, Assertion, CapabilityDelegation, CapabilityInvocation)
|
||||
// The Verification Type (Authentication, Assertion, CapabilityDelegation,
|
||||
// CapabilityInvocation)
|
||||
string verification_type = 7;
|
||||
}
|
||||
|
||||
+41
-43
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user