feat: move safe keycard box codec from key-card - #9881
Merged
Merged
Conversation
Contributor
Contributor
|
|
Moves parseSafeKeycardBox, SafeKeycardRoots and SafeRootKeyType into sdk-lib-safes so decryptSafeKeycard can use them without a key-card -> sdk-core -> sdk-lib-safes cycle. key-card re-exports them, so its public API and behaviour are unchanged. Also derives key-card's SAFE_ROOT_ORDER from a satisfies-checked Record so a missing or extra slot is a compile error. TICKET: WCN-2734
danielpeng1
approved these changes
Oct 2, 2026
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused relocation preserves parser behavior and public exports, with regression coverage and no identified blocking issues.
Review effort: Balanced
Findings: None
What changed in this PR
Moves Safe keycard parsing into sdk-lib-safes, making it available to recovery code without introducing a dependency cycle.
Changes:
- Relocates the codec and types while preserving
key-cardexports. - Adds compile-time checks for render-order slot completeness.
- Updates dependencies and adds parser and render-order regression tests.
| File | Description |
|---|---|
modules/sdk-lib-safes/test/unit/keycardCodec.ts |
Tests valid boxes and invalid inputs. |
modules/sdk-lib-safes/src/keycardCodec.ts |
Houses the relocated parser and shared types. |
modules/sdk-lib-safes/src/index.ts |
Exports the codec. |
modules/sdk-lib-safes/package.json |
Adds the codec dependency and updates the description. |
modules/key-card/tsconfig.json |
References sdk-lib-safes. |
modules/key-card/test/unit/types.ts |
Verifies stable render order. |
modules/key-card/src/types.ts |
Re-exports shared types and checks slot completeness. |
modules/key-card/src/parseKeycard.ts |
Re-exports the relocated parser. |
modules/key-card/package.json |
Replaces codec dependencies with sdk-lib-safes. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
mohd-kashif
approved these changes
Oct 2, 2026
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.
What
Moves parseSafeKeycardBox, SafeKeycardRoots and SafeRootKeyType into sdk-lib-safes so decryptSafeKeycard can use them without a
key-card -> sdk-core -> sdk-lib-safescycle. key-card re-exports them, so its public API and behaviour are unchanged.Also derives key-card's
SAFE_ROOT_ORDERfrom a satisfies-checked Record so a missing or extra slot is a compile error.TICKET: WCN-2734