Python Library for nostr.
Project description
pynostr
Python library for for Nostr.
This library is using coincurve instead of secp256k1, so pynostr can be used on windows.
Installation
pip install pynostr
The necessary coincurve can be installed on android inside termux:
pkg update
pkg install build-essential
pkg-install binutils
pip install coincurve --no-binary all
Usage
Generate a key
from pynostr.key import PrivateKey
private_key = PrivateKey()
public_key = private_key.public_key
print(f"Private key: {private_key.bech32()}")
print(f"Public key: {public_key.bech32()}")
Test Suite
Set up the test environment
Install the test-runner dependencies:
pip3 install -r test-requirements.txt
Then make the pynostr
python module visible/importable to the tests by installing the local dev dir as an editable module:
# from the repo root
pip3 install -e .
Running the test suite
Run the whole test suite:
# from the repo root
pytest
Run a specific test file:
pytest test/test_this_file.py
Run a specific test:
pytest test/test_this_file.py::test_this_specific_test
Pre-commit-config
Installation
$ pip install pre-commit
Using homebrew:
$ brew install pre-commit
$ pre-commit --version
pre-commit 2.10.0
Install the git hook scripts
$ pre-commit install
Run against all the files
pre-commit run --all-files
pre-commit run --show-diff-on-failure --color=always --all-files
Update package rev in pre-commit yaml
pre-commit autoupdate
pre-commit run --show-diff-on-failure --color=always --all-files
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pynostr-0.0.5.tar.gz
(16.0 kB
view details)
Built Distribution
File details
Details for the file pynostr-0.0.5.tar.gz
.
File metadata
- Download URL: pynostr-0.0.5.tar.gz
- Upload date:
- Size: 16.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a46ce385008968763b69d03e9dba4043cf52bbb5dda88541fa598e0e3d9e4096 |
|
MD5 | dfce03cb3fd52804d485010018a17d23 |
|
BLAKE2b-256 | e9f9bbf6cb81965729ba7609f098d6e6ece7eebd8d21add377254003f496ca3c |
File details
Details for the file pynostr-0.0.5-py3-none-any.whl
.
File metadata
- Download URL: pynostr-0.0.5-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8884d50fc2a6c9b49ada49f070b4e9bdc7a207d835e984fa867f048db4710449 |
|
MD5 | 23e1949d4cb3c77fd2783f739b1b9e46 |
|
BLAKE2b-256 | ddf341d475e9150acd4cc1cbbb9e3829983821036c4b55077fc59b5d2b6a0be9 |