Skip to content

Commit 1f86f25

Browse files
committed
Rename SignRequest::pubkey to credential for clarity
Signed-off-by: Wiktor Kwapisiewicz <wiktor@metacode.biz>
1 parent 1f8a19a commit 1f86f25

4 files changed

Lines changed: 8 additions & 8 deletions

File tree

examples/key-storage.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ impl KeyStorage {
7474
#[crate::async_trait]
7575
impl Session for KeyStorage {
7676
async fn sign(&mut self, sign_request: SignRequest) -> Result<Signature, AgentError> {
77-
let pubkey: PublicKey = sign_request.pubkey.key_data().clone().into();
77+
let pubkey: PublicKey = sign_request.credential.key_data().clone().into();
7878

7979
if let Some(identity) = self.identity_from_pubkey(&pubkey) {
8080
match identity.privkey.key_data() {

examples/random-key.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ impl RandomKey {
4141
impl Session for RandomKey {
4242
async fn sign(&mut self, sign_request: SignRequest) -> Result<Signature, AgentError> {
4343
let private_key = self.private_key.lock().unwrap();
44-
let PublicCredential::Key(pubkey) = sign_request.pubkey else {
44+
let PublicCredential::Key(pubkey) = sign_request.credential else {
4545
return Err(std::io::Error::other("Key not found").into());
4646
};
4747
if PublicKey::from(private_key.deref()).key_data() != &pubkey {

src/proto/message/request.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ mod tests {
164164
let Request::SignRequest(req) = req else {
165165
panic!("expected SignRequest");
166166
};
167-
let PublicCredential::Cert(cert) = req.pubkey else {
167+
let PublicCredential::Cert(cert) = req.credential else {
168168
panic!("expected certificate");
169169
};
170170
assert_eq!(cert.algorithm(), Algorithm::Rsa { hash: None });
@@ -177,7 +177,7 @@ mod tests {
177177
let Request::SignRequest(req) = req else {
178178
panic!("expected SignRequest");
179179
};
180-
let PublicCredential::Key(cert) = req.pubkey else {
180+
let PublicCredential::Key(cert) = req.credential else {
181181
panic!("expected key");
182182
};
183183
assert_eq!(cert.algorithm(), Algorithm::Rsa { hash: None });

src/proto/message/sign.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use crate::proto::{Error, Result};
1313
#[derive(Clone, PartialEq, Debug)]
1414
pub struct SignRequest {
1515
/// The public key portion of the [`Identity`](super::Identity) in the agent to sign the data with
16-
pub pubkey: PublicCredential,
16+
pub credential: PublicCredential,
1717

1818
/// Binary data to be signed
1919
pub data: Vec<u8>,
@@ -32,7 +32,7 @@ impl Decode for SignRequest {
3232
let flags = u32::decode(reader)?;
3333

3434
Ok(Self {
35-
pubkey,
35+
credential: pubkey,
3636
data,
3737
flags,
3838
})
@@ -42,15 +42,15 @@ impl Decode for SignRequest {
4242
impl Encode for SignRequest {
4343
fn encoded_len(&self) -> ssh_encoding::Result<usize> {
4444
[
45-
self.pubkey.encoded_len_prefixed()?,
45+
self.credential.encoded_len_prefixed()?,
4646
self.data.encoded_len()?,
4747
self.flags.encoded_len()?,
4848
]
4949
.checked_sum()
5050
}
5151

5252
fn encode(&self, writer: &mut impl Writer) -> ssh_encoding::Result<()> {
53-
self.pubkey.encode_prefixed(writer)?;
53+
self.credential.encode_prefixed(writer)?;
5454
self.data.encode(writer)?;
5555
self.flags.encode(writer)?;
5656

0 commit comments

Comments
 (0)