Skip to content

Commit

Permalink
Fix examples
Browse files Browse the repository at this point in the history
  • Loading branch information
dainnilsson committed Sep 20, 2024
1 parent 05d3bec commit 4031c3c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
8 changes: 6 additions & 2 deletions examples/credential.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
from fido2.hid import CtapHidDevice
from fido2.client import Fido2Client, WindowsClient, UserInteraction
from fido2.server import Fido2Server
from fido2.webauthn import PublicKeyCredentialRpEntity, PublicKeyCredentialUserEntity
from getpass import getpass
import sys
import ctypes
Expand Down Expand Up @@ -84,9 +85,12 @@ def request_uv(self, permissions, rd_id):
print("Authenticator supports User Verification")


server = Fido2Server({"id": "example.com", "name": "Example RP"}, attestation="direct")
server = Fido2Server(
PublicKeyCredentialRpEntity(id="example.com", name="Example RP"),
attestation="direct",
)

user = {"id": b"user_id", "name": "A. User"}
user = PublicKeyCredentialUserEntity(id=b"user_id", name="A. User")


# Prepare parameters for makeCredential
Expand Down
9 changes: 7 additions & 2 deletions examples/resident_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
from fido2.hid import CtapHidDevice
from fido2.client import Fido2Client, WindowsClient, UserInteraction
from fido2.server import Fido2Server
from fido2.webauthn import PublicKeyCredentialRpEntity, PublicKeyCredentialUserEntity
from getpass import getpass
import sys
import ctypes
Expand Down Expand Up @@ -87,9 +88,13 @@ def request_uv(self, permissions, rd_id):
uv = "preferred"
print("Authenticator supports User Verification")

server = Fido2Server({"id": "example.com", "name": "Example RP"}, attestation="direct")
server = Fido2Server(
PublicKeyCredentialRpEntity(id="example.com", name="Example RP"),
attestation="direct",
)

user = PublicKeyCredentialUserEntity(id=b"user_id", name="A. User")

user = {"id": b"user_id", "name": "A. User"}

# Prepare parameters for makeCredential
create_options, state = server.register_begin(
Expand Down

0 comments on commit 4031c3c

Please sign in to comment.