pub fn save_key<P: AsRef<Path>>(&self, path: P, pretty: bool) -> Result<(), String> {
        let key = VerifiableKey {
            p: self.p.clone(),
            q: self.q.clone(),
            group: self.group.clone(),
            g: self.g.clone(),
            max_d: self.max_d,
            g_powers: self.cache.g_powers.to_vec(),
            proof: self.cache.proof.clone(),
        };
        let f = std::fs::OpenOptions::new()
            .write(true)
            .create(true)
            .truncate(true)
            .open(path)
            .map_err(|e| e.to_string())?;
        if pretty {
            serde_json::to_writer_pretty(f, &key).map_err(|e| e.to_string())
        } else {
            serde_json::to_writer(f, &key).map_err(|e| e.to_string())
        }
    }
/// Generate proof of correct pre-computation and save the key.
Generate proof of correct pre-computation and save the key.
Generate proof of correct pre - computation and save the key .
pub fn save_key<P: AsRef<Path>>(&self, path: P, pretty: bool) -> Result<(), String> {
        let key = VerifiableKey {
            p: self.p.clone(),
            q: self.q.clone(),
            group: self.group.clone(),
            g: self.g.clone(),
            max_d: self.max_d,
            g_powers: self.cache.g_powers.to_vec(),
            proof: self.cache.proof.clone(),
        };
        let f = std::fs::OpenOptions::new()
            .write(true)
            .create(true)
            .truncate(true)
            .open(path)
            .map_err(|e| e.to_string())?;
        if pretty {
            serde_json::to_writer_pretty(f, &key).map_err(|e| e.to_string())
        } else {
            serde_json::to_writer(f, &key).map_err(|e| e.to_string())
        }
    }
pub fn save_key < P : AsRef < Path > > ( & self , path : P , pretty : bool ) -> Result < ( ) , String > { let key = VerifiableKey { p : self . p . clone ( ) , q : self . q . clone ( ) , group : self . group . clone ( ) , g : self . g . clone ( ) , max_d : self . max_d , g_powers : self . cache . g_powers . to_vec ( ) , proof : self . cache . proof . clone ( ) , } ; let f = std :: fs :: OpenOptions :: new ( ) . write ( true ) . create ( true ) . truncate ( true ) . open ( path ) . map_err ( | e | e . to_string ( ) ) ? ; if pretty { serde_json :: to_writer_pretty ( f , & key ) . map_err ( | e | e . to_string ( ) ) } else { serde_json :: to_writer ( f , & key ) . map_err ( | e | e . to_string ( ) ) } }
Generate proof of correct pre-computation and save the key.
Generate proof of correct pre - computation and save the key .
&self
path
P
pretty
bool
&self
path
P
pretty
bool