diff options
author | CoprDistGit <infra@openeuler.org> | 2023-04-12 03:09:28 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-04-12 03:09:28 +0000 |
commit | 9a144913d1c66f9d7a91efb673740dfbcef0f85f (patch) | |
tree | 44d253519eaaac9932057efde1ff62bd4d623803 | |
parent | 2f84e9ac87b28d016b2ea342220915a693082ff1 (diff) |
automatic import of python-py-sr25519-bindings
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-py-sr25519-bindings.spec | 269 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 271 insertions, 0 deletions
@@ -0,0 +1 @@ +/py_sr25519_bindings-0.2.0.tar.gz diff --git a/python-py-sr25519-bindings.spec b/python-py-sr25519-bindings.spec new file mode 100644 index 0000000..9effc40 --- /dev/null +++ b/python-py-sr25519-bindings.spec @@ -0,0 +1,269 @@ +%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 +* Wed Apr 12 2023 Python_Bot <Python_Bot@openeuler.org> - 0.2.0-1 +- Package Spec generated @@ -0,0 +1 @@ +77a40c3e388ad861081c8f73b2055bfa py_sr25519_bindings-0.2.0.tar.gz |