Thanks to everyone above for the great commentary, really was nice to follow as I started troubleshooting not being able to load in my existing dfx principal via agent-js (I received the same different dfx and node principals as everyone else).
Since it did take me a bit of time to get through it all, hopefully these steps make it easier for those of you running into a similar issue (as of the time of this post).
Steps
- Navigate to my .dfx identities →
~/.config/.dfx/identity
- Create a new identity →
mkdir local-testing; cd local-testing
- Download quill since keysmith is now deprecated.
- Test that quill is installed correctly →
quill
- Look up how to generate a key →
quill generate --help
- Generate a key and seed file →
quill generate --pem-file identity.pem --seed-file seed.txt
- Now implement Kyle’s code snippet below (copied from comment this post is replying to)
- If you run this an have NodeJS version 17+, you will receive the following error coming from the hdkey library import →
Error: error:0308010C:digital envelope routines::unsupported
. The possible solutions for getting around this are here, the easiest of which is downgrading to node 16. (@kpeacock/sdk team can you provide a node 17+ solution?)
- Now running the above node script and
dfx identity get-principal
should return the same identity! Yay!