Add standard channels to policy
@@ -35,7 +35,7 @@ use crate::{
error::PolicyError,
expiry::Timepoint,
principal::{
- RightsTable, ExecutionStrategy, Identity, Principal,
+ RightsTable, ExecutionStrategy, Identity, Principal, StandardChannel,
Program,
},
},
@@ -88,6 +88,8 @@ pub struct Policy {
debug: bool,
/// The execution strategy that will be used to execute the WASM binary.
execution_strategy: ExecutionStrategy,
+ /// The rights table of the standard channels.
+ std_channels_table: Vec<StandardChannel>,
}
impl Policy {
@@ -106,6 +108,7 @@ impl Policy {
proxy_attestation_server_url: String,
debug: bool,
execution_strategy: ExecutionStrategy,
+ std_channels_table: Vec<StandardChannel>,
) -> Result<Self, PolicyError> {
let policy = Self {
identities,
@@ -119,6 +122,7 @@ impl Policy {
proxy_attestation_server_url,
debug,
execution_strategy,
+ std_channels_table,
};
policy.assert_valid()?;
@@ -221,6 +225,12 @@ impl Policy {
&self.execution_strategy
}
+ /// Return the rights of the standard channels, associated with this policy.
+ #[inline]
+ pub fn std_channels_table(&self) -> &Vec<StandardChannel> {
+ &self.std_channels_table
+ }
+
/// Checks that the policy is valid, returning `Err(reason)` iff the policy
/// is found to be invalid. In all other cases, `Ok(())` is returned.
fn assert_valid(&self) -> Result<(), PolicyError> {
