1

I have a problem interacting with web3swift. I need to show mnemonics to my users when they want it. Is there a way to do it? I did a little research and found out that in trust wallet this could be done just with code:

String(data: decryptedPK, encoding: .utf8)

However, in web3swift even the length in bytes of decryptedPK is different(82 in web3swift, 73 in Trust).

TylerH
  • 20,799
  • 66
  • 75
  • 101

1 Answers1

2

In web3swift there is no backward conversion from PK to the mnemonic. Also it is theoretically impossible to recover a phrase from a PK.

When the user is creating his keystore you should ask him if he wants to save a passphrase. After seed phrase is converted to some initial entropy the “master key is derived” and the initial entropy is discarded.

The simplest solution is to encrypt the phrase using users pincode and save it in some keystore.

TylerH
  • 20,799
  • 66
  • 75
  • 101