Add Prd Connect
This commit is contained in:
parent
775119cdf6
commit
ccd5e398b0
16
src/prd.rs
16
src/prd.rs
@ -22,6 +22,7 @@ use crate::signature::{AnkHash, AnkMessageHash, Proof};
|
|||||||
pub enum PrdType {
|
pub enum PrdType {
|
||||||
#[default]
|
#[default]
|
||||||
None,
|
None,
|
||||||
|
Connect,
|
||||||
Message,
|
Message,
|
||||||
Update, // Update an existing process
|
Update, // Update an existing process
|
||||||
List, // request a list of items
|
List, // request a list of items
|
||||||
@ -66,6 +67,21 @@ pub struct Prd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Prd {
|
impl Prd {
|
||||||
|
/// We answer with all our addresses to ack we received a transaction and got the shared_secret
|
||||||
|
/// pairing_commitment can be null but in that case we can't be fully trusted
|
||||||
|
/// We expect another prd connect in return so that we can trust the shared secret
|
||||||
|
pub fn new_connect(sender: Member, pairing_commitment: OutPoint) -> Self {
|
||||||
|
Self {
|
||||||
|
prd_type: PrdType::Connect,
|
||||||
|
root_commitment: String::default(),
|
||||||
|
sender: serde_json::to_string(&sender).unwrap(),
|
||||||
|
validation_tokens: vec![],
|
||||||
|
keys: Map::new(),
|
||||||
|
payload: pairing_commitment.to_string(),
|
||||||
|
proof: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn new_update(
|
pub fn new_update(
|
||||||
root_commitment: OutPoint,
|
root_commitment: OutPoint,
|
||||||
sender: String, // Should take Member as argument
|
sender: String, // Should take Member as argument
|
||||||
|
Loading…
x
Reference in New Issue
Block a user