in protocol/src/private_id_multi_key/partner.rs [200:237]
fn create_id_map(&self, partner: TPayload, company: TPayload) {
match (
self.self_permutation.clone().read(),
self.id_map.clone().write(),
) {
(Ok(permutation), Ok(mut id_map)) => {
let partner_encrypt = {
let mut out = partner;
undo_permute(permutation.as_slice(), &mut out);
// Encrypt
self.ec_cipher.to_points_encrypt(&out, &self.private_keys.1)
};
id_map.clear();
for (idx, k) in self.ec_cipher.to_bytes(&partner_encrypt).iter().enumerate() {
id_map.push((k.to_string(), idx, true));
}
for (idx, k) in self
.ec_cipher
.to_bytes(
&self
.ec_cipher
.to_points_encrypt(&company, &self.private_keys.1),
)
.iter()
.enumerate()
{
id_map.push((k.to_string(), idx, false));
}
// Sort the id_map by the spine
id_map.sort_by(|(a, _, _), (b, _, _)| a.cmp(b));
}
_ => panic!("Cannot make v"),
}
}