Skip to content

Commit 820c763

Browse files
committed
Address comments
1 parent 7ccf181 commit 820c763

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/api_client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ mod tests {
122122
#[test]
123123
fn test_new_signed_observation() {
124124
let secret_key = SecretKey::from_byte_array(&[1u8; 32]).expect("Invalid secret key length");
125-
let signer = crate::signer::Local { secret_key };
125+
let signer = crate::signer::FileSigner { secret_key };
126126
let body = Body {
127127
timestamp: 1234567890,
128128
nonce: 42,

src/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ async fn run_listener<T: Signer + 'static>(
173173
}
174174

175175
async fn run(run_options: config::RunOptions) {
176-
let signer = signer::Local::try_new(run_options.clone()).expect("Failed to create signer");
176+
let signer = signer::FileSigner::try_new(run_options.clone()).expect("Failed to create signer");
177177
let client = PubsubClient::new(&run_options.pythnet_url)
178178
.await
179179
.expect("Invalid WebSocket URL");
@@ -238,7 +238,7 @@ async fn main() {
238238

239239
// Generate keypair (secret + public key)
240240
let (secret_key, _) = secp.generate_keypair(&mut rng);
241-
let signer = signer::Local { secret_key };
241+
let signer = signer::FileSigner { secret_key };
242242
let (pubkey, pubkey_evm) = signer.get_public_key().expect("Failed to get public key");
243243

244244
let guardian_key = GuardianKey {
@@ -471,15 +471,15 @@ mod tests {
471471
-----END WORMHOLE GUARDIAN PRIVATE KEY-----
472472
"
473473
.to_string();
474-
let guardian_key = crate::signer::Local::parse_and_verify_proto_guardian_key(
474+
let guardian_key = crate::signer::FileSigner::parse_and_verify_proto_guardian_key(
475475
content,
476476
config::Mode::Production,
477477
)
478478
.expect("Failed to parse and verify guardian key");
479479
assert!(!guardian_key.unsafe_deterministic_key);
480480
let secret_key = SecretKey::from_slice(&guardian_key.data)
481481
.expect("Failed to create SecretKey from bytes");
482-
let signer = signer::Local { secret_key };
482+
let signer = signer::FileSigner { secret_key };
483483
assert_eq!(
484484
hex::encode(secret_key.secret_bytes()),
485485
"f2f3127bff540c8441f99763f586858ef340c9962ad62b6181cd77203e81808f",

src/signer.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub trait Signer: Send + Sync + Sized + Clone {
1717
}
1818

1919
#[derive(Clone, Debug)]
20-
pub struct Local {
20+
pub struct FileSigner {
2121
pub secret_key: SecretKey,
2222
}
2323

@@ -32,7 +32,7 @@ pub struct GuardianKey {
3232
pub const GUARDIAN_KEY_ARMORED_BLOCK: &str = "WORMHOLE GUARDIAN PRIVATE KEY";
3333
pub const STANDARD_ARMOR_LINE_HEADER: &str = "PGP PRIVATE KEY BLOCK";
3434

35-
impl Local {
35+
impl FileSigner {
3636
pub fn parse_and_verify_proto_guardian_key(
3737
content: String,
3838
mode: crate::config::Mode,
@@ -62,12 +62,12 @@ impl Local {
6262
}
6363
}
6464

65-
impl Signer for Local {
65+
impl Signer for FileSigner {
6666
fn try_new(run_options: RunOptions) -> anyhow::Result<Self> {
6767
let content = fs::read_to_string(run_options.secret_key_path)
6868
.map_err(|e| anyhow::anyhow!("Failed to read secret key file: {}", e))?;
6969
let guardian_key = Self::parse_and_verify_proto_guardian_key(content, run_options.mode)?;
70-
Ok(Local {
70+
Ok(FileSigner {
7171
secret_key: SecretKey::from_slice(&guardian_key.data)
7272
.map_err(|e| anyhow::anyhow!("Failed to create SecretKey: {}", e))?,
7373
})

0 commit comments

Comments
 (0)