0.1.1
This commit is contained in:
17
README.md
17
README.md
@@ -90,23 +90,6 @@ Both forms install the console‑script `nostr‑keygen` into `./.venv/bin`.
|
|||||||
> Keep your `nsec` secret in a secure, offline location. Anyone with that string can sign Nostr events or spend Nostr‑based funds.
|
> Keep your `nsec` secret in a secure, offline location. Anyone with that string can sign Nostr events or spend Nostr‑based funds.
|
||||||
|
|
||||||
|
|
||||||
## 🔧 How the code works (quick dive)
|
|
||||||
|
|
||||||
```python
|
|
||||||
# main.py
|
|
||||||
import argparse, hashlib
|
|
||||||
from ecdsa import SigningKey, SECP256k1
|
|
||||||
from bech32 import bech32_encode, convertbits
|
|
||||||
|
|
||||||
NSEC_PREFIX, NPUB_PREFIX = "nsec", "npub"
|
|
||||||
|
|
||||||
def _to_bech32(data: bytes, hrp: str) -> str:
|
|
||||||
five_bits = convertbits(list(data), 8, 5, True)
|
|
||||||
return bech32_encode(hrp, five_bits)
|
|
||||||
|
|
||||||
# … (rest unchanged) …
|
|
||||||
```
|
|
||||||
|
|
||||||
### Why the key‑gen algorithm matters
|
### Why the key‑gen algorithm matters
|
||||||
|
|
||||||
1. **Read file in binary** – We need raw entropy; reading as text would truncate or encode the file in an unexpected way. Binary mode is the most faithful representation of the file’s content.
|
1. **Read file in binary** – We need raw entropy; reading as text would truncate or encode the file in an unexpected way. Binary mode is the most faithful representation of the file’s content.
|
||||||
|
|||||||
4
main.py
4
main.py
@@ -71,8 +71,8 @@ def main():
|
|||||||
print(f"Error: {e}", file=sys.stderr)
|
print(f"Error: {e}", file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
print("Nsec:", nsec)
|
print("nsec:", nsec)
|
||||||
print("Npub:", npub)
|
print("npub:", npub)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "nostr-keygen"
|
name = "nostr-keygen"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
description = "Terminal tool to generate nostr npub/nsec from file entropy"
|
description = "Terminal tool to generate nostr npub/nsec from file entropy"
|
||||||
authors = [{name = "Your Name", email = "you@example.com"}]
|
authors = [{name = "Your Name", email = "you@example.com"}]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|||||||
Reference in New Issue
Block a user