Add roles and public_data to prd
This commit is contained in:
parent
dc77482cc6
commit
4bcf31d311
14
src/prd.rs
14
src/prd.rs
@ -1,4 +1,4 @@
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::collections::{BTreeMap, HashSet};
|
||||
|
||||
use anyhow::Result;
|
||||
use serde::{Deserialize, Serialize};
|
||||
@ -62,6 +62,8 @@ pub struct Prd {
|
||||
pub keys: Map<String, Value>, // key is a key in pcd, value is the key to decrypt it
|
||||
pub pcd_commitments: Value,
|
||||
pub validation_tokens: Vec<Proof>,
|
||||
pub roles: BTreeMap<String, RoleDefinition>,
|
||||
pub public_data: BTreeMap<String, String>,
|
||||
pub payload: String, // Additional information depending on the type
|
||||
pub proof: Option<Proof>, // This must be None up to the creation of the network message
|
||||
}
|
||||
@ -82,13 +84,15 @@ impl Prd {
|
||||
keys: Map::new(),
|
||||
payload: secret_hash.to_string(),
|
||||
proof: None,
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_update(
|
||||
process_id: OutPoint,
|
||||
sender: Member,
|
||||
roles: HashMap<String, RoleDefinition>,
|
||||
roles: BTreeMap<String, RoleDefinition>,
|
||||
public_data: BTreeMap<String, String>,
|
||||
keys: Map<String, Value>,
|
||||
pcd_commitments: Value,
|
||||
) -> Self {
|
||||
@ -99,8 +103,10 @@ impl Prd {
|
||||
validation_tokens: vec![],
|
||||
keys,
|
||||
pcd_commitments,
|
||||
payload: serde_json::to_string(&roles).expect("We're confident it's serializable"),
|
||||
payload: String::new(),
|
||||
proof: None,
|
||||
roles,
|
||||
public_data,
|
||||
}
|
||||
}
|
||||
|
||||
@ -119,6 +125,7 @@ impl Prd {
|
||||
pcd_commitments,
|
||||
payload: String::default(),
|
||||
proof: None,
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
||||
@ -136,6 +143,7 @@ impl Prd {
|
||||
keys: Map::new(),
|
||||
payload: String::default(),
|
||||
proof: None,
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user