Skip to content

feat: move safe keycard box codec from key-card - #9881

Merged
pranishnepal merged 1 commit into
masterfrom
WCN-2734
Oct 2, 2026
Merged

pranishnepal merged 1 commit into
masterfrom
WCN-2734

Conversation

@pranishnepal

Copy link
Copy Markdown
Contributor

What

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

@linear-code

linear-code Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

WCN-2734

@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Unit tests are failing on Node 26.x (Current release line, non-blocking). This is not an LTS version yet, so it does not block merge, but it signals an incompatibility to fix before Node 26.x becomes LTS.

View run

@pranishnepal
pranishnepal marked this pull request as ready for review October 2, 2026 15:58
@pranishnepal
pranishnepal requested review from a team as code owners October 2, 2026 15:58
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

Copilot AI 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.

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-card exports.
  • 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.

@pranishnepal
pranishnepal merged commit 5f3f4bc into master Oct 2, 2026
27 checks passed
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.

4 participants