diff --git a/crates/radicle-crypto/src/ssh/agent.rs b/crates/radicle-crypto/src/ssh/agent.rs index 05a6f956..ab73fa37 100644 --- a/crates/radicle-crypto/src/ssh/agent.rs +++ b/crates/radicle-crypto/src/ssh/agent.rs @@ -72,6 +72,16 @@ impl signature::Signer for AgentSigner { } } +impl AsRef for AgentSigner { + fn as_ref(&self) -> &PublicKey { + &self.public + } +} + +impl signature::KeypairRef for AgentSigner { + type VerifyingKey = PublicKey; +} + impl AgentSigner { pub fn new(agent: Agent, public: PublicKey) -> Self { let agent = RefCell::new(agent); diff --git a/crates/radicle-crypto/src/ssh/keystore.rs b/crates/radicle-crypto/src/ssh/keystore.rs index 49d241ec..84ab0d6f 100644 --- a/crates/radicle-crypto/src/ssh/keystore.rs +++ b/crates/radicle-crypto/src/ssh/keystore.rs @@ -265,6 +265,16 @@ impl signature::Signer for MemorySigner { } } +impl AsRef for MemorySigner { + fn as_ref(&self) -> &PublicKey { + &self.public + } +} + +impl signature::KeypairRef for MemorySigner { + type VerifyingKey = PublicKey; +} + impl Signer for MemorySigner { fn public_key(&self) -> &PublicKey { &self.public diff --git a/crates/radicle-crypto/src/test/signer.rs b/crates/radicle-crypto/src/test/signer.rs index 76c1fb2b..6881699a 100644 --- a/crates/radicle-crypto/src/test/signer.rs +++ b/crates/radicle-crypto/src/test/signer.rs @@ -23,6 +23,16 @@ impl signature::Signer for MockSigner { } } +impl AsRef for MockSigner { + fn as_ref(&self) -> &PublicKey { + &self.pk + } +} + +impl signature::KeypairRef for MockSigner { + type VerifyingKey = PublicKey; +} + impl MockSigner { pub fn new(rng: &mut fastrand::Rng) -> Self { let mut seed: [u8; 32] = [0; 32];