Name | shamir-mnemonic-slip39 JSON |
Version |
0.4.1
JSON |
| download |
home_page | None |
Summary | SLIP-39 Shamir Mnemonics |
upload_time | 2024-11-20 22:01:31 |
maintainer | None |
docs_url | None |
author | Trezor |
requires_python | <4.0,>=3.6 |
license | MIT |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
python-shamir-mnemonic
======================
> This is a temporary upgrade shim for https://github.com/trezor/python-shamir-mnemonic
> Install `shamir_mnemonic` via `python -m pip install shamir-mnemonic-slip39`,
> until the upstream https://pypi.org/project/shamir-mnemonic is upgraded to include
> recovery of arbitrary SLIP-39 Mnemonic groups.
.. image:: https://badge.fury.io/py/shamir-mnemonic.svg
:target: https://badge.fury.io/py/shamir-mnemonic
Reference implementation of SLIP-0039: Shamir's Secret-Sharing for Mnemonic
Codes
Abstract
--------
This SLIP describes a standard and interoperable implementation of Shamir's
secret sharing (SSS). SSS splits a secret into unique parts which can be
distributed among participants, and requires a specified minimum number of
parts to be supplied in order to reconstruct the original secret. Knowledge of
fewer than the required number of parts does not leak information about the
secret.
Specification
-------------
See https://github.com/satoshilabs/slips/blob/master/slip-0039.md for full
specification.
Security
--------
This implementation is not using any hardening techniques. Secrets are passed in the
open, and calculations are most likely trivially vulnerable to side-channel attacks.
The purpose of this code is to verify correctness of other implementations. **It should
not be used for handling sensitive secrets**.
Installation
------------
With pip from PyPI:
.. code-block:: console
$ pip3 install shamir-mnemonic[cli] # for CLI tool
From local checkout for development:
Install the [Poetry](https://python-poetry.org/) tool, checkout
`python-shamir-mnemonic` from git, and enter the poetry shell:
.. code-block:: console
$ pip3 install poetry
$ git clone https://github.com/trezor/python-shamir-mnemonic
$ cd python-shamir-mnemonic
$ poetry install
$ poetry shell
CLI usage
---------
CLI tool is included as a reference and UX testbed.
**Warning:** this tool makes no attempt to protect sensitive data! Use at your own risk.
If you need this to recover your wallet seeds, make sure to do it on an air-gapped
computer, preferably running a live system such as Tails.
When the :code:`shamir_mnemonic` package is installed, you can use the :code:`shamir`
command:
.. code-block:: console
$ shamir create 3of5 # create a 3-of-5 set of shares
$ shamir recover # interactively recombine shares to get the master secret
You can supply your own master secret as a hexadecimal string:
.. code-block:: console
$ shamir create 3of5 --master-secret=cb21904441dfd01a392701ecdc25d61c
You can specify a custom scheme. For example, to create three groups, with 2-of-3,
2-of-5, and 4-of-5, and require completion of all three groups, use:
.. code-block:: console
$ shamir create custom --group-threshold 3 --group 2 3 --group 2 5 --group 4 5
Use :code:`shamir --help` or :code:`shamir create --help` to see all available options.
If you want to run the CLI from a local checkout without installing, use the following
command:
.. code-block:: console
$ python3 -m shamir_mnemonic.cli
Test vectors
------------
The test vectors in vectors.json are given as a list of quadruples:
* The first member is a description of the test vector.
* The second member is a list of mnemonics.
* The third member is the master secret which results from combining the mnemonics.
* The fourth member is the BIP32 master extended private key derived from the master secret.
The master secret is encoded as a string containing two hexadecimal digits for each byte. If
the string is empty, then attempting to combine the given set of mnemonics should result
in error. The passphrase "TREZOR" is used for all valid sets of mnemonics.
Changelog
=========
.. default-role:: code
All notable changes to this project will be documented in this file.
The format is based on `Keep a Changelog`_, and this project adheres to
`Semantic Versioning`_.
`0.3.1`_ - Unreleased
---------------------
(no changes yet)
.. _0.3.1: https://github.com/trezor/python-shamir-mnemonic/compare/v0.3.0...HEAD
`0.3.0`_ - 2024-05-15
---------------------
Incompatible
~~~~~~~~~~~~
- The `shamir` command no longer works out of the box. It is necessary to install the
`cli` extra while installing the package. See README for instructions.
Added
~~~~~
- Added BIP32 master extended private key to test vectors.
- Added support for extendable backup flag.
Changed
~~~~~~~
- The `shamir_mnemonic` package now has zero extra dependencies on Python 3.7 and up,
making it more suitable as a dependency of other projects.
- The `shamir` CLI still requires `click`. A new extra `cli` was introduced to handle
this dependency. Use the command `pip install shamir-mnemonic[cli]` to install the CLI
dependencies along with the package.
Removed
~~~~~~~
- Removed dependency on `attrs`.
.. _0.3.0: https://github.com/trezor/python-shamir-mnemonic/compare/v0.2.2...v0.3.0
`0.2.2`_ - 2021-12-07
---------------------
Changed
~~~~~~~
- Relaxed Click constraint so that Click 8.x is allowed
- Applied `black` and `flake8` code style
.. _0.2.2: https://github.com/trezor/python-shamir-mnemonic/compare/v0.2.1...v0.2.2
`0.2.1`_ - 2021-02-03
---------------------
.. _0.2.1: https://github.com/trezor/python-shamir-mnemonic/compare/v0.1.0...v0.2.1
Fixed
~~~~~
- Re-released on the correct commit
`0.2.0`_ - 2021-02-03
---------------------
.. _0.2.0: https://github.com/trezor/python-shamir-mnemonic/compare/v0.1.0...v0.2.0
Added
~~~~~
- Introduce `split_ems` and `recover_ems` to separate password-based encryption from the Shamir Secret recovery
- Introduce classes representing a share and group-common parameters
- Introduce `RecoveryState` class that allows reusing the logic of the `shamir recover` command
Changed
~~~~~~~
- Use `secrets` module instead of `os.urandom`
- Refactor and restructure code into separate modules
0.1.0 - 2019-07-19
------------------
Added
~~~~~
- Initial implementation
.. _Keep a Changelog: https://keepachangelog.com/en/1.0.0/
.. _Semantic Versioning: https://semver.org/spec/v2.0.0.html
Raw data
{
"_id": null,
"home_page": null,
"name": "shamir-mnemonic-slip39",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.6",
"maintainer_email": null,
"keywords": null,
"author": "Trezor",
"author_email": "info@trezor.io",
"download_url": "https://files.pythonhosted.org/packages/ff/64/86262030f81f0012d4ee4bf1583c2fef8b04d8c0a97dd608899f50d98728/shamir_mnemonic_slip39-0.4.1.tar.gz",
"platform": null,
"description": "python-shamir-mnemonic\n======================\n\n> This is a temporary upgrade shim for https://github.com/trezor/python-shamir-mnemonic\n\n> Install `shamir_mnemonic` via `python -m pip install shamir-mnemonic-slip39`,\n> until the upstream https://pypi.org/project/shamir-mnemonic is upgraded to include\n> recovery of arbitrary SLIP-39 Mnemonic groups.\n\n\n.. image:: https://badge.fury.io/py/shamir-mnemonic.svg\n :target: https://badge.fury.io/py/shamir-mnemonic\n\nReference implementation of SLIP-0039: Shamir's Secret-Sharing for Mnemonic\nCodes\n\nAbstract\n--------\n\nThis SLIP describes a standard and interoperable implementation of Shamir's\nsecret sharing (SSS). SSS splits a secret into unique parts which can be\ndistributed among participants, and requires a specified minimum number of\nparts to be supplied in order to reconstruct the original secret. Knowledge of\nfewer than the required number of parts does not leak information about the\nsecret.\n\nSpecification\n-------------\n\nSee https://github.com/satoshilabs/slips/blob/master/slip-0039.md for full\nspecification.\n\nSecurity\n--------\n\nThis implementation is not using any hardening techniques. Secrets are passed in the\nopen, and calculations are most likely trivially vulnerable to side-channel attacks.\n\nThe purpose of this code is to verify correctness of other implementations. **It should\nnot be used for handling sensitive secrets**.\n\nInstallation\n------------\n\nWith pip from PyPI:\n\n.. code-block:: console\n\n $ pip3 install shamir-mnemonic[cli] # for CLI tool\n\nFrom local checkout for development:\n\nInstall the [Poetry](https://python-poetry.org/) tool, checkout\n`python-shamir-mnemonic` from git, and enter the poetry shell:\n\n.. code-block:: console\n\n $ pip3 install poetry\n $ git clone https://github.com/trezor/python-shamir-mnemonic\n $ cd python-shamir-mnemonic\n $ poetry install\n $ poetry shell\n\nCLI usage\n---------\n\nCLI tool is included as a reference and UX testbed.\n\n**Warning:** this tool makes no attempt to protect sensitive data! Use at your own risk.\nIf you need this to recover your wallet seeds, make sure to do it on an air-gapped\ncomputer, preferably running a live system such as Tails.\n\nWhen the :code:`shamir_mnemonic` package is installed, you can use the :code:`shamir`\ncommand:\n\n.. code-block:: console\n\n $ shamir create 3of5 # create a 3-of-5 set of shares\n $ shamir recover # interactively recombine shares to get the master secret\n\nYou can supply your own master secret as a hexadecimal string:\n\n.. code-block:: console\n\n $ shamir create 3of5 --master-secret=cb21904441dfd01a392701ecdc25d61c\n\nYou can specify a custom scheme. For example, to create three groups, with 2-of-3,\n2-of-5, and 4-of-5, and require completion of all three groups, use:\n\n.. code-block:: console\n\n $ shamir create custom --group-threshold 3 --group 2 3 --group 2 5 --group 4 5\n\nUse :code:`shamir --help` or :code:`shamir create --help` to see all available options.\n\nIf you want to run the CLI from a local checkout without installing, use the following\ncommand:\n\n.. code-block:: console\n\n $ python3 -m shamir_mnemonic.cli\n\nTest vectors\n------------\n\nThe test vectors in vectors.json are given as a list of quadruples:\n* The first member is a description of the test vector.\n* The second member is a list of mnemonics.\n* The third member is the master secret which results from combining the mnemonics.\n* The fourth member is the BIP32 master extended private key derived from the master secret.\n\nThe master secret is encoded as a string containing two hexadecimal digits for each byte. If\nthe string is empty, then attempting to combine the given set of mnemonics should result\nin error. The passphrase \"TREZOR\" is used for all valid sets of mnemonics.\n\nChangelog\n=========\n\n.. default-role:: code\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on `Keep a Changelog`_, and this project adheres to\n`Semantic Versioning`_.\n\n`0.3.1`_ - Unreleased\n---------------------\n\n(no changes yet)\n\n.. _0.3.1: https://github.com/trezor/python-shamir-mnemonic/compare/v0.3.0...HEAD\n\n`0.3.0`_ - 2024-05-15\n---------------------\n\nIncompatible\n~~~~~~~~~~~~\n\n- The `shamir` command no longer works out of the box. It is necessary to install the\n `cli` extra while installing the package. See README for instructions.\n\nAdded\n~~~~~\n\n- Added BIP32 master extended private key to test vectors.\n- Added support for extendable backup flag.\n\nChanged\n~~~~~~~\n\n- The `shamir_mnemonic` package now has zero extra dependencies on Python 3.7 and up,\n making it more suitable as a dependency of other projects.\n- The `shamir` CLI still requires `click`. A new extra `cli` was introduced to handle\n this dependency. Use the command `pip install shamir-mnemonic[cli]` to install the CLI\n dependencies along with the package.\n\nRemoved\n~~~~~~~\n\n- Removed dependency on `attrs`.\n\n.. _0.3.0: https://github.com/trezor/python-shamir-mnemonic/compare/v0.2.2...v0.3.0\n\n\n`0.2.2`_ - 2021-12-07\n---------------------\n\nChanged\n~~~~~~~\n\n- Relaxed Click constraint so that Click 8.x is allowed\n- Applied `black` and `flake8` code style\n\n.. _0.2.2: https://github.com/trezor/python-shamir-mnemonic/compare/v0.2.1...v0.2.2\n\n\n`0.2.1`_ - 2021-02-03\n---------------------\n\n.. _0.2.1: https://github.com/trezor/python-shamir-mnemonic/compare/v0.1.0...v0.2.1\n\nFixed\n~~~~~\n\n- Re-released on the correct commit\n\n\n`0.2.0`_ - 2021-02-03\n---------------------\n\n.. _0.2.0: https://github.com/trezor/python-shamir-mnemonic/compare/v0.1.0...v0.2.0\n\nAdded\n~~~~~\n\n- Introduce `split_ems` and `recover_ems` to separate password-based encryption from the Shamir Secret recovery\n- Introduce classes representing a share and group-common parameters\n- Introduce `RecoveryState` class that allows reusing the logic of the `shamir recover` command\n\nChanged\n~~~~~~~\n\n- Use `secrets` module instead of `os.urandom`\n- Refactor and restructure code into separate modules\n\n\n0.1.0 - 2019-07-19\n------------------\n\nAdded\n~~~~~\n\n- Initial implementation\n\n\n.. _Keep a Changelog: https://keepachangelog.com/en/1.0.0/\n.. _Semantic Versioning: https://semver.org/spec/v2.0.0.html\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "SLIP-39 Shamir Mnemonics",
"version": "0.4.1",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "71e2939a8fed20094786d473ff16fd8fcf0879ff46483c77f0f09b7bee57ea62",
"md5": "7de5cdf79cfb4f759ebf1d9610d29fa2",
"sha256": "ea41a51f3f274e918ad346f7da22efa977418827bd498532d5c00deff634a4b6"
},
"downloads": -1,
"filename": "shamir_mnemonic_slip39-0.4.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7de5cdf79cfb4f759ebf1d9610d29fa2",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.6",
"size": 25813,
"upload_time": "2024-11-20T22:01:30",
"upload_time_iso_8601": "2024-11-20T22:01:30.139387Z",
"url": "https://files.pythonhosted.org/packages/71/e2/939a8fed20094786d473ff16fd8fcf0879ff46483c77f0f09b7bee57ea62/shamir_mnemonic_slip39-0.4.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ff6486262030f81f0012d4ee4bf1583c2fef8b04d8c0a97dd608899f50d98728",
"md5": "61e7b89cd1e3152119869e4d2ec391ac",
"sha256": "2a3d1d8574d6c8cb38c6884e2993610641ed8747f452e36e106277125c856a46"
},
"downloads": -1,
"filename": "shamir_mnemonic_slip39-0.4.1.tar.gz",
"has_sig": false,
"md5_digest": "61e7b89cd1e3152119869e4d2ec391ac",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.6",
"size": 24439,
"upload_time": "2024-11-20T22:01:31",
"upload_time_iso_8601": "2024-11-20T22:01:31.948133Z",
"url": "https://files.pythonhosted.org/packages/ff/64/86262030f81f0012d4ee4bf1583c2fef8b04d8c0a97dd608899f50d98728/shamir_mnemonic_slip39-0.4.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-20 22:01:31",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "shamir-mnemonic-slip39"
}