refactor: remove unused code related to whitelisted assets

This commit is contained in:
Prad Nukala
2024-09-27 20:58:05 -04:00
parent 88a3d9da1c
commit 92ff87cc2c
57 changed files with 25331 additions and 15090 deletions
+3 -7
View File
@@ -1,8 +1,8 @@
version: v1
name: buf.build/onsonr/sonr
deps:
- buf.build/cosmos/cosmos-sdk:9000fcc585a046c9881271d53dd40c34
- buf.build/cosmos/cosmos-proto:1935555c206d4afb9e94615dfd0fad31
- buf.build/cosmos/cosmos-sdk
- buf.build/cosmos/cosmos-proto
- buf.build/cosmos/gogo-proto
- buf.build/googleapis/googleapis
lint:
@@ -10,13 +10,9 @@ lint:
- DEFAULT
- COMMENTS
- FILE_LOWER_SNAKE_CASE
ignore:
except:
- UNARY_RPC
- COMMENT_FIELD
- SERVICE_SUFFIX
- PACKAGE_VERSION_SUFFIX
- RPC_REQUEST_STANDARD_NAME
- FILE_OPTIONS_REQUIRE_GO_PACKAGE
- FILE_OPTIONS_REQUIRE_GO_PACKAGE
- PACKAGE_VERSION_SUFFIX
- IMPORT_NO_PUBLIC
-55
View File
@@ -19,7 +19,6 @@ message Params {
option (gogoproto.goproto_stringer) = false;
// Whitelisted Assets
repeated AssetInfo whitelisted_assets = 1;
// Whitelisted Key Types
map<string, KeyInfo> allowed_public_keys = 2;
@@ -31,38 +30,6 @@ message Params {
repeated string attestation_formats = 4;
}
// AssetInfo defines the asset info
message AssetInfo {
// The coin type index for bip44 path
int64 index = 1;
// The hrp for bech32 address
string hrp = 2;
// The coin symbol
string symbol = 3;
// The coin name
string asset_type = 4;
// The name of the asset
string name = 5;
// The icon url
string icon_url = 6;
}
// Document defines a DID document
message Document {
string id = 1;
string controller = 2; // The DID of the controller
repeated string authentication = 3;
repeated string assertion_method = 4;
repeated string capability_delegation = 5;
repeated string capability_invocation = 6;
repeated string service = 7;
}
// KeyInfo defines information for accepted PubKey types
message KeyInfo {
string role = 1;
@@ -70,26 +37,4 @@ message KeyInfo {
string encoding = 3; // e.g., "hex", "base64", "multibase"
string curve = 4; // e.g., "P256", "P384", "P521", "X25519", "X448",
// "Ed25519", "Ed448", "secp256k1"
string type = 5; // e.g., "Octet", "Elliptic", "RSA", "Symmetric", "HMAC"
}
// PubKey defines a public key for a did
message PubKey {
string role = 1;
string algorithm = 2;
string encoding = 3;
string curve = 4;
string key_type = 5;
bytes raw = 6;
JWK jwk = 7;
// JWK represents a JSON Web Key
message JWK {
string kty = 1; // Key Type
string crv = 2; // Curve (for EC and OKP keys)
string x = 3; // X coordinate (for EC and OKP keys)
string y = 4; // Y coordinate (for EC keys)
string n = 5; // Modulus (for RSA keys)
string e = 6; // Exponent (for RSA keys)
}
}
+11
View File
@@ -38,3 +38,14 @@ message QueryResolveResponse {
// document is the DID document
Document document = 1;
}
// Document defines a DID document
message Document {
string id = 1;
string controller = 2; // The DID of the controller
repeated string authentication = 3;
repeated string assertion_method = 4;
repeated string capability_delegation = 5;
repeated string capability_invocation = 6;
repeated string service = 7;
}
+38 -12
View File
@@ -3,30 +3,31 @@ syntax = "proto3";
package did.v1;
import "cosmos/orm/v1/orm.proto";
import "did/v1/genesis.proto";
option go_package = "github.com/onsonr/sonr/x/did/types";
// Alias represents a DID alias
message Alias {
message Authentication {
option (cosmos.orm.v1.table) = {
id: 1
primary_key: {fields: "id"}
primary_key: {fields: "did"}
index: {
id: 1
fields: "subject,origin"
fields: "controller,subject"
unique: true
}
};
// The unique identifier of the alias
string id = 1;
// The unique identifier of the authentication
string did = 1;
// The alias of the DID
string subject = 2;
// The authentication of the DID
string controller = 2;
// Origin of the alias
string origin = 3;
// Origin of the authentication
string subject = 3;
// PubKey is the verification method
PubKey public_key = 4;
}
// Controller represents a Sonr DWN Vault
@@ -75,7 +76,7 @@ message Controller {
string btc_address = 5;
// PubKey is the verification method
bytes public_key = 6;
PubKey public_key = 6;
// Val Keyshare
string ks_val = 7;
@@ -128,3 +129,28 @@ message Verification {
// CapabilityInvocation)
string verification_type = 7;
}
// PubKey defines a public key for a did
message PubKey {
string role = 1;
string key_type = 2;
RawKey raw_key = 3;
JSONWebKey jwk = 4;
}
// JWK represents a JSON Web Key
message JSONWebKey {
string kty = 1; // Key Type
string crv = 2; // Curve (for EC and OKP keys)
string x = 3; // X coordinate (for EC and OKP keys)
string y = 4; // Y coordinate (for EC keys)
string n = 5; // Modulus (for RSA keys)
string e = 6; // Exponent (for RSA keys)
}
message RawKey {
string algorithm = 1;
string encoding = 2;
string curve = 3;
bytes key = 4;
}
-50
View File
@@ -13,10 +13,6 @@ option go_package = "github.com/onsonr/sonr/x/did/types";
service Msg {
option (cosmos.msg.v1.service) = true;
// AuthorizeService asserts the given controller is the owner of the given
// address.
rpc AuthorizeService(MsgAuthorizeService) returns (MsgAuthorizeServiceResponse);
// ExecuteTx executes a transaction on the Sonr Blockchain. It leverages
// Macaroon for verification.
rpc ExecuteTx(MsgExecuteTx) returns (MsgExecuteTxResponse);
@@ -25,10 +21,6 @@ service Msg {
// 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);
// UpdateParams defines a governance operation for updating the parameters.
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
}
@@ -85,48 +77,6 @@ message MsgExecuteTxResponse {
string tx_hash = 2;
}
// MsgAuthorizeService is the message type for the AuthorizeService RPC.
message MsgAuthorizeService {
option (cosmos.msg.v1.signer) = "controller";
// Controller is the address of the controller to authenticate.
string controller = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// Origin is the origin of the request in wildcard form.
string origin = 2;
// Permissions is the scope of the service.
map<string, string> permissions = 3;
// token is the macron token to authenticate the operation.
string token = 4;
}
// MsgAuthorizeServiceResponse is the response type for the AuthorizeService
// RPC.
message MsgAuthorizeServiceResponse {
bool success = 1;
string token = 2;
}
// MsgRegisterService is the message type for the RegisterService RPC.
message MsgRegisterService {
option (cosmos.msg.v1.signer) = "controller";
// 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.
Service service = 2;
}
// MsgRegisterServiceResponse is the response type for the RegisterService RPC.
message MsgRegisterServiceResponse {
bool success = 1;
string did = 2;
}
// MsgUpdateParams is the Msg/UpdateParams request type.
//
// Since: cosmos-sdk 0.47
+37 -3
View File
@@ -1,8 +1,8 @@
syntax = "proto3";
package macaroon.v1;
import "gogoproto/gogo.proto";
import "amino/amino.proto";
import "gogoproto/gogo.proto";
option go_package = "github.com/onsonr/sonr/x/macaroon/types";
@@ -18,5 +18,39 @@ message Params {
option (gogoproto.equal) = true;
option (gogoproto.goproto_stringer) = false;
bool some_value = 2;
}
// The list of methods
Methods methods = 1;
// The list of scopes
Scopes scopes = 2;
// The list of caveats
Caveats caveats = 3;
}
// Methods defines the available DID methods
message Methods {
option (amino.name) = "macaroon/methods";
option (gogoproto.equal) = true;
option (gogoproto.goproto_stringer) = false;
repeated string methods = 1;
}
// Scopes defines the set of scopes
message Scopes {
option (amino.name) = "macaroon/scopes";
option (gogoproto.equal) = true;
option (gogoproto.goproto_stringer) = false;
repeated string scopes = 1;
}
// Caveats defines the available caveats
message Caveats {
option (amino.name) = "macaroon/caveat";
option (gogoproto.equal) = true;
option (gogoproto.goproto_stringer) = false;
repeated string caveats = 1;
}
+38
View File
@@ -12,6 +12,16 @@ service Query {
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/macaroon/v1/params";
}
// RefreshToken refreshes a macaroon token as post authentication.
rpc RefreshToken(QueryRefreshTokenRequest) returns (QueryRefreshTokenResponse) {
option (google.api.http).post = "/macaroon/v1/refresh";
}
// ValidateToken validates a macaroon token as pre authentication.
rpc ValidateToken(QueryValidateTokenRequest) returns (QueryValidateTokenResponse) {
option (google.api.http).post = "/macaroon/v1/validate";
}
}
// QueryParamsRequest is the request type for the Query/Params RPC method.
@@ -22,3 +32,31 @@ message QueryParamsResponse {
// params defines the parameters of the module.
Params params = 1;
}
// QueryRefreshTokenRequest is the request type for the Query/RefreshToken RPC
// method.
message QueryRefreshTokenRequest {
// The macaroon token to refresh
string token = 1;
}
// QueryRefreshTokenResponse is the response type for the Query/RefreshToken
// RPC method.
message QueryRefreshTokenResponse {
// The macaroon token
string token = 1;
}
// QueryValidateTokenRequest is the request type for the Query/ValidateToken
// RPC method.
message QueryValidateTokenRequest {
// The macaroon token to validate
string token = 1;
}
// QueryValidateTokenResponse is the response type for the Query/ValidateToken
// RPC method.
message QueryValidateTokenResponse {
// The macaroon token
bool valid = 1;
}
+19 -9
View File
@@ -7,13 +7,23 @@ option go_package = "github.com/onsonr/sonr/x/macaroon/types";
// https://github.com/cosmos/cosmos-sdk/blob/main/orm/README.md
message ExampleData {
option (cosmos.orm.v1.table) = {
id: 1;
primary_key: { fields: "account" }
index: { id: 1 fields: "amount" }
};
message Grant {
option (cosmos.orm.v1.table) = {
id: 1
primary_key: {
fields: "id"
auto_increment: true
}
index: {
id: 1
fields: "subject,origin"
unique: true
}
};
bytes account = 1;
uint64 amount = 2;
}
uint64 id = 1;
string controller = 2;
string subject = 3;
string origin = 4;
int64 expiry_height = 5;
}
+30 -2
View File
@@ -2,9 +2,9 @@ syntax = "proto3";
package macaroon.v1;
import "cosmos/msg/v1/msg.proto";
import "macaroon/v1/genesis.proto";
import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";
import "macaroon/v1/genesis.proto";
option go_package = "github.com/onsonr/sonr/x/macaroon/types";
@@ -16,6 +16,10 @@ service Msg {
//
// Since: cosmos-sdk 0.47
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
// AuthorizeService asserts the given controller is the owner of the given
// address.
rpc AuthorizeService(MsgIssueMacaroon) returns (MsgIssueMacaroonResponse);
}
// MsgUpdateParams is the Msg/UpdateParams request type.
@@ -38,3 +42,27 @@ message MsgUpdateParams {
//
// Since: cosmos-sdk 0.47
message MsgUpdateParamsResponse {}
// MsgIssueMacaroon is the message type for the AuthorizeService RPC.
message MsgIssueMacaroon {
option (cosmos.msg.v1.signer) = "controller";
// Controller is the address of the controller to authenticate.
string controller = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// Origin is the origin of the request in wildcard form.
string origin = 2;
// Permissions is the scope of the service.
map<string, string> permissions = 3;
// token is the macron token to authenticate the operation.
string token = 4;
}
// MsgIssueMacaroonResponse is the response type for the AuthorizeService
// RPC.
message MsgIssueMacaroonResponse {
bool success = 1;
string token = 2;
}
+32 -3
View File
@@ -1,8 +1,8 @@
syntax = "proto3";
package oracle.v1;
import "gogoproto/gogo.proto";
import "amino/amino.proto";
import "gogoproto/gogo.proto";
option go_package = "github.com/onsonr/sonr/x/oracle/types";
@@ -18,5 +18,34 @@ message Params {
option (gogoproto.equal) = true;
option (gogoproto.goproto_stringer) = false;
bool some_value = 2;
}
Assets assets = 1;
}
message Assets {
option (amino.name) = "oracle/assets";
option (gogoproto.equal) = true;
option (gogoproto.goproto_stringer) = false;
repeated AssetInfo assets = 1;
}
// AssetInfo defines the asset info
message AssetInfo {
// The coin type index for bip44 path
int64 index = 1;
// The hrp for bech32 address
string hrp = 2;
// The coin symbol
string symbol = 3;
// The coin name
string asset_type = 4;
// The name of the asset
string name = 5;
// The icon url
string icon_url = 6;
}
+29 -9
View File
@@ -7,13 +7,33 @@ option go_package = "github.com/onsonr/sonr/x/oracle/types";
// https://github.com/cosmos/cosmos-sdk/blob/main/orm/README.md
message ExampleData {
option (cosmos.orm.v1.table) = {
id: 1;
primary_key: { fields: "account" }
index: { id: 1 fields: "amount" }
};
message Balance {
option (cosmos.orm.v1.table) = {
id: 1
primary_key: {fields: "account"}
index: {
id: 1
fields: "amount"
}
};
bytes account = 1;
uint64 amount = 2;
}
string account = 1;
uint64 amount = 2;
}
message Account {
option (cosmos.orm.v1.table) = {
id: 2
primary_key: {fields: "id"}
index: {
id: 1
fields: "account"
unique: true
}
};
uint64 id = 1;
string account = 2;
string chain = 3;
string network = 4;
}
+24 -6
View File
@@ -18,16 +18,34 @@ message Params {
option (gogoproto.equal) = true;
option (gogoproto.goproto_stringer) = false;
bool some_value = 2;
ServiceCategories categories = 1;
ServiceTypes types = 2;
}
message ServiceCategories {
option (amino.name) = "service/categories";
option (gogoproto.equal) = true;
option (gogoproto.goproto_stringer) = false;
repeated string categories = 1;
}
message ServiceTypes {
option (amino.name) = "service/types";
option (gogoproto.equal) = true;
option (gogoproto.goproto_stringer) = false;
repeated string types = 1;
}
// Service defines a Decentralized Service on the Sonr Blockchain
message Service {
string id = 1;
string service_type = 2;
string authority = 3;
string origin = 4;
string authority = 2;
string origin = 3;
string name = 4;
string description = 5;
map<string, string> service_endpoints = 6;
map<string, string> permissions = 7;
string category = 6;
repeated string tags = 7;
int64 expiry_height = 8;
}
+56 -9
View File
@@ -7,13 +7,60 @@ option go_package = "github.com/onsonr/sonr/x/service/types";
// https://github.com/cosmos/cosmos-sdk/blob/main/orm/README.md
message ExampleData {
option (cosmos.orm.v1.table) = {
id: 1;
primary_key: { fields: "account" }
index: { id: 1 fields: "amount" }
};
message Metadata {
option (cosmos.orm.v1.table) = {
id: 1
primary_key: {
fields: "id"
auto_increment: true
}
index: {
id: 1
fields: "origin"
unique: true
}
};
bytes account = 1;
uint64 amount = 2;
}
uint64 id = 1;
string origin = 2;
string name = 3;
string description = 4;
string category = 5;
URI icon = 6;
repeated string tags = 7;
}
// Profile represents a DID alias
message Profile {
option (cosmos.orm.v1.table) = {
id: 2
primary_key: {fields: "id"}
index: {
id: 1
fields: "subject,origin"
unique: true
}
};
// The unique identifier of the alias
string id = 1;
// The alias of the DID
string subject = 2;
// Origin of the alias
string origin = 3;
// Controller of the alias
string controller = 4;
}
message URI {
enum Protocol {
HTTPS = 0;
IPFS = 1;
}
Protocol protocol = 1;
string uri = 2;
}
+24 -2
View File
@@ -2,9 +2,9 @@ syntax = "proto3";
package service.v1;
import "cosmos/msg/v1/msg.proto";
import "service/v1/genesis.proto";
import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";
import "service/v1/genesis.proto";
option go_package = "github.com/onsonr/sonr/x/service/types";
@@ -16,6 +16,10 @@ service Msg {
//
// Since: cosmos-sdk 0.47
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
// 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.
@@ -38,3 +42,21 @@ message MsgUpdateParams {
//
// Since: cosmos-sdk 0.47
message MsgUpdateParamsResponse {}
// MsgRegisterService is the message type for the RegisterService RPC.
message MsgRegisterService {
option (cosmos.msg.v1.signer) = "controller";
// 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.
Service service = 2;
}
// MsgRegisterServiceResponse is the response type for the RegisterService RPC.
message MsgRegisterServiceResponse {
bool success = 1;
string did = 2;
}