mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-16 20:39:10 +00:00
Allow import of Prysm keystores (#1535)
## Issue Addressed - Resolves #1361 ## Proposed Changes Loosens the constraints imposed by EIP-2335 so we can import keys from Prysm. ## Additional Info NA
This commit is contained in:
@@ -24,10 +24,14 @@ use serde_repr::*;
|
||||
pub struct JsonKeystore {
|
||||
pub crypto: Crypto,
|
||||
pub uuid: Uuid,
|
||||
pub path: String,
|
||||
/// EIP-2335 does not declare this field as optional, but Prysm is omitting it so we must
|
||||
/// support it.
|
||||
pub path: Option<String>,
|
||||
pub pubkey: String,
|
||||
pub version: Version,
|
||||
pub description: Option<String>,
|
||||
/// Not part of EIP-2335, but `ethdo` and Prysm have adopted it anyway so we must support it.
|
||||
pub name: Option<String>,
|
||||
}
|
||||
|
||||
/// Version for `JsonKeystore`.
|
||||
|
||||
@@ -172,10 +172,11 @@ impl Keystore {
|
||||
},
|
||||
},
|
||||
uuid,
|
||||
path,
|
||||
path: Some(path),
|
||||
pubkey: keypair.pk.to_hex_string()[2..].to_string(),
|
||||
version: Version::four(),
|
||||
description: None,
|
||||
name: None,
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -218,8 +219,8 @@ impl Keystore {
|
||||
/// Returns the path for the keystore.
|
||||
///
|
||||
/// Note: the path is not validated, it is simply whatever string the keystore provided.
|
||||
pub fn path(&self) -> &str {
|
||||
&self.json.path
|
||||
pub fn path(&self) -> Option<String> {
|
||||
self.json.path.clone()
|
||||
}
|
||||
|
||||
/// Returns the pubkey for the keystore.
|
||||
|
||||
Reference in New Issue
Block a user