22 lines
703 B
Python
22 lines
703 B
Python
|
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)
|