ilap / slip39-js

The javascript implementation of the SLIP39 for Shamir's Secret-Sharing for Mnemonic Codes.
MIT License
69 stars 26 forks source link

Interoperability with other tools #28

Closed petre-c closed 2 weeks ago

petre-c commented 2 weeks ago

I tried and failed to recover the BIP39 seed from SLIP39 shards generated by https://github.com/pjkundert/python-slip39 with this tool.

I also failed to recover the BIP39 seed from the SLIP39 shards generated by current tool with https://github.com/pjkundert/python-slip39.

Are the two supposed to be compatible / interoperable.

My goal is to have a number of tools that can recover SLIP39 shards I generate to store my BIP39 seed phrase in a distributed way.

petre-c commented 2 weeks ago

https://github.com/pjkundert/python-slip39/issues/22

ilap commented 2 weeks ago

Hi,

The problem is that SLIP-39 and BIP-39 use different method for generating their master seeds.

Though, you can make them compatible by using BIP39 entropy as SLIP39's masterkey. Example: BIP39 entropy as masterkey -> SLIP39 shards <-> BIP39 entropy <-> BIP39 mnemonic.

petre-c commented 2 weeks ago

Thanks for that, @ilap

So I'm still failing while attempting to do the roundtrip with different tools:

When I try to recover with iancoleman.io/slip39 or python-slip39 tools, both fail:

ilap commented 2 weeks ago

pjkundert/python-slip39#22

Oooh, I see. They're compatible and interoperable, but it seems that the issue is with the iancoleman's website.

petre-c commented 2 weeks ago

pjkundert/python-slip39#22

Oooh, I see. They're compatible and interoperable, but it seems that the issue is with the iancoleman's website.

Shouldn't I be able to recover the entropy I generate with slip39-js using python-slip39, then?

ilap commented 2 weeks ago

So I'm still failing while attempting to do the roundtrip with different tools:

You should use List<int> or similar instead of hex string. Meaning: Do not use: "c4b6d998c265c56c983731676ea732e4", as it uses as string, meaning 32 length string (256-bit entropy) only use [196, 182, 217, 152, 194, 101, 197, 108, 152, 55, 49, 103, 110, 167, 50, 228] 16-length array meaning 128-bit entropy

As SLIP39's 20-length mnemonic means 128-bit entropy, while 33-length mnemonic is 256-bit entropy.

petre-c commented 2 weeks ago

So then what would be the input to slip39EncodeHex() method in main.js? image

I could not translate your code snippet to make it work within main.js

Please bear with me and pardon my ignorance.

ilap commented 2 weeks ago

So then what would be the input to slip39EncodeHex() method in main.js?

Please bear with me and pardon my ignorance.

This one would do I think: const masterSecret = [].toByteArray("c4b6d998c265c56c983731676ea732e4");

petre-c commented 2 weeks ago

So then what would be the input to slip39EncodeHex() method in main.js? Please bear with me and pardon my ignorance.

This one would do I think: const masterSecret = [].toByteArray("c4b6d998c265c56c983731676ea732e4");

YES! That worked. Thank you, @ilap

Maybe interoperability with other tools could be addressed in the docs.

ilap commented 2 weeks ago

pjkundert/python-slip39#22

Oooh, I see. They're compatible and interoperable, but it seems that the issue is with the iancoleman's website.

I created a PR for iancoelman's website to resolve the issue caused by my slip39-js v0.1.7.

petre-c commented 2 weeks ago

Great, thank you, @ilap

iancoleman does not seem to be active, there are PRs sitting unmerged from 2022.

I saw you forked his repo. Would you be willing to host it somewhere for easy access?

Referencing your PR https://github.com/iancoleman/slip39/pull/35

petre-c commented 1 week ago

Hosted here -> https://3rditeration.github.io/slip39/src/