mirror of
https://github.com/fluencelabs/marine-rs-sdk
synced 2025-03-15 14:30:48 +00:00
add security tetraplets to CallParameters
This commit is contained in:
parent
31dc0a30df
commit
7bd2341ded
@ -18,9 +18,10 @@ path = "src/lib.rs"
|
||||
crate-type = ["rlib"]
|
||||
|
||||
[dependencies]
|
||||
log = { version = "0.4.8", features = ["std"] }
|
||||
fluence-sdk-macro = { path = "../macro", version = "=0.2.11" }
|
||||
serde = "1.0.115"
|
||||
|
||||
log = { version = "0.4.8", features = ["std"] }
|
||||
serde = "=1.0.118"
|
||||
|
||||
[dev-dependencies]
|
||||
simple_logger = "1.6.0" # used in doc test
|
||||
|
@ -16,17 +16,36 @@
|
||||
|
||||
use fluence_sdk_macro::fce;
|
||||
|
||||
use serde::Serialize;
|
||||
use serde::Deserialize;
|
||||
|
||||
/// Describes an origin that set an argument.
|
||||
#[fce]
|
||||
#[derive(Clone, PartialEq, Default, Eq, Debug, Serialize, Deserialize)]
|
||||
pub struct SecurityTetraplet {
|
||||
pub peer_pk: String,
|
||||
pub service_id: String,
|
||||
pub function_name: String,
|
||||
pub json_path: String,
|
||||
}
|
||||
|
||||
/// This struct contains parameters that would be accessible by Wasm modules.
|
||||
#[fce]
|
||||
#[derive(Clone, PartialEq, Default, Eq, Debug, serde::Serialize, serde::Deserialize)]
|
||||
#[derive(Clone, PartialEq, Default, Eq, Debug, Serialize, Deserialize)]
|
||||
pub struct CallParameters {
|
||||
pub call_id: String,
|
||||
pub user_name: String,
|
||||
pub application_id: String,
|
||||
pub tetraplets: Vec<Vec<SecurityTetraplet>>,
|
||||
}
|
||||
|
||||
impl CallParameters {
|
||||
pub fn new<C, U, A>(call_id: C, user_name: U, application_id: A) -> Self
|
||||
pub fn new<C, U, A>(
|
||||
call_id: C,
|
||||
user_name: U,
|
||||
application_id: A,
|
||||
tetraplets: Vec<Vec<SecurityTetraplet>>,
|
||||
) -> Self
|
||||
where
|
||||
C: Into<String>,
|
||||
U: Into<String>,
|
||||
@ -36,6 +55,7 @@ impl CallParameters {
|
||||
call_id: call_id.into(),
|
||||
user_name: user_name.into(),
|
||||
application_id: application_id.into(),
|
||||
tetraplets,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ mod logger;
|
||||
mod result;
|
||||
|
||||
pub use call_parameters::CallParameters;
|
||||
pub use call_parameters::SecurityTetraplet;
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
pub use call_parameters::get_call_parameters;
|
||||
|
||||
|
@ -70,6 +70,7 @@
|
||||
pub use fluence_sdk_macro::fce;
|
||||
|
||||
pub use fluence_sdk_main::CallParameters;
|
||||
pub use fluence_sdk_main::SecurityTetraplet;
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
pub use fluence_sdk_main::get_call_parameters;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user