%global _empty_manifest_terminate_build 0 Name: python-py-sr25519-bindings Version: 0.2.0 Release: 1 Summary: Python bindings for sr25519 library License: Apache-2.0 URL: https://github.com/polkascan/py-sr25519-bindings Source0: https://mirrors.nju.edu.cn/pypi/web/packages/f7/81/3c6f3c6e37f51ec49a3dbf98162a5008c321d8a137b07b3b8521b71bf1b8/py_sr25519_bindings-0.2.0.tar.gz %description # py-sr25519-bindings Python bindings for sr25519 library: https://github.com/w3f/schnorrkel Reference to https://github.com/LocalCoinSwap/kusama-reference-implementation/tree/improve-trading-tests/bindings and https://gitlab.com/kauriid/schnorrpy/ for the initial work ## Documentation https://docs.rs/py-sr25519-bindings ## Installation ### Install from PyPI ``` pip install py-sr25519-bindings ``` ### Compile for local development ``` pip install -r requirements.txt maturin develop ``` ### Build wheels ``` pip install -r requirements.txt # Build local OS wheel maturin build # Build manylinux1 wheel docker build . --tag polkasource/maturin docker run --rm -i -v $(pwd):/io polkasource/maturin build ``` ## Usage ```python import bip39 import sr25519 message = b"test" # Get private and public key from seed seed = bip39.bip39_to_mini_secret('daughter song common combine misery cotton audit morning stuff weasel flee field','') public_key, private_key = sr25519.pair_from_seed(bytes(seed)) # Generate signature signature = sr25519.sign( (public_key, private_key), message ) print('Signature', signature.hex()) # Verify message with signature if sr25519.verify(signature, message, public_key): print('Verified') ``` ## License https://github.com/polkascan/py-sr25519-bindings/blob/master/LICENSE %package -n python3-py-sr25519-bindings Summary: Python bindings for sr25519 library Provides: python-py-sr25519-bindings BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip BuildRequires: python3-cffi BuildRequires: gcc BuildRequires: gdb %description -n python3-py-sr25519-bindings # py-sr25519-bindings Python bindings for sr25519 library: https://github.com/w3f/schnorrkel Reference to https://github.com/LocalCoinSwap/kusama-reference-implementation/tree/improve-trading-tests/bindings and https://gitlab.com/kauriid/schnorrpy/ for the initial work ## Documentation https://docs.rs/py-sr25519-bindings ## Installation ### Install from PyPI ``` pip install py-sr25519-bindings ``` ### Compile for local development ``` pip install -r requirements.txt maturin develop ``` ### Build wheels ``` pip install -r requirements.txt # Build local OS wheel maturin build # Build manylinux1 wheel docker build . --tag polkasource/maturin docker run --rm -i -v $(pwd):/io polkasource/maturin build ``` ## Usage ```python import bip39 import sr25519 message = b"test" # Get private and public key from seed seed = bip39.bip39_to_mini_secret('daughter song common combine misery cotton audit morning stuff weasel flee field','') public_key, private_key = sr25519.pair_from_seed(bytes(seed)) # Generate signature signature = sr25519.sign( (public_key, private_key), message ) print('Signature', signature.hex()) # Verify message with signature if sr25519.verify(signature, message, public_key): print('Verified') ``` ## License https://github.com/polkascan/py-sr25519-bindings/blob/master/LICENSE %package help Summary: Development documents and examples for py-sr25519-bindings Provides: python3-py-sr25519-bindings-doc %description help # py-sr25519-bindings Python bindings for sr25519 library: https://github.com/w3f/schnorrkel Reference to https://github.com/LocalCoinSwap/kusama-reference-implementation/tree/improve-trading-tests/bindings and https://gitlab.com/kauriid/schnorrpy/ for the initial work ## Documentation https://docs.rs/py-sr25519-bindings ## Installation ### Install from PyPI ``` pip install py-sr25519-bindings ``` ### Compile for local development ``` pip install -r requirements.txt maturin develop ``` ### Build wheels ``` pip install -r requirements.txt # Build local OS wheel maturin build # Build manylinux1 wheel docker build . --tag polkasource/maturin docker run --rm -i -v $(pwd):/io polkasource/maturin build ``` ## Usage ```python import bip39 import sr25519 message = b"test" # Get private and public key from seed seed = bip39.bip39_to_mini_secret('daughter song common combine misery cotton audit morning stuff weasel flee field','') public_key, private_key = sr25519.pair_from_seed(bytes(seed)) # Generate signature signature = sr25519.sign( (public_key, private_key), message ) print('Signature', signature.hex()) # Verify message with signature if sr25519.verify(signature, message, public_key): print('Verified') ``` ## License https://github.com/polkascan/py-sr25519-bindings/blob/master/LICENSE %prep %autosetup -n py-sr25519-bindings-0.2.0 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-py-sr25519-bindings -f filelist.lst %dir %{python3_sitearch}/* %files help -f doclist.lst %{_docdir}/* %changelog * Tue Apr 25 2023 Python_Bot - 0.2.0-1 - Package Spec generated