during the node start (hard hat) I'm able to read the accounts and private keys.
I don't understand how can I retrieve it again with hard hat console
npx hardhat console
I injected even web3 library but I'm able to retrieve only the addresses.
web3:
await web3.eth.getAccounts()
ethers.js
[owner, addr1] = await ethers.getSigners()
Private keys, even of unlocked accounts, are not shared over the JSON-RPC API.
Which means, you are not able to retrieve them using web3js, ethers.js, or any other wrapper of the API.