Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Shamir's secret sharing protocol #1010

Open
tupui opened this issue Dec 12, 2024 · 2 comments
Open

Add Shamir's secret sharing protocol #1010

tupui opened this issue Dec 12, 2024 · 2 comments

Comments

@tupui
Copy link

tupui commented Dec 12, 2024

Is your feature request related to a problem? Please describe.

Keeping secrets can be hard and if someone finds the paper wallet, it's compromised.

Describe the solution you'd like

I would like to propose to add a helper function to split the secret key using the Shamir protocol. The PyCryptodome library has an implementation we could leverage.

We could propose the following APIs:

Keypair.secret.to_shamir(n, k)
Keypair.from_shamir(...)

Of course, naming and input parameters should be worked on.

As usual, I am happy to make a PR if wanted 😃

Describe alternatives you've considered

If not suitable in this library, I will add the feature on my higher level Soroban API library.

Additional context

https://pycryptodome.readthedocs.io/en/latest/src/protocol/ss.html

@overcat
Copy link
Member

overcat commented Dec 13, 2024

Hi @tupui, this is a very good proposal, but I suggest we build this feature based on python-shamir-mnemonic. I think we can trust the implementation provided by Trezor. We just need to add two functions: generate_shamir_mnemonic_phrase and from_shamir_mnemonic_phrase.

BTW. SLIP-39 was drafted by Trezor, so I hope that when using the same shamir mnemonic, the Python SDK and Trezor wallet can generate consistent keypair.

@overcat
Copy link
Member

overcat commented Dec 13, 2024

Keeping secrets can be hard and if someone finds the paper wallet, it's compromised.

In addition, for the existing BIP-39 method, I strongly recommend adding an extra passphrase (aka. 25th word) and memorizing it, which can alleviate this concern to some extent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants