framework-cqrs-lib 0.3.3

handle state-machine with data persist in journal and store mongo for restfull actix api
Documentation
use std::sync::Arc;
use crate::cqrs::infra::token::services::jwt_hmac::JwtHMACTokenService;
use crate::cqrs::models::errors::{Error, ResultErr};

pub struct AuthenticationComponent {
    pub jwt_token_encoder_service: Arc<JwtHMACTokenService>,
}

impl AuthenticationComponent {
    pub fn new() -> ResultErr<Self> {
        let jwt_secret = std::env::var("JWT_SECRET")
            .map_err(|_|
                Error::Simple("env variable JWT_SECRET is not defined".to_string())

            )?;
        Ok(
            Self {
                jwt_token_encoder_service: Arc::new(JwtHMACTokenService::new(jwt_secret)),
            }
        )
    }
}