Demos Network Specifications
  • Introduction
    • What is Demos Network
    • Demos Network Architecture
  • FAQ
  • Cookbook
    • Project setup
      • Run the project (MacOS)
      • Run the project (Windows)
        • WSL 2 Setup on Windows (10 and 11 only)
        • Issue Troubleshooting
      • Run the project (Ubuntu)
  • SDK
    • Getting Started
    • WebSDK
      • Authentication
        • FIDO2 Passkeys
          • Under the Hood: FIDO2 Passkeys
      • NodeCalls
      • Transactions
        • Creating a transaction
        • Signing a transaction
        • Broadcasting a transaction
      • L2PS SDK
        • The l2ps module
        • Interacting with the L2PS
        • L2PS Messaging System
      • Instant Messaging
        • What is the Instant Messaging Protocol?
        • Architecture Overview
        • Encryption
        • Quickstart
        • Message Types
        • API Reference
        • FAQ
    • Cross Chain
      • General layout of the XM SDKs
      • EVM
      • BTC
      • Solana
      • MultiversX (EGLD)
      • NEAR
      • IBC
      • TON
      • XRPL
      • The XMScript
      • Identities
    • Demoswork
    • Cookbook
      • Demoswork
        • Creating work steps
        • Conditional Operation
        • Base Operation
        • Signing and broadcasting
      • Transactions
        • Crosschain Transaction
        • Native Transactions
      • SWAP
        • Crosschain SWAP
    • Web2
      • Quick Start
      • DAHR API Reference
        • Types
      • Making Requests
      • Identities
        • Twitter
        • GitHub
    • API Reference
    • Bridges
      • Rubic Bridge Test
    • Post Quantum Cryptography
  • Backend
    • Internal Mechanisms
      • Network Time Synchronization
      • Cross Context Identities
    • Global Change Registry
      • GCR Structure
      • How is GCR Synced?
    • Consensus Mechanism
      • Unparalleled Scalability
      • Decentralization in PoR-BFT
      • Enhanced Security
      • Comparative Advantage
      • Addressing Potential Criticisms
      • Conclusion
    • Communications Stack
    • L2PS (Subnet) Framework
      • How are L2PS transactions handled?
    • Miscellaneous
      • Browsing the Postgres DB via psql
    • Bridges
      • Rubic Bridge
    • Developers Testbed
      • Setting up the environment
      • Setting up the repository
      • Installing dependencies
      • Node Configuration
      • Running the node
  • Frontend
    • Demos Providers Discovery Mechanism
Powered by GitBook
On this page
  • The Python module: hmywallet
  • The Typescript Wrapper: passkeys.ts
  1. SDK
  2. WebSDK
  3. Authentication
  4. FIDO2 Passkeys

Under the Hood: FIDO2 Passkeys

This chapter provides a detailed explanation of how hmywallet, along with its Demos wrapper, securely leverages a FIDO2 device to accurately derive valid private keys.

The Python module: hmywallet

fido2

The fido2 module allows hmywallet to interact with your FIDO2 device.

Main module

The script initiates by creating a client through the detection of the FIDO2 device. Afterward, the cred_manager submodule verifies the presence of data/credential.pkl and generates it if it is not found.

Creating the credential file requires interacting with the FIDO2 device to generate an appropriate hmac_secret based on predefined user and rp fields, along with a random 16-byte challenge. Additionally, this process encrypts the credential file using a password that the user must enter each time to unlock the wallet.

Storing the file along with the password ensures that the key remains deterministic, consistently generating the same key given the correct credentials. Note that entering an incorrect password will not raise any errors but will yield a completely different private key.

Finally, the credentials are retrieved using the password hash as a salt. This results in a secret that, once hashed, represents the private key of the user.

The Typescript Wrapper: passkeys.ts

This file is a very simple wrapper that manages safe execution and output retrieval from the hmywallet module.

The wrapper exports a PasskeyGenerator class that contains a .generate() method. This async method calls the generate.sh script inside the hmywallet folder, which automatically manages the module dependencies and kickstart the process above.

By reading the output of hmywallet module, the .generate() method returns the above mentioned private key.

PreviousFIDO2 PasskeysNextNodeCalls

Last updated 7 months ago