Git Product home page Git Product logo

android-passkey-example's Introduction

Android Passkey Example

License

Licence

The purpose of this demo application is to showcase the implementation of passkeys in a native Android application. It also serves as an example for developers who want to incorporate passkey authentication in their own app. This application requires Android 14 or higher.

What is a passkey?

Passkeys are a replacement for passwords. A password is something that can be remembered and typed, and a passkey is a secret stored on one’s devices, unlocked with biometrics.

You can learn more about passkeys here: https://passkeys.dev/docs/intro/what-are-passkeys/

Features

You can create a passkey and sign in to this demo application. It's possible thanks to the Credential Manager API which brings passkey support to Android 14. The WebAuthn spec this is based on can be found here: WebAuthn.

All accounts are stored locally (in shared preferences), which means that if you uninstall or clear data, your account will be lost. This app does not require any network resource.

During the sign in flow, a challenge, which is just some random bytes, is generated by the website/service (commonly referred to as the relying party). This challenge is sent to the authenticator via the app, where it is signed with the private key of the passkey. The signed challenge is then returned to the relying party to be verified. In this expample app the challenge is verified locally within the app - note that this is usually done by a server.

You can sign in to a specific account by entering an email that already exists in the local database. By doing that, the allowCredentials attribute of a passkey request will be set with a related UserID, and only this credential can be returned by the authenticator.

How to Test the Application

You can clone and build this application to generate a debug APK, or you can directly download the APK from the GitHub "Release" section.

Contributing

We are open to contributions. Feel free to submit a pull request with your changes. Here are some features that could be added to this application:

  • Add other supported algorithms from this list
  • Remove a specific local account without the need to uninstall or remove all data
  • Upgrade the Credential Manager library to the latest version

License

This project is licensed under the Apache 2.0 License.

android-passkey-example's People

Contributors

gbouxin-dashlane avatar irew avatar guillaumebouxin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.