//! Key algorithms used in Matrix spec.

#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};

use strum::{AsRefStr, Display, EnumString};

/// The basic key algorithms in the specification.
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, AsRefStr, Display, EnumString)]
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
#[non_exhaustive]
#[strum(serialize_all = "snake_case")]
pub enum DeviceKeyAlgorithm {
    /// The Ed25519 signature algorithm.
    Ed25519,

    /// The Curve25519 ECDH algorithm.
    Curve25519,

    /// The Curve25519 ECDH algorithm, but the key also contains signatures
    SignedCurve25519,
}

/// The server key algorithms defined in the Matrix spec.
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, AsRefStr, Display, EnumString)]
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
#[non_exhaustive]
#[strum(serialize_all = "snake_case")]
pub enum ServerKeyAlgorithm {
    /// The Ed25519 signature algorithm.
    Ed25519,
}

//! Key algorithms used in Matrix spec.

#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};

use strum::{AsRefStr, Display, EnumString};

/// The basic key algorithms in the specification.
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, AsRefStr, Display, EnumString)]
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
#[non_exhaustive]
pub enum DeviceKeyAlgorithm {
    /// The Ed25519 signature algorithm.
    #[strum(to_string = "ed25519")]
    Ed25519,

    /// The Curve25519 ECDH algorithm.
    #[strum(to_string = "curve25519")]
    Curve25519,

    /// The Curve25519 ECDH algorithm, but the key also contains signatures
    #[strum(to_string = "signed_curve25519")]
    SignedCurve25519,
}

/// The server key algorithms defined in the Matrix spec.
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, AsRefStr, Display, EnumString)]
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
#[non_exhaustive]
pub enum ServerKeyAlgorithm {
    /// The Ed25519 signature algorithm.
    #[strum(to_string = "ed25519")]
    Ed25519,
}

--- 
+++ 
@@ -9,17 +9,15 @@
 #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, AsRefStr, Display, EnumString)]
 #[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
 #[non_exhaustive]
+#[strum(serialize_all = "snake_case")]
 pub enum DeviceKeyAlgorithm {
     /// The Ed25519 signature algorithm.
-    #[strum(to_string = "ed25519")]
     Ed25519,
 
     /// The Curve25519 ECDH algorithm.
-    #[strum(to_string = "curve25519")]
     Curve25519,
 
     /// The Curve25519 ECDH algorithm, but the key also contains signatures
-    #[strum(to_string = "signed_curve25519")]
     SignedCurve25519,
 }
 
@@ -27,8 +25,8 @@
 #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, AsRefStr, Display, EnumString)]
 #[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
 #[non_exhaustive]
+#[strum(serialize_all = "snake_case")]
 pub enum ServerKeyAlgorithm {
     /// The Ed25519 signature algorithm.
-    #[strum(to_string = "ed25519")]
     Ed25519,
 }
Use strum(serialize_all) instead of strum(to_string)
