diff options
| author | mat <git@matdoes.dev> | 2023-05-27 01:57:31 -0500 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2023-05-27 01:57:31 -0500 |
| commit | 881333035987867f897042df7173bb2fa05b7621 (patch) | |
| tree | 283d44ea32bcb9119ec9546dcde59477012fc3bc /azalea-auth/src/certs.rs | |
| parent | 6188230009b49f96b755ade32a28b932e7810196 (diff) | |
| download | azalea-drasl-881333035987867f897042df7173bb2fa05b7621.tar.xz | |
random fixes mostly related to auth and crypto
Diffstat (limited to 'azalea-auth/src/certs.rs')
| -rw-r--r-- | azalea-auth/src/certs.rs | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/azalea-auth/src/certs.rs b/azalea-auth/src/certs.rs index 809a10c6..6030b886 100644 --- a/azalea-auth/src/certs.rs +++ b/azalea-auth/src/certs.rs @@ -55,14 +55,11 @@ pub async fn fetch_certificates( .unwrap(); // the private key also contains the public key so it's basically a keypair - let key_pair = RsaPrivateKey::from_pkcs8_der(&private_key_der).unwrap(); + let private_key = RsaPrivateKey::from_pkcs8_der(&private_key_der).unwrap(); let certificates = Certificates { - key_pair, - key_pair_bytes: KeyPairBytes { - private_key: private_key_der, - public_key: public_key_der, - }, + private_key, + public_key_der, signature_v1: base64::engine::general_purpose::STANDARD .decode(&res.public_key_signature) @@ -81,10 +78,10 @@ pub async fn fetch_certificates( /// A chat signing certificate. #[derive(Clone, Debug)] pub struct Certificates { - /// The RSA private and public key. - pub key_pair: RsaPrivateKey, - /// The keypair as DER-encoded bytes. - pub key_pair_bytes: KeyPairBytes, + /// The RSA private key. + pub private_key: RsaPrivateKey, + /// The RSA public key encoded as DER. + pub public_key_der: Vec<u8>, pub signature_v1: Vec<u8>, pub signature_v2: Vec<u8>, @@ -93,13 +90,6 @@ pub struct Certificates { pub refresh_after: DateTime<Utc>, } -/// A keypair as DER-encoded bytes. -#[derive(Clone, Debug)] -pub struct KeyPairBytes { - pub private_key: Vec<u8>, - pub public_key: Vec<u8>, -} - #[derive(Debug, Deserialize)] pub struct CertificatesResponse { #[serde(rename = "keyPair")] |
