Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def assertion_dict(self):
if not isinstance(self.webauthn_users, list) or len(self.webauthn_users) < 1:
raise AuthenticationRejectedException('Invalid user list.')
if len(set([u.rp_id for u in self.webauthn_users])) != 1:
raise AuthenticationRejectedException('Invalid (mutliple) RP IDs in user list.')
for user in self.webauthn_users:
if not isinstance(user, WebAuthnUser):
raise AuthenticationRejectedException('Invalid user type.')
if not user.credential_id:
raise AuthenticationRejectedException('Invalid credential ID.')
if not self.challenge:
raise AuthenticationRejectedException('Invalid challenge.')
acceptable_credentials = []
for user in self.webauthn_users:
acceptable_credentials.append({
'type': 'public-key',
'id': user.credential_id,
'transports': ['usb', 'nfc', 'ble', 'internal'],
})
assertion_dict = {
'challenge': self.challenge,