input-output-hk / js-cardano-wasm

various cardano javascript using wasm bindings
MIT License
31 stars 21 forks source link

Is there anyway to retrieve Daedalus master key from Daedalus memo? #76

Closed mmo2112 closed 4 years ago

mmo2112 commented 4 years ago

Hi, I have Daedalus memo and I want to get master key from these memo to contact with Yoroi/wasp (for few reasons). Is there any method to get master key? I have use below method to get Daedalus master key, then put it on Yoroi to test but it can't retrieve my address:

const cardano = require('cardano-wallet');
const dMemo = ...;
const dEntropy = cardano.Entropy.from_english_mnemonics(dMemo);
const dWallet = cardano.DaedalusWallet.recover(dEntropy);
const privateKey = cardano.PrivateKey.new(dEntropy);
const pk = privateKey.to_hex();
console.log("pk", pk);

or

const addressToCheck = ...;
const dChecker = cardano.DaedalusAddressChecker.new(dWallet);
const toRustAddr = cardano.Address.from_base58(addressToCheck);
const checkedAddr = dChecker.check_address(toRustAddr);
if (checkedAddr.is_checked()) {
    console.log("pk", checkedAddr.private_key().to_hex());
}

Thanks so much for help.

SebastienGllmt commented 4 years ago

I added a function for this here.

mmo2112 commented 4 years ago

@NicolasDP, may you merge this pull soon? I really need it. https://github.com/input-output-hk/js-cardano-wasm/pull/77/commits/c30929919487085f56997b82c8e0e08401ccad7b