With the current version of @solana/web3.js
, we can recreate a keypair from a saved secretkey:
const keypair = Keypair.fromSecretKey(secretKey)
The new version of @solana/web3.js
has a generateKeyPair()
function that returns a CryptoKeyPair
.
const keypair = await generateKeyPair();
interface CryptoKeyPair {
privateKey: CryptoKey;
publicKey: CryptoKey;
}
How do you convert a secretkey to a CryptoKeyPair
that can be used with the new version of @solana/web3.js
?