pub fn load(&self, public: &Public, password: &str) -> Result<Pair> {
		if let Some(pair) = self.additional.get(public) {
			return Ok(pair.clone());
		}
		let path = self.key_file_path(public);
		let file = File::open(path)?;

		let phrase: String = ::serde_json::from_reader(&file)?;
		let pair = Pair::from_phrase(&phrase, Some(password))
			.map_err(|_| Error::from(ErrorKind::InvalidPhrase))?;
		if &pair.public() != public {
			bail!(ErrorKind::InvalidPassword);
		}
		Ok(pair)
	}
/// Load a key file with given public key.
Load a key file with given public key.
Load a key file with given public key .
pub fn load(&self, public: &Public, password: &str) -> Result<Pair> {
		if let Some(pair) = self.additional.get(public) {
			return Ok(pair.clone());
		}
		let path = self.key_file_path(public);
		let file = File::open(path)?;
		let phrase: String = ::serde_json::from_reader(&file)?;
		let pair = Pair::from_phrase(&phrase, Some(password))
			.map_err(|_| Error::from(ErrorKind::InvalidPhrase))?;
		if &pair.public() != public {
			bail!(ErrorKind::InvalidPassword);
		}
		Ok(pair)
	}
pub fn load ( & self , public : & Public , password : & str ) -> Result < Pair > { if let Some ( pair ) = self . additional . get ( public ) { return Ok ( pair . clone ( ) ) ; } let path = self . key_file_path ( public ) ; let file = File :: open ( path ) ? ; let phrase : String = :: serde_json :: from_reader ( & file ) ? ; let pair = Pair :: from_phrase ( & phrase , Some ( password ) ) . map_err ( | _ | Error :: from ( ErrorKind :: InvalidPhrase ) ) ? ; if & pair . public ( ) != public { bail ! ( ErrorKind InvalidPassword ) ; } Ok ( pair ) }
Load a key file with given public key.
Load a key file with given public key .
&self
public
&Public
password
&str
&self
public
&Public
password
&str