Skip to content

Commit 8aa6bf9

Browse files
committed
Rename CertKeyData to PublicCredential
Signed-off-by: Wiktor Kwapisiewicz <[email protected]>
1 parent b56ab4e commit 8aa6bf9

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

examples/pgp-wrapper.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ use service_binding::Binding;
6464
use ssh_agent_lib::{
6565
agent::Session,
6666
client::connect,
67-
proto::{CertKeyData, Extension, SignRequest},
67+
proto::{Extension, PublicCredential, SignRequest},
6868
};
6969
use ssh_key::public::KeyData;
7070
use tokio::runtime::Runtime;
@@ -372,7 +372,7 @@ fn main() -> testresult::TestResult {
372372
let mut keyflags = KeyFlags::default();
373373
keyflags.set_encrypt_comms(true);
374374
keyflags.set_encrypt_storage(true);
375-
let CertKeyData::Key(pubkey) = &decryption_id.pubkey else {
375+
let PublicCredential::Key(pubkey) = &decryption_id.pubkey else {
376376
panic!("Only pubkeys are supported.");
377377
};
378378
let pk = ssh_to_pgp(pubkey.clone(), KeyRole::Decryption);
@@ -391,7 +391,7 @@ fn main() -> testresult::TestResult {
391391
vec![]
392392
};
393393

394-
let CertKeyData::Key(pubkey) = pubkey else {
394+
let PublicCredential::Key(pubkey) = pubkey else {
395395
panic!("Only pubkeys are supported.");
396396
};
397397
let signer = WrappedKey::new(pubkey.clone(), client, KeyRole::Signing);
@@ -417,7 +417,7 @@ fn main() -> testresult::TestResult {
417417
signed_pk.to_writer(&mut std::io::stdout())?;
418418
}
419419
Args::Sign => {
420-
let CertKeyData::Key(pubkey) = pubkey else {
420+
let PublicCredential::Key(pubkey) = pubkey else {
421421
panic!("Only pubkeys are supported.");
422422
};
423423
let signer = WrappedKey::new(pubkey.clone(), client, KeyRole::Signing);

src/proto/message.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Agent protocol message structures.
22
33
mod add_remove;
4-
mod cert_key_data;
4+
mod credential;
55
mod extension;
66
mod identity;
77
mod request;
@@ -10,7 +10,7 @@ mod sign;
1010
mod unparsed;
1111

1212
pub use self::{
13-
add_remove::*, cert_key_data::*, extension::*, identity::*, request::*, response::*, sign::*,
13+
add_remove::*, credential::*, extension::*, identity::*, request::*, response::*, sign::*,
1414
unparsed::*,
1515
};
1616
#[doc(hidden)]

src/proto/message/cert_key_data.rs renamed to src/proto/message/credential.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ use crate::proto::Error;
55

66
#[derive(Debug, PartialEq, Eq, Clone)]
77
/// Represents a public credential.
8-
pub enum CertKeyData {
8+
pub enum PublicCredential {
99
/// Plain public key.
1010
Key(KeyData),
1111
/// Signed public key.
1212
Cert(Certificate),
1313
}
1414

15-
impl CertKeyData {
15+
impl PublicCredential {
1616
/// Returns a reference to the [KeyData].
1717
pub fn key_data(&self) -> &KeyData {
1818
match self {
@@ -22,7 +22,7 @@ impl CertKeyData {
2222
}
2323
}
2424

25-
impl Decode for CertKeyData {
25+
impl Decode for PublicCredential {
2626
type Error = Error;
2727

2828
fn decode(reader: &mut impl Reader) -> core::result::Result<Self, Self::Error> {
@@ -31,7 +31,7 @@ impl Decode for CertKeyData {
3131
}
3232
}
3333

34-
impl Encode for CertKeyData {
34+
impl Encode for PublicCredential {
3535
fn encoded_len(&self) -> std::result::Result<usize, ssh_encoding::Error> {
3636
match self {
3737
Self::Key(pubkey) => pubkey.encoded_len(),
@@ -50,13 +50,13 @@ impl Encode for CertKeyData {
5050
}
5151
}
5252

53-
impl From<KeyData> for CertKeyData {
53+
impl From<KeyData> for PublicCredential {
5454
fn from(value: KeyData) -> Self {
5555
Self::Key(value)
5656
}
5757
}
5858

59-
impl From<Certificate> for CertKeyData {
59+
impl From<Certificate> for PublicCredential {
6060
fn from(value: Certificate) -> Self {
6161
Self::Cert(value)
6262
}

src/proto/message/identity.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
use ssh_encoding::{self, CheckedSum, Decode, Encode, Reader, Writer};
44

5-
use super::cert_key_data::CertKeyData;
5+
use super::PublicCredential;
66
use crate::proto::{Error, Result};
77

88
/// Data returned to the client when listing keys.
@@ -13,7 +13,7 @@ use crate::proto::{Error, Result};
1313
#[derive(Clone, PartialEq, Debug)]
1414
pub struct Identity {
1515
/// A standard public-key encoding of an underlying key.
16-
pub pubkey: CertKeyData,
16+
pub pubkey: PublicCredential,
1717

1818
/// A human-readable comment
1919
pub comment: String,
@@ -36,7 +36,7 @@ impl Decode for Identity {
3636
type Error = Error;
3737

3838
fn decode(reader: &mut impl Reader) -> Result<Self> {
39-
let pubkey = reader.read_prefixed(CertKeyData::decode)?;
39+
let pubkey = reader.read_prefixed(PublicCredential::decode)?;
4040
let comment = String::decode(reader)?;
4141

4242
Ok(Self { pubkey, comment })

src/proto/message/sign.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
use ssh_encoding::{self, CheckedSum, Decode, Encode, Reader, Writer};
44

5-
use super::cert_key_data::CertKeyData;
5+
use super::PublicCredential;
66
use crate::proto::{Error, Result};
77

88
/// Signature request with data to be signed with a key in an agent.
@@ -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: CertKeyData,
16+
pub pubkey: PublicCredential,
1717

1818
/// Binary data to be signed
1919
pub data: Vec<u8>,
@@ -27,7 +27,7 @@ impl Decode for SignRequest {
2727
type Error = Error;
2828

2929
fn decode(reader: &mut impl Reader) -> Result<Self> {
30-
let pubkey = reader.read_prefixed(CertKeyData::decode)?;
30+
let pubkey = reader.read_prefixed(PublicCredential::decode)?;
3131
let data = Vec::decode(reader)?;
3232
let flags = u32::decode(reader)?;
3333

0 commit comments

Comments
 (0)