Crypto React
    Preparing search index...

    Function useKeypair

    • React hook for generating cryptographic key pairs.

      Parameters

      • defaultAlgorithm:
            | "ed25519"
            | "x25519"
            | "ed448"
            | "x448"
            | "p256"
            | "p384"
            | "ml-kem-512"
            | "ml-kem-768"
            | "ml-kem-1024"
            | "ml-dsa-44"
            | "ml-dsa-65"
            | "ml-dsa-87" = "ed25519"

        Algorithm to use when none is passed to generate(). Defaults to "ed25519".

      Returns UseKeypairResult

      function MyComponent() {
      const { publicKey, generate, isGenerating } = useKeypair();
      return <button onClick={() => generate("x25519")}>{publicKey ?? "Generate"}</button>;
      }