I have my encryptedMnemonic and need to sign in with it through the extension to access web apps.
Where did you get the encryptedMnemonic from? You should put it back in that place I guess.
The extension stores the encrypted mnemonic/secret key in local storage:
function getHasSetPassword() { const persisted = localStorage.getItem(hasSetPasswordIdentifier); if (persisted !== null) { return JSON.parse(persisted); } return false; } let inMemoryVault: InMemoryVault = { ...defaultVault, encryptedSecretKey: localStorage.getItem(encryptedKeyIdentifier) || undefined, hasSetPassword: getHasSetPassword(), salt: localStorage.getItem(saltIdentifier) || undefined, }; export const getVault = () => inMemoryVault; function persistOptional(storageKey: string, value?: string) { if (value) { localStorage.setItem(storageKey, value); } else {
1 Like
Well you see I got logged out of the extension but was still logged in on the desktop wallet and since that wallet doesn’t have a place to get the secret key I got the encrypted key from ~/Library/Application Support/so.hiro.StacksWallet/config.json.
Is there a way for me to inject it with the password to receive the secret phrase?
You could try to decrypt the mnemonic directly. You need the salt as well.
Then use argon2 and do something like described here:
dispatch(setPasswordSuccess({ salt, encryptedMnemonic, stxAddress: address })); history.push(routes.HOME); }; } interface DecryptSoftwareWalletArgs { password: string; salt: string; ciphertextMnemonic: string; } export async function decryptSoftwareWallet(args: DecryptSoftwareWalletArgs) { const { password, salt, ciphertextMnemonic } = args; const { derivedKeyHash } = await main.deriveKey({ pass: password, salt }); const plaintextMnemonic = await decryptMnemonic({ encryptedMnemonic: ciphertextMnemonic, derivedKeyHash, }); const rootNode = await deriveRootKeychainFromMnemonic(plaintextMnemonic); return deriveStxAddressKeychain(rootNode) as { childKey: BIP32Interface; address: string;
Or you could build a custom desktop wallet that shows the mnemonic. Suitable issue: https://github.com/blockstack/stacks-wallet/issues/920
Yeah not at all familiar with typescript or programming much. tried all day to jury rig it but just got errors. Hopefully we get a way to reveal private keys on the desktop wallet.