mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-20 14:29:25 -04:00
add webauthn crud endpoints
added some simple validation to the delete endpoint for sanity, but generally my assumption is that more validation will happen on the admin side. noteably im not checking whether the credentials are duplicated, nor is there a uniqueness constraint in the database - I'm not sure if the credential blob will always reliably be equivalent, and I believe the browser should hopefully take care of dupes.
This commit is contained in:
@@ -74,6 +74,7 @@ from app.models import (
|
||||
Template,
|
||||
TemplateFolder,
|
||||
User,
|
||||
WebauthnCredential,
|
||||
)
|
||||
|
||||
|
||||
@@ -1202,3 +1203,22 @@ def create_broadcast_provider_message(
|
||||
db.session.add(provider_message_number)
|
||||
db.session.commit()
|
||||
return provider_message
|
||||
|
||||
|
||||
def create_webauthn_credential(
|
||||
user,
|
||||
name='my key',
|
||||
*,
|
||||
credential_data='ABC123',
|
||||
registration_response='DEF456',
|
||||
):
|
||||
webauthn_credential = WebauthnCredential(
|
||||
user=user,
|
||||
name=name,
|
||||
credential_data=credential_data,
|
||||
registration_response=registration_response
|
||||
)
|
||||
|
||||
db.session.add(webauthn_credential)
|
||||
db.session.commit()
|
||||
return webauthn_credential
|
||||
|
||||
Reference in New Issue
Block a user