forked from brl/citadel-tools
method added to construct keypair from raw bytes
This commit is contained in:
parent
e493e5180d
commit
cf85d10055
@ -50,6 +50,10 @@ impl KeyPair {
|
|||||||
|
|
||||||
pub fn from_hex(hex: &str) -> Result<KeyPair> {
|
pub fn from_hex(hex: &str) -> Result<KeyPair> {
|
||||||
let bytes = hex::decode(hex)?;
|
let bytes = hex::decode(hex)?;
|
||||||
|
KeyPair::from_bytes(&bytes)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn from_bytes(bytes: &[u8]) -> Result<KeyPair> {
|
||||||
if bytes.len() != SEEDBYTES {
|
if bytes.len() != SEEDBYTES {
|
||||||
bail!("Hex encoded keypair has incorrect length");
|
bail!("Hex encoded keypair has incorrect length");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user