mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-04 10:21:40 +00:00
refactor(proto): remove macaroon proto
This commit is contained in:
@@ -104,6 +104,37 @@ message Controller {
|
||||
int64 creation_block = 9;
|
||||
}
|
||||
|
||||
// Grant is a Grant message type.
|
||||
message Grant {
|
||||
option (cosmos.orm.v1.table) = {
|
||||
id : 1
|
||||
primary_key : {fields : "id" auto_increment : true}
|
||||
index : {id : 1 fields : "subject,origin" unique : true}
|
||||
};
|
||||
|
||||
uint64 id = 1;
|
||||
string controller = 2;
|
||||
string subject = 3;
|
||||
string origin = 4;
|
||||
int64 expiry_height = 5;
|
||||
}
|
||||
|
||||
// Macaroon is a Macaroon message type.
|
||||
message Macaroon {
|
||||
option (cosmos.orm.v1.table) = {
|
||||
id : 2
|
||||
primary_key : {fields : "id" auto_increment : true}
|
||||
index : {id : 1 fields : "subject,origin" unique : true}
|
||||
};
|
||||
|
||||
uint64 id = 1;
|
||||
string controller = 2;
|
||||
string subject = 3;
|
||||
string origin = 4;
|
||||
int64 expiry_height = 5;
|
||||
string macaroon = 6;
|
||||
}
|
||||
|
||||
// Verification represents a verification method
|
||||
message Verification {
|
||||
option (cosmos.orm.v1.table) = {
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package onsonr.sonr.macaroon.module.v1;
|
||||
|
||||
import "cosmos/app/v1alpha1/module.proto";
|
||||
|
||||
// Module is the app config object of the module.
|
||||
// Learn more: https://docs.cosmos.network/main/building-modules/depinject
|
||||
message Module {
|
||||
option (cosmos.app.v1alpha1.module) = {go_import: "github.com/onsonr/sonr/x/macaroon"};
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
syntax = "proto3";
|
||||
package macaroon.v1;
|
||||
|
||||
import "amino/amino.proto";
|
||||
import "did/v1/tx.proto";
|
||||
import "gogoproto/gogo.proto";
|
||||
|
||||
option go_package = "github.com/onsonr/sonr/x/macaroon/types";
|
||||
|
||||
// GenesisState defines the module genesis state
|
||||
message GenesisState {
|
||||
// Params defines all the parameters of the module.
|
||||
Params params = 1 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
// Params defines the set of module parameters.
|
||||
message Params {
|
||||
option (amino.name) = "macaroon/params";
|
||||
option (gogoproto.equal) = true;
|
||||
option (gogoproto.goproto_stringer) = false;
|
||||
|
||||
// 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;
|
||||
string default = 1;
|
||||
repeated string supported = 2;
|
||||
}
|
||||
|
||||
// Scopes defines the set of scopes
|
||||
message Scopes {
|
||||
option (amino.name) = "macaroon/scopes";
|
||||
option (gogoproto.equal) = true;
|
||||
string base = 1;
|
||||
repeated string supported = 2;
|
||||
}
|
||||
|
||||
// Caveats defines the available caveats
|
||||
message Caveats {
|
||||
option (amino.name) = "macaroon/caveats";
|
||||
option (gogoproto.equal) = true;
|
||||
|
||||
repeated Caveat supported_first_party = 1;
|
||||
repeated Caveat supported_third_party = 2;
|
||||
}
|
||||
|
||||
// Caveat defines the caveat
|
||||
message Caveat {
|
||||
repeated string scopes = 1;
|
||||
string caveat = 2;
|
||||
string description = 3;
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
syntax = "proto3";
|
||||
package macaroon.v1;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "macaroon/v1/genesis.proto";
|
||||
|
||||
option go_package = "github.com/onsonr/sonr/x/macaroon/types";
|
||||
|
||||
// Query provides defines the gRPC querier service.
|
||||
service Query {
|
||||
// Params queries all parameters of the module.
|
||||
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.
|
||||
message QueryParamsRequest {}
|
||||
|
||||
// QueryParamsResponse is the response type for the Query/Params RPC method.
|
||||
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;
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
syntax = "proto3";
|
||||
package macaroon.v1;
|
||||
|
||||
import "cosmos/orm/v1/orm.proto";
|
||||
|
||||
option go_package = "github.com/onsonr/sonr/x/macaroon/types";
|
||||
|
||||
// https://github.com/cosmos/cosmos-sdk/blob/main/orm/README.md
|
||||
|
||||
// Grant is a Grant message type.
|
||||
message Grant {
|
||||
option (cosmos.orm.v1.table) = {
|
||||
id : 1
|
||||
primary_key : {fields : "id" auto_increment : true}
|
||||
index : {id : 1 fields : "subject,origin" unique : true}
|
||||
};
|
||||
|
||||
uint64 id = 1;
|
||||
string controller = 2;
|
||||
string subject = 3;
|
||||
string origin = 4;
|
||||
int64 expiry_height = 5;
|
||||
}
|
||||
|
||||
// Macaroon is a Macaroon message type.
|
||||
message Macaroon {
|
||||
option (cosmos.orm.v1.table) = {
|
||||
id : 2
|
||||
primary_key : {fields : "id" auto_increment : true}
|
||||
index : {id : 1 fields : "subject,origin" unique : true}
|
||||
};
|
||||
|
||||
uint64 id = 1;
|
||||
string controller = 2;
|
||||
string subject = 3;
|
||||
string origin = 4;
|
||||
int64 expiry_height = 5;
|
||||
string macaroon = 6;
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
syntax = "proto3";
|
||||
package macaroon.v1;
|
||||
|
||||
import "cosmos/msg/v1/msg.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";
|
||||
|
||||
// Msg defines the Msg service.
|
||||
service Msg {
|
||||
option (cosmos.msg.v1.service) = true;
|
||||
|
||||
// UpdateParams defines a governance operation for updating the parameters.
|
||||
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
|
||||
|
||||
// IssueMacaroon asserts the given controller is the owner of the given
|
||||
// address.
|
||||
rpc IssueMacaroon(MsgIssueMacaroon) returns (MsgIssueMacaroonResponse);
|
||||
}
|
||||
|
||||
// MsgUpdateParams is the Msg/UpdateParams request type.
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
message MsgUpdateParams {
|
||||
option (cosmos.msg.v1.signer) = "authority";
|
||||
|
||||
// authority is the address of the governance account.
|
||||
string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
|
||||
|
||||
// params defines the parameters to update.
|
||||
//
|
||||
// NOTE: All parameters must be supplied.
|
||||
Params params = 2 [ (gogoproto.nullable) = false ];
|
||||
}
|
||||
|
||||
// MsgUpdateParamsResponse defines the response structure for executing a
|
||||
// MsgUpdateParams message.
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
message MsgUpdateParamsResponse {}
|
||||
|
||||
// MsgIssueMacaroon is the message type for the IssueMacaroon 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 IssueMacaroon
|
||||
// RPC.
|
||||
message MsgIssueMacaroonResponse {
|
||||
bool success = 1;
|
||||
string token = 2;
|
||||
}
|
||||
Reference in New Issue
Block a user