20#include <xrpld/app/main/Application.h> 
   21#include <xrpld/rpc/Context.h> 
   22#include <xrpld/rpc/detail/RPCHelpers.h> 
   24#include <xrpl/basics/StringUtilities.h> 
   25#include <xrpl/ledger/ReadView.h> 
   26#include <xrpl/protocol/ErrorCodes.h> 
   27#include <xrpl/protocol/PayChan.h> 
   28#include <xrpl/protocol/RPCErr.h> 
   29#include <xrpl/protocol/jss.h> 
   50    auto const& params(context.
params);
 
   51    for (
auto const& p : {jss::channel_id, jss::amount})
 
   52        if (!params.isMember(p))
 
   58    if (!params.isMember(jss::key_type) && !params.isMember(jss::secret))
 
   67        "ripple::doChannelAuthorize : valid keyPair or an error");
 
   75    if (!channelId.
parseHex(params[jss::channel_id].asString()))
 
   79        ? 
to_uint64(params[jss::amount].asString())
 
   92        auto const buf = 
sign(pk, sk, msg.
slice());
 
   93        result[jss::signature] = 
strHex(buf);
 
 
  115    auto const& params(context.
params);
 
  117         {jss::public_key, jss::channel_id, jss::amount, jss::signature})
 
  118        if (!params.isMember(p))
 
  123        std::string const strPk = params[jss::public_key].asString();
 
  139    if (!channelId.
parseHex(params[jss::channel_id].asString()))
 
  143        ? 
to_uint64(params[jss::amount].asString())
 
  151    auto sig = 
strUnHex(params[jss::signature].asString());
 
  152    if (!sig || !sig->size())
 
  159    result[jss::signature_verified] =
 
 
virtual Config & config()=0
 
Slice slice() const noexcept
 
constexpr bool parseHex(std::string_view sv)
Parse a hex string into a base_uint.
 
bool contains_error(Json::Value const &json)
Returns true if the json contains an rpc error specification.
 
Json::Value make_error(error_code_i code)
Returns a new json object that reflects the error code.
 
Json::Value missing_field_error(std::string const &name)
 
std::optional< std::pair< PublicKey, SecretKey > > keypairForSignature(Json::Value const ¶ms, Json::Value &error, unsigned int apiVersion)
 
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
 
Json::Value doChannelVerify(RPC::JsonContext &)
 
std::optional< Blob > strUnHex(std::size_t strSize, Iterator begin, Iterator end)
 
Json::Value doChannelAuthorize(RPC::JsonContext &)
 
@ rpcCHANNEL_AMT_MALFORMED
 
bool verify(PublicKey const &publicKey, Slice const &m, Slice const &sig, bool mustBeFullyCanonical=true) noexcept
Verify a signature on a message.
 
std::optional< std::uint64_t > to_uint64(std::string const &s)
 
Json::Value rpcError(int iError)
 
void serializePayChanAuthorization(Serializer &msg, uint256 const &key, XRPAmount const &amt)
 
Buffer sign(PublicKey const &pk, SecretKey const &sk, Slice const &message)
Generate a signature for a message.
 
std::optional< KeyType > publicKeyType(Slice const &slice)
Returns the type of public key.
 
std::string strHex(FwdIt begin, FwdIt end)
 
std::enable_if_t< std::is_same< T, char >::value||std::is_same< T, unsigned char >::value, Slice > makeSlice(std::array< T, N > const &a)