Skip to content

Commit

Permalink
chore: expose Claims is_within_time_window as pub (#794)
Browse files Browse the repository at this point in the history
* chore: expose Claims is_within_time_window as pub

* expose with_current_timestamp
  • Loading branch information
Rjected authored May 28, 2024
1 parent b11b2f5 commit fb2ff0d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/rpc-types-engine/src/jwt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ pub struct Claims {

impl Claims {
/// Creates a new instance of [`Claims`] with the current timestamp as the `iat` claim.
fn with_current_timestamp() -> Self {
pub fn with_current_timestamp() -> Self {
Self { iat: get_current_timestamp(), exp: None }
}

/// Checks if the `iat` claim is within the allowed range from the current time.
fn is_within_time_window(&self) -> bool {
pub fn is_within_time_window(&self) -> bool {
let now_secs = get_current_timestamp();
now_secs.abs_diff(self.iat) <= JWT_MAX_IAT_DIFF.as_secs()
}
Expand Down

0 comments on commit fb2ff0d

Please sign in to comment.