DEV Community

Ankit Nepal
Ankit Nepal

Posted on

Passkeys: Beyond Passwords - A Technical Deep Dive into Modern Authentication

In recent years, a new approach that offers improved security and usability passkeys has emerged to replace the decades-old username-password login mechanism. Since big digital companies like Apple, Google, and Microsoft are pushing for passwordless logins, passkeys provide a creative way to access your preferred websites and apps. Consider the benefits and drawbacks before implementing a passkey-only login system for your users.

Passkeys: What Are They?
Cryptographic keys are used in passkeys, a type of passwordless authentication. They make use of public-key cryptography, in which a user is authenticated via a pair of keys (public and private). Passkeys are safely kept on the user's device rather than depending on a password that is kept on a server. Requests for authentication are signed by the device using the private key, and the server verifies them using the matching public key.

*Passkey benefits include: *

  1. Increased security
    Passkeys' improved security is one of its main advantages. Despite their strength, passwords are susceptible to data breaches, brute-force assaults, and phishing. By guaranteeing that the private key never leaves the user's device, passkeys remove these dangers.

  2. Improved User Experience
    It is no longer necessary for users to memorize complicated passwords or deal with the inconvenience of changing them when they are forgotten. Passkeys, which usually use a PIN or biometrics (facial recognition or fingerprint), streamline the authentication procedure. This offers a quick and easy login process.

  3. No danger of phishing
    The user never manually enters a password, so phishing assaults cannot fool them into divulging credentials. The private key is utilized securely without exposing private data to possible attacks thanks to the passkey-based login procedure.

  4. Integration of Devices
    Hardware security modules (HSMs) or secure enclaves are built into modern devices to safely store cryptographic keys. These hardware characteristics are frequently used by passkey solutions, which provide robust defense against unwanted access.

*Disadvantages of Passkeys *

  1. Device Dependency
    The fact that passkeys are connected to the user's device is one of the main disadvantages. Restoring access to accounts after a device is lost, broken, or replaced may be more difficult than simply changing the password. Users must make sure that their passkeys are backed up or moved to different devices, usually using cloud syncing tools like Google's Password Manager or Apple's iCloud Keychain.

  2. Compatibility and Adoption
    Even while passkeys are becoming more popular, not all services and platforms now support them. Users who are not prepared to embrace the technology or who use devices that do not enable passkey creation and storage may become hostile if a passkey-only solution is implemented.

  3. Instruction for Users
    Passkeys are still a novel and strange idea to many people. To prevent misunderstanding and annoyance, it is essential to teach users how to utilize passkeys, including recovery options and multi-device management. Otherwise, the enhanced usability and security might not be fully realized.

  4. Limited Usability Across Devices
    Passkeys function flawlessly on a single device, but they might not function as well when used on several, particularly when switching between platforms or operating systems. Although cross-device login processes are getting better, more has to be done to guarantee a completely seamless experience.

Making Passwords Optional: What’s Important When Users Can Delete Their Passwords?
Many businesses are making passwords optional as the digital world moves toward passwordless authentication. The popularity of passkeys and other contemporary authentication techniques, which offer increased security and convenience, is what is driving this change. However, there are crucial security and user experience factors to take into account when allowing users to completely erase their passwords.

Why Make Passwords Optional?
Users find it difficult to come up with secure, one-of-a-kind passwords, and they are often exposed by data breaches. Companies can provide a more secure and efficient login experience by making passwords optional, particularly when passkeys or other passwordless methods are utilized. Allowing users to change their passwords, however, adds complications that must be properly handled.

Key Considerations When Allowing Users to Delete Passwords

  1. Safe Alternative Techniques for Authentication Users must have a safe backup in case they decide to change their passwords. Potential substitutes include passkeys, biometrics (such as fingerprint or Face ID), or one-time authentication links (sent by SMS or email). These techniques must be robust enough to provide an equivalent or higher level of security than passwords.

For instance, compared to conventional passwords, passkeys, which employ public-key encryption, are far more difficult to crack. On the other hand, users must know how to secure and manage their passkeys on their devices.

  1. Options for Fallback and Recovery
    Even if a user loses access to their primary authentication method—for example, if they misplace a device that has their passkeys—they ought to be able to retrieve their account. Recovery techniques could consist of:
    Pre-generated backup codes
    Safe recovery with SMS or email
    Recovery of social or trusted contacts

  2. Instruction for Users
    Many users are still confused with passkeys and other passwordless methods. When letting users change their passwords, you must provide them explicit instructions on how to handle their devices and utilize the other options. For example, users need to understand how to keep their data safe, restore access in the event that they misplace a device, and sync their passkeys between devices.

Using Passkeys as a Password Replacement vs. for MFA
Passkeys are becoming more and more important as passwordless solutions gain traction. Now, businesses must decide whether to utilize passkeys as part of multi-factor authentication (MFA) or to completely replace passwords. Both strategies have advantages, but they accomplish distinct goals.

Passkeys as a Password Replacement
Passkeys offer a simplified, one-step authentication method when they are utilized to completely replace passwords. There is no need to manage or remember a password when users authenticate using a biometric or device-based key. This can significantly lower user friction and increase security.

Benefits:
Increased Security: Passkeys reduce the possibility of password-based attacks such brute-force attempts, phishing, and credential stuffing.

Simplified User Experience: Password managers, lost credentials, and password management are no longer necessary for users. Access is unlocked by a PIN or a basic biometric.

Device-Based Trust: Passkeys are far more difficult to hack than passwords since their security is linked to a device's protected hardware.

Challenges:
Device Dependency: Without a robust recovery procedure in place, a user may lose access to their account if they misplace their device or forget to sync their passkeys across devices.

User Familiarity: If a user is unfamiliar with passkeys, they may be reluctant to completely adopt a passwordless system.

Passkeys for Multi-Factor Authentication:
While passkeys can serve as a primary authentication method,
they can also enhance security as part of MFA:
Implementation Strategies

1.Sequential Verification

async function authenticateWithMFA(user) {
    // First factor: password
    await verifyPassword(user, password);

    // Second factor: passkey
    const assertion = await navigator.credentials.get({
        publicKey: challengeOptions
    });

    return verifyAssertion(assertion);
}

Enter fullscreen mode Exit fullscreen mode
  1. Risk Based Authentication:
function determineAuthenticationRequirements(context) {
    const riskScore = calculateRiskScore(context);

    return {
        requirePassword: riskScore > LOW_RISK_THRESHOLD,
        requirePasskey: riskScore > MEDIUM_RISK_THRESHOLD
    };
}

Enter fullscreen mode Exit fullscreen mode

Conclusion
Passkeys are a major advancement in the security and usability of authentication. The technical architecture and user experience must be carefully considered whether adopting them as a primary authentication mechanism or as part of MFA. We may anticipate a wider uptake of this technology as consumers grow more accustomed to passkeys and browser support keeps becoming better.
Starting with a hybrid approach enables developers wishing to implement passkeys to make the switch gradually while preserving compatibility with current systems. For many applications, switching to a passkey-only system becomes more feasible as the ecosystem develops.
Keep in mind that a good balance between security needs and user experience is necessary for successful deployment. Your authentication system's development should be guided by frequent testing and user input.

Top comments (0)