CNSA-276-FP/tet.py

22 lines
703 B
Python
Raw Normal View History

2024-04-26 20:45:27 -04:00
from fido2.server import Fido2Server
from fido2.webauthn import PublicKeyCredentialRpEntity
rp = PublicKeyCredentialRpEntity("example.com", "Example RP")
server = Fido2Server(rp)
registration_data, state = server.register_begin({
"91974": b"user_id", # user ID as bytes
"Cyrus": "cyrus@eggtech.net",
"displayName": "Admin"
})
from fido2.client import Fido2Client
from fido2.hid import CtapHidDevice
# List FIDO devices on the system
devices = list(CtapHidDevice.list_devices())
if not devices:
raise ValueError("No FIDO device found")
device = devices[0]
client = Fido2Client(device, "https://example.com")
attestation_object, client_data = client.make_credential(registration_data)