Getting error with @tkey/private-keys - getTKeyStore

I was trying to use the private key module of the @tkey/private-keys, but I’m getting an error.
I’m using a simple node.js repo, I tried with javascript and typescript both failed. I’m using the latest version and tried older versions, always the same error.

const { PrivateKeyModule, SECP256K1Format } = require("@tkey/private-keys");

const { BN } = require("bn.js");

async function main() {
  const privateKeyInput = new BN(
    "4bd0041b7654a9b16a7268a5de7982f2422b15635c4fd170c140dc4897624390",
    "hex"
  );
  console.log("privateKeyInput:", privateKeyInput);

  const secp256k1 = new SECP256K1Format(privateKeyInput);
  console.log("secp256k1.privateKey:", secp256k1.privateKey.toString("hex"));

  const privateKeyModule = new PrivateKeyModule([secp256k1]);

  const result1 = await privateKeyModule.getPrivateKeys();
  console.log("result1:", result1);
  const result2 = await privateKeyModule.getAccounts();
  console.log("result2:", result2);
}

main().catch((error) => {
  console.error(error);
  process.exitCode = 1;
});

@hanzelmetal Welcome Aboard!

Your issue is under review and we will get back with further updates.

1 Like

Is there any news regarding this issue?

May I know what you try to use it for?
You are using it wrong.
This module need to used together with the tkey

I’m new to this. I was trying to verify that I can use web3Auth to import an existing private key instead of creating a new one. My idea is to create a quick test, what is missing in this case?