Radish alpha
h
rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
Radicle Heartwood Protocol & Stack
Radicle
Git
crypto: `impl signature::KeypairRef` for Signers
Lorenz Leutgeb committed 1 month ago
commit f2ad54542e179e7560fc4be4842fd29b8e8e93bc
parent 768ecf5
3 files changed +30 -0
modified crates/radicle-crypto/src/ssh/agent.rs
@@ -72,6 +72,16 @@ impl signature::Signer<ExtendedSignature> for AgentSigner {
    }
}

+
impl AsRef<PublicKey> 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);
modified crates/radicle-crypto/src/ssh/keystore.rs
@@ -265,6 +265,16 @@ impl signature::Signer<ExtendedSignature> for MemorySigner {
    }
}

+
impl AsRef<PublicKey> 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
modified crates/radicle-crypto/src/test/signer.rs
@@ -23,6 +23,16 @@ impl signature::Signer<Signature> for MockSigner {
    }
}

+
impl AsRef<PublicKey> 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];