Skip to content

Commit

Permalink
nbf should be allowed to be equal to iat
Browse files Browse the repository at this point in the history
  • Loading branch information
francislavoie authored Mar 7, 2024
1 parent 72c5fe0 commit f98168b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ export function parsePayload(payload: string | Payload | Uint8Array, {
throw new PasetoClaimInvalid("Payload must have a valid \"nbf\" claim (is not an date or a valid relative time string (e.g. \"1 hour\"))");
}
// The "nbf" claim must be greater than the "iat" claim
if (obj.hasOwnProperty("iat") && nbf <= Date.parse((obj as any).iat)) {
if (obj.hasOwnProperty("iat") && nbf < Date.parse((obj as any).iat)) {
throw new PasetoClaimInvalid("Payload must have a valid \"nbf\" claim (is not greater than \"iat\")");
}
// The "nbf" claim must not be in the future
Expand Down Expand Up @@ -385,4 +385,4 @@ export function deriveEncryptionAndAuthKeys(key: Uint8Array, nonce: Uint8Array)
counterNonce,
authKey,
}
}
}

0 comments on commit f98168b

Please sign in to comment.