-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #198 from duo-labs/fix/document-default-challenge-…
…length fix/document-default-challenge-length
- Loading branch information
Showing
4 changed files
with
12 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
import secrets | ||
|
||
|
||
def generate_challenge(length: int = 64) -> bytes: | ||
def generate_challenge() -> bytes: | ||
""" | ||
Generate a random authenticator challenge | ||
Create a random value for the authenticator to sign, going above and beyond the recommended | ||
number of random bytes as per https://www.w3.org/TR/webauthn-2/#sctn-cryptographic-challenges: | ||
"In order to prevent replay attacks, the challenges MUST contain enough entropy to make | ||
guessing them infeasible. Challenges SHOULD therefore be at least 16 bytes long." | ||
""" | ||
return secrets.token_bytes(length) | ||
return secrets.token_bytes(64) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters