Skip to content

Commit 22990b9

Browse files
committed
Prepare codex32 1.0.0rc1
Add incremental, confirmation-gated share creation with separate entropy requests and preserve the original ceremony seed for wallet initialization. Support the six BIP93 master-seed sizes and retain the bip93-ms-profile correction behavior, including cross-length recovery and ambiguity handling. Add verified Bitcoin Core wallet initialization, keeping private descriptors on stdin, excluding passphrase handling, revalidating wallet state, verifying the exact public descriptor set, and relocking encrypted wallets on success, failure, or interruption. Refactor application profiles into dedicated modules, simplify the Bech32 codec, remove the custom build backend and BIP32 wrapper, and keep the package below the 3,000-logical-line reviewability gate. Rewrite and consolidate user, developer, and security documentation. Add a reproducible trusted-publishing workflow and prepare the 1.0.0rc1 release artifacts.
1 parent 3215809 commit 22990b9

74 files changed

Lines changed: 4496 additions & 4784 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/publish.yml‎

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Publish release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
env:
8+
SOURCE_DATE_EPOCH: "1763060600"
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write
15+
steps:
16+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
17+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
18+
with:
19+
python-version: "3.13"
20+
- run: >-
21+
python -c "import os,tomllib;
22+
version=tomllib.load(open('pyproject.toml','rb'))['project']['version'];
23+
assert os.environ['GITHUB_REF_NAME'] == f'v{version}'"
24+
- run: >-
25+
python -m pip install --require-hashes
26+
-r requirements/release-build-dependencies.txt
27+
- run: python -m build --no-isolation
28+
- name: Normalize source-archive metadata
29+
run: |
30+
archive="dist/codex32-${GITHUB_REF_NAME#v}.tar.gz"
31+
mkdir normalized-sdist
32+
tar -xzf "$archive" -C normalized-sdist
33+
tar --sort=name --mtime="@${SOURCE_DATE_EPOCH}" --owner=0 --group=0 --numeric-owner \
34+
-C normalized-sdist -cf - "codex32-${GITHUB_REF_NAME#v}" | gzip -n > "$archive.new"
35+
mv "$archive.new" "$archive"
36+
- name: Attach distributions to the GitHub release
37+
run: gh release upload "$GITHUB_REF_NAME" dist/*
38+
env:
39+
GH_TOKEN: ${{ github.token }}
40+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
41+
with:
42+
name: distributions
43+
path: dist/
44+
45+
publish:
46+
needs: build
47+
runs-on: ubuntu-latest
48+
environment:
49+
name: pypi
50+
url: https://pypi.org/p/codex32
51+
permissions:
52+
contents: read
53+
id-token: write
54+
steps:
55+
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
56+
with:
57+
name: distributions
58+
path: dist/
59+
- name: Publish distributions to PyPI
60+
uses: pypa/gh-action-pypi-publish@a892a5a61159132606e93a2fa6f4358831b04d26 # v1.14.2

‎.github/workflows/python-package.yml‎

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ jobs:
1616
os: [ubuntu-latest, macos-latest, windows-latest]
1717
python-version: ["3.12", "3.13"]
1818
steps:
19-
- uses: actions/checkout@v4
20-
- uses: actions/setup-python@v5
19+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
20+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
2121
with:
2222
python-version: ${{ matrix.python-version }}
2323
- run: python -m pip install --upgrade pip
@@ -34,21 +34,3 @@ jobs:
3434
- run: python tools/differential_correction.py --verify
3535
- run: python tools/differential_wallet.py --verify
3636
- run: python -m build --no-isolation
37-
38-
experimental-python:
39-
continue-on-error: true
40-
runs-on: ubuntu-latest
41-
steps:
42-
- uses: actions/checkout@v4
43-
- uses: actions/setup-python@v5
44-
with:
45-
python-version: "3.14"
46-
- run: python -m pip install --upgrade pip
47-
- run: python -m pip install --require-hashes -r requirements/cli-build-dependencies.txt
48-
- run: >-
49-
python -m pip install --no-build-isolation --require-hashes
50-
-r requirements/cli-dependencies.txt
51-
- run: python -m pip install --no-build-isolation -e '.[dev]'
52-
- run: python -m pip check
53-
- run: python -m pytest -q
54-
- run: python tools/differential_wallet.py --verify

‎.gitignore‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@ build/
1111
dist/
1212
.eggs/
1313
*.egg-info/
14+
15+
# Local plans, release gates, and unfinished review reports
16+
docs/planning/
17+
docs/developer/provenance.md

‎AGENTS.md‎

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Project Structure & Module Organization
44

5-
Production code lives in `src/codex32/`; keep its codec, profile, artifact, generation, correction, wallet, and CLI modules narrow. Do not duplicate domain logic in `cli.py`. Tests are in `tests/test_*.py`, with frozen external vectors under `tests/data/`. Architecture, provenance, and user guidance live in `docs/`. `tools/` contains offline verification utilities.
5+
Production code lives in `src/codex32/`; keep its modules narrow. Do not duplicate domain logic in `cli.py` or `profiles/`. Tests are in `tests/test_*.py`, with frozen external vectors under `tests/data/`. Durable documentation is grouped under `docs/user/`, `docs/developer/`, and `docs/security/`. Local plans and unfinished gate reports belong in the ignored `docs/planning/` directory. `tools/` contains offline verification utilities.
66

77
## Build, Test, and Development Commands
88

@@ -17,22 +17,57 @@ python -m build # build wheel and source archive
1717
python -m twine check dist/* # validate release metadata
1818
```
1919

20-
Run the local CLI with `codex32 --help`. Python 3.12 is the minimum; CI also covers 3.13 and 3.14.
20+
Run the local CLI with `codex32 --help`. Python 3.12 is the minimum; CI also covers 3.13.
2121

2222
## Coding Style & Naming Conventions
2323

24-
Use four-space indentation and PEP 8. Ruff is the only linter and formatter. Mypy is strict; keep untyped dependency interaction inside its narrow adapter. Use `snake_case` for functions and modules, `CapWords` for types, `UPPER_CASE` for constants. Optimize for external human review. Keep the 100-character rule soft, explicitly prefer lines under 100 when doing so does not reduce readability.
24+
- Use 4 space indentation
25+
- The line limit for Python code is 79 characters, while comments and docstrings must be wrapped at 72 characters. However, lines up to 99 characters may be used where they improve readability and reduce line count. Definitions should use lines up to 99 characters when it reduces line count.
2526

26-
Prefer the style of segwit_addr.py and the in-line Python reference of BIP-0093, BIP-0173, BIP-0350, and BIP-380:
27-
Be deliberately direct and function-oriented, with recognizable algorithm names rather than layers of abstraction, type hints, no wildcard imports, predictable imports, and explanatory module-level test documentation.
27+
- Easy to match operators with operands
28+
29+
- Surround top-level function and class definitions with 2 blank lines
30+
- Method definitions inside a class are surrounded by 1 blank line
31+
- Extra blank lines may be used (sparingly) to separate groups of related functions
32+
- Blank lines may be omitted between a bunch of related one-liners (e.g. a set of dummy implementations)
33+
-Use blank lines in functions, sparingly, to indicate logical sections
34+
35+
- Prefer f-strings over `str.format()` or `%` formatting
36+
37+
- Comments that contradict the code are worse than no comments. Always make a priority of keeping the comments up-to-date when the code changes!
38+
- Comments should be complete sentences. The first word should be capitalized, unless it is an identifier that begins with a lower case letter (never alter the case of identifiers!).
39+
- Ensure that your comments are clear and easily understandable to English speakers.
40+
- Use inline comments sparingly.
41+
- An inline comment is a comment on the same line as a statement. Inline comments should be separated by at least two spaces from the statement. They should start with a # and a single space.
42+
- Inline comments are unnecessary and in fact distracting if they state the obvious.
43+
- Write one liner docstrings for all public modules, functions, classes, and methods. Docstrings are not necessary for non-public methods, but you should have a comment that describes what the method does. This comment should appear after the def line.
44+
45+
- Names that are visible to the user as public parts of the API should follow conventions that reflect usage rather than implementation.
46+
47+
- Use type hints, no wildcard imports
48+
- Embrace idiomatic Python like comprehensions, generators, and decorators
49+
- If more than one name from a module is needed, use lexicographically sorted multi-line imports in order to reduce the possibility of potential merge conflicts
50+
51+
Use a python linter like Ruff/flake8/Black before submitting to catch common style nits (eg trailing whitespace, unused imports, etc)
52+
Mypy is strict; keep ignores for untyped dependency by its references. Use `snake_case` for functions and modules, `CapWords` for types, `UPPER_CASE` for constants. Optimize for human readability.
53+
54+
In text codex32 is always lowercase unless it refers to the Codex32 Book.
55+
56+
## Constraints
57+
58+
- Ask before adding any external dependency.
59+
- Ask before changing the signature and response shape of existing endpoints
60+
- Ask before suppressing format or style lints.
61+
- Tests enforce an installed-package budget below 3,000 logical lines of code.
62+
- Declare a task done only after the gates pass and docstrings are updated
2863

2964
## Testing Guidelines
3065

31-
Use pytest and Hypothesis. Name tests `test_<behavior>` and give test modules an evidence-focused docstring. Add normative vectors, negative cases, and regressions with behavioral changes. Never derive expected fixtures from production code, weaken assertions, or add skips to pass. Do not use real seeds or funded-wallet data. Tests enforce an installed-package budget below 3,000 lines.
66+
Use pytest and Hypothesis. Name tests `test_<behavior>` and give test modules an evidence-focused docstring. Add normative vectors, negative cases, and regressions with behavioral changes. Never derive expected fixtures from production code, weaken assertions, or add skips to pass. Do not use real seeds or funded-wallet data.
3267

3368
## Security and Agent Instructions
3469

35-
Read `SECURITY.md`, `docs/architecture.md`, and `docs/AI_POLICY.md` before security work. Preserve validated-artifact boundaries, symbol-only shares, OS-backed entropy, and stdout/stderr separation. Agents may edit and test locally, but must not push, open pull requests, post maintainer comments, or claim authorship. A human publishes every contribution.
70+
Read `SECURITY.md`, `docs/security/model.md`, `docs/developer/api.md`, and `docs/developer/ai-policy.md` before security work. Preserve validated-artifact boundaries, symbol-only shares, OS-backed entropy, and stdout/stderr separation. Agents may edit and test locally, but must not push, open pull requests, post maintainer comments, or claim authorship. A human publishes every contribution.
3671

3772
## Commit & Pull Request Guidelines
3873

‎MANIFEST.in‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
include LICENSE README.md SECURITY.md build_backend.py
1+
include LICENSE README.md SECURITY.md
22
recursive-include docs *.html *.md
3+
prune docs/planning
4+
exclude docs/developer/provenance.md
35
recursive-include requirements *.txt
46
recursive-include tests *.py *.json *.md
57
recursive-include tools *.py

0 commit comments

Comments
 (0)