feat(key-card): add PDF keycard parsing via pdfjs-dist (WCN-19)#8509
Draft
mohammadalfaiyazbitgo wants to merge 1 commit intomasterfrom
Draft
feat(key-card): add PDF keycard parsing via pdfjs-dist (WCN-19)#8509mohammadalfaiyazbitgo wants to merge 1 commit intomasterfrom
mohammadalfaiyazbitgo wants to merge 1 commit intomasterfrom
Conversation
1c1757c to
d4ab6b1
Compare
Implements extractKeycardEntriesFromPDF() in @bitgo/key-card, moving PDF upload/parse logic from the UI layer into the SDK (WCN-19). - Adds pdfjs-dist dependency (v5) using the official webpack.mjs entry point so GlobalWorkerOptions.workerPort is auto-configured by webpack with no manual worker setup required - Reconstructs visual text lines from PDF text nodes (page/y/x sort) - Parses labelled keycard sections (A–D) and their data values with brace-depth tracking for multi-line JSON fields - Stops parsing at the BitGo KeyCard FAQ header - Exports KeycardEntry and PDFTextNode types from @bitgo/key-card - Adds unit tests covering line reconstruction and section parsing - Wires up a ParseKeycard demo component in @bitgo/web-demo - Bumps root webpack to 5.106.1 (fixes ESM init bug with pdfjs-dist v5) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
d4ab6b1 to
2419287
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
extractKeycardEntriesFromPDF()in@bitgo/key-card, moving PDF upload/parse logic from the UI layer into the SDK (Linear: WCN-19)pdfjs-dist/webpack.mjs(Mozilla's official webpack entry point) soGlobalWorkerOptions.workerPortis auto-configured — no manual worker setup requireddata:values with brace-depth tracking for multi-line JSONKeycardEntryandPDFTextNodetypes publicly from@bitgo/key-cardParseKeycarddemo component in@bitgo/web-demoat/parse-keycardObject.defineProperty called on non-objectwith pdfjs-dist v5 under webpack 5.98)Test plan
yarn workspace @bitgo/key-card unit-testyarn workspace @bitgo/key-card tsc --noEmityarn workspace @bitgo/web-demo dev), navigate to/parse-keycard, upload a GG18 keycard PDF — table of parsed sections (A/B/C/D) should appearassertIsValidKeymethod on tss and utxo wallets.🤖 Generated with Claude Code