Skip to content

cryptographic key generation issue with Turnkey's in-browser API key generation feature, pleade look into it #882

@khushzynk09

Description

@khushzynk09

Turnkey API Key Generation Bug Report

Issue Summary

Turnkey API key generation produces invalid cryptographic key pairs that cannot be used for authentication.

Environment

Steps to Reproduce

  1. Go to Turnkey dashboard
  2. Navigate to API Keys section
  3. Click "Create API key"
  4. Select "Generate API keys in-browser"
  5. Provide API key name (e.g., "gen-1", "gen-2")
  6. Download the generated JSON file
  7. Use the keys in Turnkey SDK

Expected Behavior

  • Generated public and private keys should form a valid P-256 cryptographic pair
  • Keys should work with Turnkey SDK authentication

Actual Behavior

  • Generated keys are mathematically invalid
  • Public key cannot be derived from private key
  • Turnkey SDK rejects keys with error: "unable to load API key: invalid public key"

Evidence

First API Key Generation (gen-1)

  • Public Key: 022fbd14baec3997747e817ac24d3ea6098461be7183a7e856f816eaa3bd816149
  • Private Key: cd706...2a35
  • Curve Type: API_KEY_CURVE_P256
  • Status: ❌ Invalid key pair

Second API Key Generation (gen-2)

  • Public Key: 035e771436b1adf475ae715ccdd96824ae03a521b144251d47a2ffc2c770926362
  • Private Key: a296...c65b
  • Curve Type: API_KEY_CURVE_P256
  • Status: ❌ Invalid key pair

Technical Details

  • Both keys are 66-character public keys and 64-character private keys
  • Keys are in correct hex format with no encoding issues
  • Node.js crypto module confirms keys are not valid ECDSA pairs
  • Turnkey SDK validation fails at convertTurnkeyApiKeyToJwk function

Impact

  • Cannot authenticate with Turnkey API
  • Cannot use Turnkey SDK for any operations
  • Blocks development and testing of Turnkey integration

Request

Please investigate and fix the API key generation algorithm to ensure valid cryptographic key pairs are produced.

Contact

  • User: [email protected]
  • Organization ID: e336c77b-d34b-4bf2-87bd-0ffb2b9d84e2
  • Report Date: August 30, 2025

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions