mirror of
https://github.com/pretix/pretix.git
synced 2026-05-04 15:04:03 +00:00
Replace U2F with WebAuthn (#1392)
* Replace U2F with WebAuthn * Imports * Fix backwards compatibility * Add explanatory comment * Fix tests
This commit is contained in:
24
src/pretix/helpers/webauthn.py
Normal file
24
src/pretix/helpers/webauthn.py
Normal file
@@ -0,0 +1,24 @@
|
||||
import random
|
||||
import string
|
||||
|
||||
|
||||
def generate_challenge(challenge_len):
|
||||
return ''.join([
|
||||
random.SystemRandom().choice(string.ascii_letters + string.digits)
|
||||
for i in range(challenge_len)
|
||||
])
|
||||
|
||||
|
||||
def generate_ukey():
|
||||
"""
|
||||
Its value's id member is required, and contains an identifier
|
||||
for the account, specified by the Relying Party. This is not meant
|
||||
to be displayed to the user, but is used by the Relying Party to
|
||||
control the number of credentials - an authenticator will never
|
||||
contain more than one credential for a given Relying Party under
|
||||
the same id.
|
||||
A unique identifier for the entity. For a relying party entity,
|
||||
sets the RP ID. For a user account entity, this will be an
|
||||
arbitrary string specified by the relying party.
|
||||
"""
|
||||
return generate_challenge(20)
|
||||
Reference in New Issue
Block a user