Skip to content

Commit

Permalink
fix: remove PartialEq implementation from JsonWebKey
Browse files Browse the repository at this point in the history
fixes #95
  • Loading branch information
Erik1000 committed Apr 4, 2024
1 parent b062bf3 commit f835fe4
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/jwk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,18 @@ pub use self::{
/// an abstract representation of all possible key types. The [`JsonWebKeyType`]
/// enum is used to specialize on concrete key type.
///
/// # Comparison and equality
///
/// It is not defined how to determine if a [`JsonWebKey`] is [equal](PartialEq)
/// to another. Therefore, [`JsonWebKey`] *does not* implement [`PartialEq`].
/// If you want to compare a [`JsonWebKey`], you should either use something
/// like the [`kid`](JsonWebKey::key_id) parameter or a [`Thumbprint`] of
/// the key (or ideally, a [`Thumbprint`] as [`kid`](JsonWebKey::key_id)).
///
/// You should *avoid* comparing the serialized form of a [`JsonWebKey`] as it
/// may contain optional parameters, which may not always be present and would
/// lead to unexpected results.
///
/// # Examples
///
/// Parse a JsonWebKey from its json representation:
Expand Down Expand Up @@ -184,7 +196,7 @@ pub use self::{
/// [RFC 7517]: <https://datatracker.ietf.org/doc/html/rfc7517>
/// [section 6 of RFC 7518]: <https://datatracker.ietf.org/doc/html/rfc7518#section-6>
/// [IANA `Json Web Key Parameters` registry]: <https://www.iana.org/assignments/jose/jose.xhtml#web-key-parameters>
#[derive(Debug, PartialEq, Eq, Deserialize, Serialize, Clone)]
#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct JsonWebKey<A = ()> {
/// Additional members in the JWK as permitted by the fourth paragraph of
/// [section 4]
Expand Down

0 comments on commit f835fe4

Please sign in to comment.