blueprint-contexts 0.2.0-alpha.2

Context providers for Tangle Blueprints
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use blueprint_keystore::Keystore;

/// `KeystoreContext` trait provides access to the generic keystore from the context.
pub trait KeystoreContext {
    /// Get the keystore client from the context.
    fn keystore(&self) -> Keystore;
}

#[cfg(feature = "std")]
impl KeystoreContext for blueprint_runner::config::BlueprintEnvironment {
    fn keystore(&self) -> Keystore {
        let config = blueprint_keystore::KeystoreConfig::new().fs_root(self.keystore_uri.clone());
        Keystore::new(config).expect("Failed to create keystore")
    }
}