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
+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;
}