Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 52 additions & 3 deletions proto/cross/core/auth/Auth.proto
Original file line number Diff line number Diff line change
@@ -1,26 +1,75 @@
syntax = "proto3";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Built with reference to the proto of the cross repository


import "gogoproto/gogo.proto";
import "google/protobuf/any.proto";
import "gogoproto/gogo.proto";
import "ibc/core/client/v1/client.proto";

option go_package = "github.com/datachainlab/cross/x/core/auth/types";
option (gogoproto.goproto_getters_all) = false;

message MsgSignTx {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

bytes txID = 1 [(gogoproto.casttype) = "github.com/datachainlab/cross/x/core/types.TxID"];
repeated bytes signers = 2 [(gogoproto.casttype) = "AccountID"];
ibc.core.client.v1.Height timeout_height = 3
[(gogoproto.moretags) = "yaml:\"timeout_height\"", (gogoproto.nullable) = false];
uint64 timeout_timestamp = 4
[(gogoproto.moretags) = "yaml:\"timeout_timestamp\""];
}

message MsgSignTxResponse {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

bool tx_auth_completed = 1;
string log = 2;
}

message MsgExtSignTx {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

bytes txID = 1 [(gogoproto.casttype) = "github.com/datachainlab/cross/x/core/types.TxID"];
repeated Account signers = 2 [(gogoproto.nullable) = false];
}

message MsgExtSignTxResponse {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
}

message QueryTxAuthStateRequest {
bytes txID = 1 [(gogoproto.casttype) = "github.com/datachainlab/cross/x/core/types.TxID"];
}

message QueryTxAuthStateResponse {
TxAuthState tx_auth_state = 1;
}

message Account {
option (gogoproto.equal) = true;
bytes id = 1 [(gogoproto.casttype) = "AccountID"];
AuthType auth_type = 2 [(gogoproto.nullable) = false];
}

message AuthType {
option (gogoproto.equal) = true;

enum AuthMode {
AUTH_MODE_UNSPECIFIED = 0;
AUTH_MODE_LOCAL = 1;
AUTH_MODE_CHANNEL = 2;
AUTH_MODE_EXTENSION = 3;
}
}

option (gogoproto.equal) = true;
AuthMode mode = 1;
google.protobuf.Any option = 2 [(gogoproto.nullable) = true]; // xcc or extension_type_url
}

message TxAuthState {
option (gogoproto.equal) = false;

repeated Account remaining_signers = 1 [(gogoproto.nullable) = false];
}
30 changes: 30 additions & 0 deletions src/core/IAuthenticator.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.20;

import {
AuthType,
MsgSignTx,
MsgSignTxResponse,
MsgExtSignTx,
MsgExtSignTxResponse,
QueryTxAuthStateRequest,
QueryTxAuthStateResponse
} from "../proto/cross/core/auth/Auth.sol";

interface IAuthenticator {
event TxSigned(address indexed signer, bytes32 indexed txId, AuthType.AuthMode method);

function signTx(MsgSignTx.Data calldata msg_) external returns (MsgSignTxResponse.Data memory);

// IBC signing is not supported
// function ibcSignTx(MsgIBCSignTx.Data calldata msg_)
// external
// returns (MsgIBCSignTxResponse.Data memory);

function extSignTx(MsgExtSignTx.Data calldata msg_) external returns (MsgExtSignTxResponse.Data memory);

function txAuthState(QueryTxAuthStateRequest.Data calldata req_)
external
view
returns (QueryTxAuthStateResponse.Data memory);
}
Loading