Skip to content

Commit

Permalink
Merge pull request #8 from francislavoie/patch-1
Browse files Browse the repository at this point in the history
`nbf` should be allowed to be equal to `iat`
  • Loading branch information
miunau committed Mar 7, 2024
2 parents 72c5fe0 + f98168b commit 1699604
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 1699604

Please sign in to comment.