@edgefirst-dev/jwt - v1.3.0
    Preparing search index...

    Function generateKeyPair

    • Generates a new cryptographic key pair using the specified algorithm.

      The keys are generated in an extractable format to allow export and import.

      Parameters

      • alg: Algoritm

        The algorithm to use for key generation.

      Returns Promise<
          {
              alg: Algoritm;
              created: number;
              id: `${string}-${string}-${string}-${string}-${string}`;
              privateKey: string;
              publicKey: string;
          },
      >

      A promise that resolves to an object containing the generated key pair.

      const keyPair = await JWK.generateKeyPair(JWK.Algoritm.ES256);
      console.log(keyPair);