8000 feat(bip39): split glued words by oritwoen · Pull Request #443 · agntn/keys · GitHub
[go: up one dir, main page]

Skip to content

feat(bip39): split glued words - #443

Merged
oritwoen merged 2 commits into
mainfrom
feat/bip39-words-segment
Nov 28, 2026
Merged

oritwoen merged 2 commits into
mainfrom
feat/bip39-words-segment

Conversation

@oritwoen
@oritwoen oritwoen commented Nov 28, 2026 •
Copy link
Copy Markdown
Member

🔸 What this resolves

Closes #440

🔶 Why it's needed

keys_bip39_words_segment lists the BIP39 phrases a run of glued letters can be cut into, and the checksum picks carpet over car pet.


Read this PR faster    Follow each request

@oritwoen oritwoen self-assigned this Nov 28, 2026
@coldtea-pr-lens
coldtea-pr-lens Bot commented Nov 28, 2026 •
Copy link
Copy Markdown
  • Redraw · drawn at 64b0bc0, the branch has moved on

Architecture

Walkthrough of Segment glued BIP39 mnemonic words, in four steps

Read this PR faster

Inside the changed components — 1 view

Component view — BIP39 Word Segmentation

Internal dispatch and algorithm modules for glued word segmentation

Architecture view of Component view — BIP39 Word Segmentation in agntn/keys

Data flow

Data flow diagram for agntn/keys at 64b0bc0

Follow each request


Review

✨ Nothing flagged · reviewed 64b0bc0


Tip

The CLI's render reads .github/pr-lens.yml and applies your renames, exclusions and lane pins at draw time

🪧 More tips
  • Run npx skills add coldteadotai/pr-lens, then tell your coding agent: "Diagram the change you just made with PR Lens and attach it to the pull request."
  • Run npx @coldtea/pr-lens-cli analyze --base origin/main on a branch, then npx @coldtea/pr-lens-cli render .pr-lens/graph.json. Same lenses, your own model key, before the pull request exists
  • Click the link under each diagram to open it on a canvas you can zoom, pan and step through
  • The diagrams are links. Click one to open it on the canvas, then press W or click play to walk through the change
  • Open a diagram on the canvas, then press W or click play to walk through the change one step at a time
  • Set github.comment.collapsed: true in .github/pr-lens.yml to fold the comment behind one View architecture… row. Drawing still runs as before
  • Set github.draw: on-demand in .github/pr-lens.yml and PR Lens stops drawing pull requests on its own. Comment @pr-lens draw on a pull request when you want that one drawn
  • Add .github/workflows/pr-lens.yml with coldteadotai/pr-lens/packages/action@v0 and your model provider's key as its api-key to run PR Lens from your own CI. Any /chat/completions endpoint works
  • After a push, tick Redraw to draw the latest commit
  • Switch GitHub to dark mode and the diagrams follow. The moving dots are this pull request's data in motion
  • Set github.description: false in .github/pr-lens.yml to stop PR Lens adding buttons to your PR descriptions

Thanks for using PR Lens! It's free for OSS. If it helped, a star helps other teams find it.  Star PR Lens on GitHub

@chatgpt-codex-connector
chatgpt-codex-connector Bot commented Nov 28, 2026 •
Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-28T18:48:17.167767Z 68588bd New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cubic-dev-ai cubic-dev-ai Bot left a comment •
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cubic analysis

All reported issues were addressed across 17 files

Linked issue analysis

Linked issue: agntn/keys#440: Split glued BIP39 words and check each split

Status Acceptance criteria Notes
✅ Split glued letters into complete BIP39 phrases splitWords builds complete covers for 12, 15, 18, 21, and 24 words; tests reject partial coverage.
✅ Use an explicit language-specific BIP39 word list The tool loads the requested language, and splitWords accepts a supplied wordlist; tests cover Czech and other lists.
✅ Check the checksum for every split splitWords yields a checksum verdict for each cover, and the ambiguous example verifies that only one split passes.
✅ Count splits and passing splits, then page results safely The tool reports total and valid counts, supports limit and offset, and refuses searches above its cap.
✅ Reject inputs that cannot be fully covered An uncovered letter produces no split, and the tests confirm the result is not a partial phrase.
Architecture diagram
sequenceDiagram
    participant CLI as CLI / MCP Client
    participant Tool as keys_bip39_words_segment Tool
    participant Exec as segmentBip39Words()
    participant Split as splitWords / countWordSplits
    participant Graph as Split Graph Builder
    participant Wordlist as BIP39 Wordlist
    participant Checksum as checksumTest()

    Note over CLI,Checksum: Glued Word Segmentation Flow

    CLI->>Tool: callTool("keys_bip39_words_segment", { letters, all, limit, offset, language })
    Tool->>Tool: Validate via SEGMENT_BIP39_WORDS_PARAMETERS schema
    
    alt Valid arguments
        Tool->>Exec: execute({ letters, options }, { signal })
        Exec->>Exec: segmentLetters() - validate non-empty, max 1024 chars
        Exec->>Exec: parseBIP39Language() - default english
        Exec->>Split: countWordSplits(letters, { wordlist })
        Split->>Graph: buildGraph(letters, options)
        Graph->>Graph: foldLetters() - normalize, strip whitespace, validate letters only
        Graph->>Graph: findWords() - map word prefixes to indices
        Graph->>Graph: countCovers() - dynamic programming for split counts
        Graph-->>Split: count of possible splits per word count (12/15/18/21/24)
        Split-->>Exec: total split count (bigint)
        
        alt More than MAX_BIP39_CHECKSUM_SEARCH splits
            Exec->>Exec: Throw RangeError - cap exceeded
        else Within limit
            Exec->>Split: splitWords(letters, { wordlist })
            loop Each word count (12, 15, 18, 21, 24)
                Split->>Checksum: checksumTest(count) - get validation function
                loop Each valid split
                    Split->>Checksum: Validate checksum
                    Checksum-->>Split: Valid / Invalid
                    Split-->>Exec: { words, checksumValid }
                end
            end
            Exec->>Exec: segmentPage() - filter by "all" flag, apply offset/limit
            Exec->>Exec: segmentText() - format output with counts and splits
            Exec-->>Tool: ToolResult with content + details
            Tool-->>CLI: Formatted response (counts + listed splits)
        end
    else Invalid arguments
        Tool-->>CLI: Error response with validation message
    end
Loading

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread docs/content/1.guide/4.wallets.md Resolved
Comment thread test/utils/bip39-split.test.ts Resolved
@cubic-dev-ai cubic-dev-ai Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 2 files (changes from recent commits).

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Auto-approved: Adds a new, well-tested BIP39 glued-word splitting library API and agent tool behind explicit caps, with docs and tests; existing behavior is unchanged and the change is additive and bounded.

Re-trigger cubic

@oritwoen
oritwoen merged commit 3105cb1 into main Nov 28, 2026
4 checks passed
@oritwoen
oritwoen deleted the feat/bip39-words-segment branch November 28, 2026 18:52
@github-actions github-actions Bot mentioned this pull request Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Split glued BIP39 words and check each split

1 participant

0