fluidity-core 0.1.5

The core package for fluidity is a complete digital identity management solution.
/*
    Appellation: mnemonic <module>
    Creator: FL03 <jo3mccain@icloud.com>
    Description:
        ... Summary ...
*/
use crate::{generate_collection_from_reference, mnemonics::Passphrase};

#[derive(Clone, Debug, Hash, PartialEq, scsys::Deserialize, scsys::Serialize)]
pub struct Mnemonic {
    pub mnemonic: Vec<String>,
    pub passphrase: Passphrase,
}

impl Mnemonic {
    fn constructor(mnemonic: Vec<String>, passphrase: Passphrase) -> Self {
        Self {
            mnemonic,
            passphrase,
        }
    }
    pub fn new(passphrase: Passphrase) -> Self {
        let mnemonic = generate_collection_from_reference(crate::BIP0039::default().0, 12);
        Self::constructor(mnemonic, passphrase)
    }
    pub fn passphrase(&self) -> String {
        self.passphrase.0.clone()
    }
    pub fn salt(&self) -> String {
        let salt = String::new();
        self.passphrase() + salt.as_str()
    }
}

#[cfg(test)]
mod tests {
    use crate::mnemonics::{Mnemonic, Passphrase};

    #[test]
    fn test_mnemonic() {
        let actual = Mnemonic::new(Passphrase::default());
        let expected = Mnemonic::new(Passphrase::default());
        assert_ne!(actual, expected)
    }
}