From e2ae0e93e3713e224c94df05784f88f948d5e4a0 Mon Sep 17 00:00:00 2001 From: Ben Westgate Date: Wed, 7 Oct 2026 09:05:09 +0000 Subject: [PATCH 1/2] licensing: Restore upstream copyright headers The v1 rewrite dropped the license headers that master carries in bech32.py and checksums.py. bech32.py still derives convertbits from Pieter Wuille's segwit_addr.py, and checksums.py keeps his polymod arithmetic and Leon Olsson Curr and Pearlwort Sneed's codex32 generators. MIT and BSD-3-Clause both require the notice to travel with the code, and CONTRIBUTING.md requires the original author's header on derived work. Restore master's headers, except that checksums.py now credits the polymod arithmetic, since it no longer holds Bech32/Bech32m constants. Each credit also names its upstream source, sipa/bech32's ref/python/segwit_addr.py or BIP-93, as CONTRIBUTING.md asks. Comments do not count toward the package line budget. Claude-Session: https://claude.ai/code/session_01T233rKgZqE5wzDm3EVTHL1 --- src/codex32/bech32.py | 25 +++++++++++++++++++++++++ src/codex32/checksums.py | 29 +++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/src/codex32/bech32.py b/src/codex32/bech32.py index 59befc7..7704f01 100644 --- a/src/codex32/bech32.py +++ b/src/codex32/bech32.py @@ -1,3 +1,28 @@ +# Portions of this file are derived from work by: +# Copyright (c) 2017, 2020 Pieter Wuille +# Source: https://github.com/sipa/bech32/blob/master/ref/python/segwit_addr.py +# +# Additional code and modifications: +# Copyright (c) 2026 Ben Westgate +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + """Bech32 character, container, and bit-conversion helpers.""" from codex32.checksums import _Checksum diff --git a/src/codex32/checksums.py b/src/codex32/checksums.py index 95bf742..6061d1e 100644 --- a/src/codex32/checksums.py +++ b/src/codex32/checksums.py @@ -1,3 +1,32 @@ +# The polymod arithmetic in this file is derived from work by: +# Copyright (c) 2017, 2020 Pieter Wuille, MIT License +# Source: https://github.com/sipa/bech32/blob/master/ref/python/segwit_addr.py +# codex32 constants in this file are derived from work by: +# Author: Leon Olsson Curr and Pearlwort Sneed +# License: BSD-3-Clause +# Source: https://github.com/bitcoin/bips/blob/master/bip-0093.mediawiki +# +# Additional code: +# Copyright (c) 2026 Ben Westgate , MIT License +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + """Immutable checksum specifications used by codex32.""" from dataclasses import dataclass From 85119a2d17380d63055ab328c777a5be966e0778 Mon Sep 17 00:00:00 2001 From: Ben Westgate Date: Wed, 7 Oct 2026 09:05:21 +0000 Subject: [PATCH 2/2] docs: Document the fingerprint provider for fresh seeds The one-shot signature in api.md omitted generate_master_seed's fingerprint argument. A fresh call that leaves identifier unset raises ValueError unless that callable is supplied, so the documented defaults could not generate a seed. Show the argument and its contract. Claude-Session: https://claude.ai/code/session_01T233rKgZqE5wzDm3EVTHL1 --- docs/developer/api.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/developer/api.md b/docs/developer/api.md index f68ba67..51c9fb5 100644 --- a/docs/developer/api.md +++ b/docs/developer/api.md @@ -169,9 +169,14 @@ boundary; there is no legacy decoder. The one-shot function creates only unshared secrets: ```python -generate_master_seed(seed_bytes=None, *, byte_length=None, identifier=None) +generate_master_seed(seed_bytes=None, *, byte_length=None, identifier=None, fingerprint=None) ``` +A fresh seed with no `identifier` needs `fingerprint`: a callable that takes +the seed bytes and returns their four-byte BIP32 master fingerprint. This +package has no secp256k1 arithmetic, so the CLI asks Bitcoin Core. Without +either argument, fresh generation raises `ValueError`. + Shared creation uses `CreationCeremony.master_seed(...)` or `CreationCeremony.from_secret(...)`. Exactly one of `share_count` and `indices` is required. `next_share()` returns one pending share, `confirm(text)` must