Updates to serialization routine for establish-phase1
This commit is contained in:
parent
d93210dd8a
commit
c1e2fbe349
|
@ -1643,7 +1643,9 @@ pub mod ffishim {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern fn ffishim_bidirectional_establish_customer_phase1(serialized_pp: *mut c_char, serialized_customer_data: *mut c_char, serialized_merchant_data: *mut c_char) -> *mut c_char {
|
pub extern fn ffishim_bidirectional_establish_customer_phase1(serialized_pp: *mut c_char,
|
||||||
|
serialized_customer_data: *mut c_char,
|
||||||
|
serialized_merchant_bases: *mut c_char) -> *mut c_char {
|
||||||
// Deserialize the pp
|
// Deserialize the pp
|
||||||
let deserialized_pp: bidirectional::PublicParams = deserialize_object(serialized_pp);
|
let deserialized_pp: bidirectional::PublicParams = deserialize_object(serialized_pp);
|
||||||
|
|
||||||
|
@ -1651,9 +1653,10 @@ pub mod ffishim {
|
||||||
let deserialized_customer_data: bidirectional::InitCustomerData = deserialize_object(serialized_customer_data);
|
let deserialized_customer_data: bidirectional::InitCustomerData = deserialize_object(serialized_customer_data);
|
||||||
|
|
||||||
// Deserialize the merchant data
|
// Deserialize the merchant data
|
||||||
let deserialized_merchant_data: bidirectional::InitMerchantData = deserialize_object(serialized_merchant_data);
|
//let deserialized_merchant_data: bidirectional::InitMerchantData = deserialize_object(serialized_merchant_data);
|
||||||
|
let deserialized_merchant_bases: serialization_wrappers::VecG2Wrapper = deserialize_object(serialized_merchant_bases);
|
||||||
|
|
||||||
let proof1 = bidirectional::establish_customer_phase1(&deserialized_pp, &deserialized_customer_data, &deserialized_merchant_data.bases);
|
let proof1 = bidirectional::establish_customer_phase1(&deserialized_pp, &deserialized_customer_data, &deserialized_merchant_bases.0);
|
||||||
let ser = ["{\'proof\':\'", serde_json::to_string(&proof1).unwrap().as_str(), "\'}"].concat();
|
let ser = ["{\'proof\':\'", serde_json::to_string(&proof1).unwrap().as_str(), "\'}"].concat();
|
||||||
let cser = CString::new(ser).unwrap();
|
let cser = CString::new(ser).unwrap();
|
||||||
cser.into_raw()
|
cser.into_raw()
|
||||||
|
|
|
@ -190,6 +190,10 @@ class Libbolt(object):
|
||||||
dictionary = self.interperate_json_string_as_dictionary(keypair)
|
dictionary = self.interperate_json_string_as_dictionary(keypair)
|
||||||
return json.dumps(dictionary['pk'])
|
return json.dumps(dictionary['pk'])
|
||||||
|
|
||||||
|
def util_extract_pub_bases_from_keypair(self, keypair):
|
||||||
|
dictionary = self.interperate_json_string_as_dictionary(keypair)
|
||||||
|
return json.dumps(dictionary['bases'])
|
||||||
|
|
||||||
if platform == 'darwin':
|
if platform == 'darwin':
|
||||||
prefix = 'lib'
|
prefix = 'lib'
|
||||||
ext = 'dylib'
|
ext = 'dylib'
|
||||||
|
@ -221,7 +225,8 @@ cm_csp = libbolt.bidirectional_generate_commit_setup(pp, libbolt.util_extract_pu
|
||||||
|
|
||||||
cust_data, channel_state = libbolt.bidirectional_init_customer(pp, channel_state, b0_cust, b0_merch, cm_csp, cust_keys)
|
cust_data, channel_state = libbolt.bidirectional_init_customer(pp, channel_state, b0_cust, b0_merch, cm_csp, cust_keys)
|
||||||
|
|
||||||
proof1 = libbolt.bidirectional_establish_customer_phase1(pp, cust_data, merch_data)
|
merch_bases = libbolt.util_extract_pub_bases_from_keypair(merch_data)
|
||||||
|
proof1 = libbolt.bidirectional_establish_customer_phase1(pp, cust_data, merch_bases)
|
||||||
|
|
||||||
wallet_sig, channel_state = libbolt.bidirectional_establish_merchant_phase2(pp, channel_state, merch_data, proof1)
|
wallet_sig, channel_state = libbolt.bidirectional_establish_merchant_phase2(pp, channel_state, merch_data, proof1)
|
||||||
|
|
||||||
|
|
|
@ -428,6 +428,11 @@ pub struct FrWrapper( #[serde(serialize_with = "serialize_generic_encodable", de
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
pub struct VecFrWrapper( #[serde(serialize_with = "serialize_generic_encodable_vec", deserialize_with = "deserialize_fr_vec")] pub Vec<Fr>);
|
pub struct VecFrWrapper( #[serde(serialize_with = "serialize_generic_encodable_vec", deserialize_with = "deserialize_fr_vec")] pub Vec<Fr>);
|
||||||
|
|
||||||
|
// Wrapper class for Vec<G2>
|
||||||
|
#[derive(Serialize, Deserialize)]
|
||||||
|
pub struct VecG2Wrapper( #[serde(serialize_with = "serialize_generic_encodable_vec", deserialize_with = "deserialize_g_two_vec")] pub Vec<G2>);
|
||||||
|
|
||||||
|
|
||||||
// Wrapper class for commitment and the CSParams
|
// Wrapper class for commitment and the CSParams
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
pub struct WalletCommitmentAndParamsWrapper {
|
pub struct WalletCommitmentAndParamsWrapper {
|
||||||
|
|
Loading…
Reference in New Issue