Skip to content

Commit

Permalink
Update identity_jose/src/jws/header.rs
Browse files Browse the repository at this point in the history
Co-authored-by: Philipp Gackstatter <[email protected]>
  • Loading branch information
abdulmth and PhilippGackstatter authored Sep 28, 2023
1 parent a944eb7 commit 058d336
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions identity_jose/src/jws/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,21 +118,20 @@ impl JwsHeader {
!has_duplicate && self.common.is_disjoint(other.common()) && self.is_custom_disjoint(other)
}

/// Returns `true` if none of the fields are set in both `self.custom` and `other.custom`.
fn is_custom_disjoint(&self, other: &JwsHeader) -> bool {
if let Some(custom) = self.custom() {
for key in custom.keys() {
if let Some(custom) = other.custom() {
if custom.contains_key(key) {
match (&self.custom, &other.custom) {
(Some(self_custom), Some(other_custom)) => {
for self_key in self_custom.keys() {
if other_custom.contains_key(self_key) {
return false;
}
} else {
return true;
}
true
}
} else {
return true;
_ => true,
}
true
}
}
}

Expand Down

0 comments on commit 058d336

Please sign in to comment.