### Run Local Tests with Tox Source: https://github.com/dany74q/ctap-keyring-device/blob/main/README.rst Instructions to run local tests for the project. It requires installing and invoking the 'tox' tool, which is a common Python package for automating testing. ```Shell tox ``` -------------------------------- ### Get Assertion Flow with CTAP Keyring Device Source: https://github.com/dany74q/ctap-keyring-device/blob/main/README.rst Illustrates the get-assertion flow using CtapKeyringDevice and Fido2Client. It configures the challenge, RP ID, allowed credentials, and timeout for retrieving assertions. ```Python from fido2.webauthn import PublicKeyCredentialRequestOptions, PublicKeyCredentialType, \ PublicKeyCredentialParameters, PublicKeyCredentialDescriptor, UserVerificationRequirement from ctap_keyring_device.ctap_keyring_device import CtapKeyringDevice from fido2.client import Fido2Client from fido2 import cose import base64 device = CtapKeyringDevice.list_devices()[0] origin = 'https://rp.pasten.com' client = Fido2Client(device, origin) challenge = base64.b64encode(b'my-challenge') rp = {'id': 'pasten.com', 'name': origin[8:], 'icon': '...'} credential_id = b'.......' allow_list = [ PublicKeyCredentialDescriptor(PublicKeyCredentialType.PUBLIC_KEY, credential_id) ] timeout_ms = 30_000 pub_key_cred_params = [PublicKeyCredentialParameters(PublicKeyCredentialType.PUBLIC_KEY, cose.ES256.ALGORITHM)] options = PublicKeyCredentialRequestOptions(challenge=challenge, rp_id=rp['id'], allow_credentials=allow_list, timeout=timeout_ms, user_verification=UserVerificationRequirement.PREFERRED) assertions, client_data = client.get_assertion(options) ``` -------------------------------- ### Make Credential Flow with CTAP Keyring Device Source: https://github.com/dany74q/ctap-keyring-device/blob/main/README.rst Demonstrates the make-credential flow using CtapKeyringDevice and Fido2Client. It sets up the origin, RP, user, challenge, and credential parameters to create a public key credential. ```Python from fido2.webauthn import PublicKeyCredentialCreationOptions, PublicKeyCredentialType, PublicKeyCredentialParameters from ctap_keyring_device.ctap_keyring_device import CtapKeyringDevice from fido2.client import Fido2Client from fido2 import cose import base64 device = CtapKeyringDevice.list_devices()[0] origin = 'https://rp.pasten.com' client = Fido2Client(device, origin) rp = {'id': 'pasten.com', 'name': origin[8:], 'icon': '...'} user = {'id': 'danny@pasten.io', 'name': 'Danny Shemesh', 'icon': '...', 'displayName': 'Danny Pastanny'} challenge = base64.b64encode(b'my-challenge') timeout_ms = 30_000 pub_key_cred_params = [PublicKeyCredentialParameters(PublicKeyCredentialType.PUBLIC_KEY, cose.ES256.ALGORITHM)] options = PublicKeyCredentialCreationOptions(rp, user, challenge, pub_key_cred_params, timeout=timeout_ms) attestation, client_data = client.make_credential(options) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.