Scorum
atomicswap_helper.hpp
Go to the documentation of this file.
1 #pragma once
2 
4 
5 #include <string>
6 #include <fc/crypto/sha256.hpp>
7 
8 namespace scorum {
9 namespace protocol {
10 namespace atomicswap {
11 
12 using hash_index_type = fc::fixed_string_32; // to pack 256-bit hash
13 
14 // secret operations
15 std::string get_secret_hex(const std::string& secret, const uint8_t secret_length = 0);
16 std::string get_secret_hash(const std::string& secret_hex);
17 
18 //
19 void validate_secret(const std::string& secret_hex);
20 void validate_secret_hash(const std::string& secret_hash);
21 void validate_contract_metadata(const std::string& metadata);
22 
23 // contract hash operations
24 fc::sha256
25 get_contract_hash_obj(const account_name_type& from, const account_name_type& to, const std::string& secret_hash);
26 std::string
27 get_contract_hash_hex(const account_name_type& from, const account_name_type& to, const std::string& secret_hash);
29 get_contract_hash(const account_name_type& from, const account_name_type& to, const std::string& secret_hash);
30 }
31 }
32 }
fc::fixed_string_32 hash_index_type
void validate_contract_metadata(const std::string &metadata)
void validate_secret(const std::string &secret_hex)
hash_index_type get_contract_hash(const account_name_type &from, const account_name_type &to, const std::string &secret_hash)
void validate_secret_hash(const std::string &secret_hash)
fc::sha256 get_contract_hash_obj(const account_name_type &from, const account_name_type &to, const std::string &secret_hash)
std::string get_secret_hash(const std::string &secret_hex)
std::string get_secret_hex(const std::string &secret, const uint8_t secret_length)
std::string get_contract_hash_hex(const account_name_type &from, const account_name_type &to, const std::string &secret_hash)
fc::fixed_string_16 account_name_type
Definition: types.hpp:62
Definition: asset.cpp:15