5

I need to be able to get public and private keys for NEAR wallet by providing it's seed-phrase. I've found a specific library/repo in NEAR's GitHub account that looks very promising for my case :) : https://github.com/near/near-seed-phrase

But, after some testing it looks like the results provided by this library (parseSeedPhrase function) don't match the actual keys which can be obtained by using near-cli utility.

I have an assumption that maybe NEAR's Testnet is using different value for a derivationPath parameter, and the one that is included as a default one inside the library is for the Mainnet only. Maybe I just missing something, any help would be appreciated.

Vlad Frolov
  • 7,445
  • 5
  • 33
  • 52
Soulwish
  • 153
  • 1
  • 6

2 Answers2

3

near-seed-phrase works just fine, and the key generated by it is used for account creation (proof), but then Wallet generates a new random keypair and adds it to the account (proof) and stores it in the Local Storage of the browser. Thus, if you compare the key in the local storage, that won't match the one that is derived from the seed phrase since Wallet does not want you to invalidate your seed phrase after you sign in from a new device (you should be able to just remove the access key after you are done with the session).

Let's re-iterate, Wallet only uses the key derived from the seed phrase to add a fresh key to a given account, and never stores the seed phrase or the key derived from the seed phrase in the local storage.

Vlad Frolov
  • 7,445
  • 5
  • 33
  • 52
-3

Crazy, but NEAR does not encrypt the key! At least not with any password, because you don't get to enter a password that means you cant see the private key AND you cant generate a keystore file, VERY AHNNOYING!!!! Not sure why NEAR wallet is so stupid here. So you ight ask, how do they store your SEED pharse? do they just use their own encryption for the session? Equally stupid. ALL other wallets let you generate a passpharse as key to encrypt your SEED or PVT key derived form the seed, and therefore genrerate a safe keystore file. Instead NEAR makes you use 2FA multui-sig depending a on a cell phone when you could have a strong brain password instead. What shiat!