implementing-hardware-security-key-authentication
Implements authentication with FIDO2/WebAuthn hardware security keys. Covers registration, authentication, and resident credential (passkey) workflows.
What it does
This tool helps create a secure login system using physical security keys (like YubiKey) or your device's features (like fingerprint). It replaces or complements passwords, making access harder for hackers.
When to use it
- ✓When you want to protect important accounts with an extra security method.
- ✓When building a website or app that needs more secure logins.
- ✓To allow people to log in without passwords, using only the security key.
Example of what to ask your AI
“Set up secure login for my website using security keys.”
Want more? Open the sections below.
How to use
The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.
Skill link
Ready-to-paste message
How it works
The tool configures the server to communicate with the security key. It manages the registration of new keys and their verification during login, ensuring only the key owner can access.
Installation
Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.
In the terminal (Claude Code, Codex, Cursor), in your project folder:
npx skills add mukul975/Anthropic-Cybersecurity-Skills --skill implementing-hardware-security-key-authenticationOr download just the file:
curl -L https://raw.githubusercontent.com/mukul975/Anthropic-Cybersecurity-Skills/main/skills/implementing-hardware-security-key-authentication/SKILL.md -o SKILL.mdTechnical content (original SKILL.md)
Original text by the author, straight from GitHub.
Implementing Hardware Security Key Authentication
When to Use
- Deploying phishing-resistant multi-factor authentication (MFA) using FIDO2 hardware security keys for high-value accounts (administrators, developers, privileged users)
- Building a WebAuthn relying party server that supports both roaming authenticators (USB/NFC security keys) and platform authenticators (Windows Hello, Touch ID, Android biometrics)
- Migrating an existing password-based authentication system to support passkeys (discoverable credentials) as a primary or secondary authentication factor
- Enrolling YubiKey devices for an organization's workforce, including PIN setup, credential registration, and backup key provisioning
- Implementing passwordless authentication flows that comply with NIST SP 800-63B AAL3 (authenticator assurance level 3) requirements
Do not use without HTTPS in production (WebAuthn requires a secure origin), for systems where users cannot physically access a USB/NFC port, or as the sole authentication factor without a recovery mechanism for lost keys.
Prerequisites
- Python 3.10+ with
fido2(python-fido2 >= 2.0.0),flask, andcryptographylibraries installed - HTTPS-enabled web server (WebAuthn API requires secure context; localhost is exempt for development)
- FIDO2-compatible hardware security key (YubiKey 5 Series, SoloKeys, Titan Security Key) or platform authenticator
- Modern web browser supporting the WebAuthn API (Chrome 67+, Firefox 60+, Safari 14+, Edge 79+)
- Understanding of public key cryptography, challenge-response protocols, and HTTP session management
Workflow
Step 1: Relying Party Server Configuration
Configure the WebAuthn relying party (RP) identity and server:
- Define RP identity: Create a
PublicKeyCredentialRpEntitywith the relying party name (display name shown to users) and RP ID (the effective domain of the application). The RP ID must be a registrable domain suffix of the origin -- for example,example.comis valid forhttps://auth.example.combutother.comis not. - Initialize Fido2Server: Instantiate the
Fido2Serverclass from the python-fido2 library with the RP entity. The server handles challenge generation, attestation verification, and assertion validation. - Configure attestation preference: Set the attestation conveyance preference to control whether the server requests proof of the authenticator's identity:
none: No attestation requested (simplest, recommended for most deployments)indirect: Attestation may be provided but CA may anonymize itdirect: Full attestation chain from the authenticator's manufacturerenterprise: Device-identifying attestation for managed environments
- Session management: Configure server-side sessions to store WebAuthn state between the begin and complete phases of registration/authentication ceremonies. Use secure, httponly cookies with SameSite=Strict.
- Credential storage: Design the database schema to store credential records:
credential_id(binary),public_key(COSE key),sign_count(uint32 for clone detection),user_id,created_at,last_used,display_name, andtransports(USB, NFC, BLE, internal).
Step 2: Registration Ceremony (Credential Creation)
Implement the WebAuthn registration flow to create new credentials:
- Begin registration: Call
server.register_begin()with the user entity (PublicKeyCredentialUserEntitycontaining user ID, username, and display name), the list of existing credentials for the user (to prevent duplicate registration), and options foruser_verificationandauthenticator_attachment. - Authenticator selection criteria:
authenticator_attachment: cross-platformrestricts to roaming authenticators (USB/NFC keys)authenticator_attachment: platformrestricts to built-in authenticators (Touch ID, Windows Hello)- Omitting this field allows both types
resident_key: requiredforces creation of a discoverable credential (passkey) stored on the authenticatoruser_verification: requiredenforces PIN or biometric verification on the authenticator
- Client-side ceremony: The browser calls
navigator.credentials.create()with the options from the server. The authenticator generates a new key pair, stores the private key in its secure element, and returns the public key, credential ID, attestation object, and client data JSON.
…
FAQ
Do I need a physical security key?
Not necessarily. You can use physical keys (like YubiKey) or your computer/phone's features, such as Windows Hello or Touch ID.
What does 'phishing-resistant' mean?
It means the system is much harder to trick via fake emails or websites, as it relies on a physical device or biometrics that a hacker doesn't have.
Can I use this on any website?
It's ideal for websites and apps you are building or managing. For websites you only use, you can enable this option if the website offers it.
Details
Original description by the author
Builds a FIDO2/WebAuthn relying party server with the python-fido2 library, covering registration and authentication ceremonies, YubiKey enrollment, resident key (discoverable credential/passkey) workflows, and user verification policies. Use when implementing phishing-resistant MFA with hardware security keys, building a WebAuthn relying party, enrolling YubiKeys for a workforce, or migrating pas
Popularity
- GitHub stars
- 35k
- Ranking position
- #5888
- License
- Apache-2.0
- Updated
- 8/31/2026
Comments
- …
More skills from this repository
abusing-dpapi-for-credential-access
Gives your AI agent ready-made instructions for a specific task, so it does it better and faster.
mukul975/Anthropic-Cybersecurity-Skills
abusing-shadow-credentials-for-privesc
Teaches your AI agent to write clear, well-structured text.
mukul975/Anthropic-Cybersecurity-Skills
achieving-cmmc-level-2-compliance
Helps your agent prepare an environment for CMMC Level 2 compliance. It implements security requirements and manages necessary documentation.
mukul975/Anthropic-Cybersecurity-Skills
acquiring-disk-image-with-dd-and-dcfldd
Helps your agent create exact copies of hard drives. This is useful for ensuring no information is lost or altered during investigations.
mukul975/Anthropic-Cybersecurity-Skills
Similar skills
django-security
Helps your agent implement security practices in Django applications. It focuses on authentication, authorization, and prevention against common attacks, ensuring more secure code.
affaan-m/ECC
laravel-security
Helps your agent secure Laravel applications against threats. Implements security practices for authentication, authorization, and common attack prevention.
affaan-m/ECC
module-regression
Helps your agent manage changes in large projects. Ensures code changes in one part don't break other parts.
affaan-m/ECC