pub fn from_files(key_file: &str, key_id_file: &str) -> Self {
        let key_id_file: HashMap<String, String> =
            serde_json::from_str(&std::fs::read_to_string(key_id_file).unwrap()).unwrap();
        let privkey_file = std::fs::read_to_string(key_file)
            .unwrap()
            .split("\n")
            .filter(|x| x.len() != 0)
            .filter(|x| x.chars().nth(0).unwrap() != '-')
            .collect::<Vec<&str>>()
            .join("");
        Self {
            private_key: rsa::RSAPrivateKey::from_pkcs1(
                base64::decode(&privkey_file)
                    .expect("Cannot load private key")
                    .as_slice(),
            )
            .expect("Cannot parse private key"),
            key_id: key_id_file.get("key_id").unwrap().clone(),
        }
    }
/// Load a Satispay instance from the private key and the keyId
Load a Satispay instance from the private key and the keyId
Load a Satispay instance from the private key and the keyId
pub fn from_files(key_file: &str, key_id_file: &str) -> Self {
        let key_id_file: HashMap<String, String> =
            serde_json::from_str(&std::fs::read_to_string(key_id_file).unwrap()).unwrap();
        let privkey_file = std::fs::read_to_string(key_file)
            .unwrap()
            .split("\n")
            .filter(|x| x.len() != 0)
            .filter(|x| x.chars().nth(0).unwrap() != '-')
            .collect::<Vec<&str>>()
            .join("");
        Self {
            private_key: rsa::RSAPrivateKey::from_pkcs1(
                base64::decode(&privkey_file)
                    .expect("Cannot load private key")
                    .as_slice(),
            )
            .expect("Cannot parse private key"),
            key_id: key_id_file.get("key_id").unwrap().clone(),
        }
    }
pub fn from_files ( key_file : & str , key_id_file : & str ) -> Self { let key_id_file : HashMap < String , String > = serde_json :: from_str ( & std :: fs :: read_to_string ( key_id_file ) . unwrap ( ) ) . unwrap ( ) ; let privkey_file = std :: fs :: read_to_string ( key_file ) . unwrap ( ) . split ( " \n " ) . filter ( | x | x . len ( ) != 0 ) . filter ( | x | x . chars ( ) . nth ( 0 ) . unwrap ( ) != '-' ) . collect :: < Vec < & str > > ( ) . join ( " " ) ; Self { private_key : rsa :: RSAPrivateKey :: from_pkcs1 ( base64 :: decode ( & privkey_file ) . expect ( " " ) . as_slice ( ) , ) . expect ( " " ) , key_id : key_id_file . get ( " " ) . unwrap ( ) . clone ( ) , } }
Load a Satispay instance from the private key and the keyId
Load a Satispay instance from the private key and the keyId
key_file
&str
key_id_file
&str
key_file
&str
key_id_file
&str