authz
The authz
module is responsible for the authorization for accounts to perform actions on behalf of other accounts and enables a granter to grant authorizations to a grantee that allows the grantee to execute messages on behalf of the granter. Authorizations must be granted for a particular Msg service method one by one using an implementation of the Authorization interface.
For more information, visit https://docs.cosmos.network/main/modules/authz/
Message Types
Msg
defines the authz
Msg service.
_16 // Grant grants the provided authorization to the grantee on the granter's
_16 // account with the provided expiration time. If there is already a grant
_16 // for the given (granter, grantee, Authorization) triple, then the grant
_16 // will be overwritten.
_16 rpc Grant(MsgGrant) returns (MsgGrantResponse);
_16 // Exec attempts to execute the provided messages using
_16 // authorizations granted to the grantee. Each message should have only
_16 // one signer corresponding to the granter of the authorization.
_16 rpc Exec(MsgExec) returns (MsgExecResponse);
_16 // Revoke revokes any authorization corresponding to the provided method name on the
_16 // granter's account that has been granted to the grantee.
_16 rpc Revoke(MsgRevoke) returns (MsgRevokeResponse);
MsgGrant
MsgGrant
is a request type for Grant method. It declares authorization to the grantee on behalf of the granter with the provided expiration time.
_8 option (cosmos.msg.v1.signer) = "granter";
_8 string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
_8 string grantee = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
_8 cosmos.authz.v1beta1.Grant grant = 3 [(gogoproto.nullable) = false];
MsgGrantResponse
MsgGrantResponse
defines the Msg/MsgGrant
response type.
_1message MsgGrantResponse {}
MsgExec
MsgExec
attempts to execute the provided messages using authorizations granted to the grantee. Each message should have only one signer corresponding to the granter of the authorization.
_9 option (cosmos.msg.v1.signer) = "grantee";
_9 string grantee = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
_9 // Authorization Msg requests to execute. Each msg must implement Authorization interface
_9 // The x/authz will try to find a grant matching (msg.signers[0], grantee, MsgTypeURL(msg))
_9 // triple and validate it.
_9 repeated google.protobuf.Any msgs = 2 [(cosmos_proto.accepts_interface) = "sdk.Msg, authz.Authorization"];
MsgExecResponse
MsgExecResponse
defines the Msg/MsgExecResponse
response type.
_3message MsgExecResponse {
_3 repeated bytes results = 1;
MsgRevoke
MsgRevoke
revokes any authorization with the provided sdk.Msg type on the granter's account with that has been granted to the grantee.
_7 option (cosmos.msg.v1.signer) = "granter";
_7 string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
_7 string grantee = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
_7 string msg_type_url = 3;
MsgRevokeResponse
MsgRevokeResponse
defines the Msg/MsgRevokeResponse
response type.
_1message MsgRevokeResponse {}
Queries
Query defines the gRPC querier service.
_20 // Returns list of `Authorization`, granted to the grantee by the granter.
_20 rpc Grants(QueryGrantsRequest) returns (QueryGrantsResponse) {
_20 option (google.api.http).get = "/cosmos/authz/v1beta1/grants";
_20 // GranterGrants returns list of `GrantAuthorization`, granted by granter.
_20 // Since: cosmos-sdk 0.46
_20 rpc GranterGrants(QueryGranterGrantsRequest) returns (QueryGranterGrantsResponse) {
_20 option (google.api.http).get = "/cosmos/authz/v1beta1/grants/granter/{granter}";
_20 // GranteeGrants returns a list of `GrantAuthorization` by grantee.
_20 // Since: cosmos-sdk 0.46
_20 rpc GranteeGrants(QueryGranteeGrantsRequest) returns (QueryGranteeGrantsResponse) {
_20 option (google.api.http).get = "/cosmos/authz/v1beta1/grants/grantee/{grantee}";
QueryGrantsRequest
QueryGrantsRequest
is the request type for the Query/Grants
RPC method.
_8message QueryGrantsRequest {
_8 string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
_8 string grantee = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
_8 // Optional, msg_type_url, when set, will query only grants matching given msg type.
_8 string msg_type_url = 3;
_8 // pagination defines an pagination for the request.
_8 cosmos.base.query.v1beta1.PageRequest pagination = 4;
QueryGrantsResponse
QueryGrantsResponse
is the response type for the Query/Authorizations
RPC method.
_6message QueryGrantsResponse {
_6 // authorizations is a list of grants granted for grantee by granter.
_6 repeated Grant grants = 1;
_6 // pagination defines an pagination for the response.
_6 cosmos.base.query.v1beta1.PageResponse pagination = 2;
QueryGranterGrantsRequest
QueryGranterGrantsRequest
is the request type for the Query/GranterGrants
RPC method.
_6message QueryGranterGrantsRequest {
_6 string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
_6 // pagination defines an pagination for the request.
_6 cosmos.base.query.v1beta1.PageRequest pagination = 2;
QueryGranterGrantsResponse
QueryGranterGrantsResponse
is the response type for the Query/GranterGrants
RPC method.
_6message QueryGranterGrantsResponse {
_6 // grants is a list of grants granted by the granter.
_6 repeated GrantAuthorization grants = 1;
_6 // pagination defines an pagination for the response.
_6 cosmos.base.query.v1beta1.PageResponse pagination = 2;
QueryGranteeGrantsRequest
QueryGranteeGrantsRequest
is the request type for the Query/IssuedGrants
RPC method.
_6message QueryGranteeGrantsRequest {
_6 string grantee = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
_6 // pagination defines an pagination for the request.
_6 cosmos.base.query.v1beta1.PageRequest pagination = 2;
QueryGranteeGrantsResponse
QueryGranteeGrantsResponse
is the response type for the Query/GranteeGrants RPC method.
_6message QueryGranteeGrantsResponse {
_6 // grants is a list of grants granted to the grantee.
_6 repeated GrantAuthorization grants = 1;
_6 // pagination defines an pagination for the response.
_6 cosmos.base.query.v1beta1.PageResponse pagination = 2;