Skip to content

Commit 4e392c6

Browse files
wiktor-kfriedenberg
andcommitted
Use PublicCredential in RemoveIdentity
Signed-off-by: Wiktor Kwapisiewicz <wiktor@metacode.biz> See: #98 Co-authored-by: Sasha F <cornflake.matchbox397@icantbelieveitsnotgmail.com>
1 parent 87c10e7 commit 4e392c6

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

examples/key-storage.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ impl Session for KeyStorage {
175175
}
176176

177177
async fn remove_identity(&mut self, identity: RemoveIdentity) -> Result<(), AgentError> {
178-
let pubkey: PublicKey = identity.pubkey.into();
178+
let pubkey: PublicKey = identity.credential.key_data().clone().into();
179179
self.identity_remove(&pubkey)?;
180180
Ok(())
181181
}

src/proto/message/add_remove.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ pub use constrained::*;
66
use secrecy::ExposeSecret as _;
77
use secrecy::SecretString;
88
use ssh_encoding::{self, CheckedSum, Decode, Encode, Reader, Writer};
9-
use ssh_key::public::KeyData;
109

1110
use super::PrivateCredential;
11+
use crate::proto::PublicCredential;
1212
use crate::proto::{Error, Result};
1313

1414
/// Add a key to an agent.
@@ -101,25 +101,25 @@ impl PartialEq for SmartcardKey {
101101
#[derive(Clone, PartialEq, Debug)]
102102
pub struct RemoveIdentity {
103103
/// The public key portion of the [`Identity`](super::Identity) to be removed
104-
pub pubkey: KeyData,
104+
pub credential: PublicCredential,
105105
}
106106

107107
impl Decode for RemoveIdentity {
108108
type Error = Error;
109109

110110
fn decode(reader: &mut impl Reader) -> Result<Self> {
111-
let pubkey = reader.read_prefixed(KeyData::decode)?;
111+
let credential = reader.read_prefixed(PublicCredential::decode)?;
112112

113-
Ok(Self { pubkey })
113+
Ok(Self { credential })
114114
}
115115
}
116116

117117
impl Encode for RemoveIdentity {
118118
fn encoded_len(&self) -> ssh_encoding::Result<usize> {
119-
self.pubkey.encoded_len_prefixed()
119+
self.credential.encoded_len_prefixed()
120120
}
121121

122122
fn encode(&self, writer: &mut impl Writer) -> ssh_encoding::Result<()> {
123-
self.pubkey.encode_prefixed(writer)
123+
self.credential.encode_prefixed(writer)
124124
}
125125
}

0 commit comments

Comments
 (0)