Skip to content

Conversation

@leeland-turnkey
Copy link
Contributor

Consolidate Shared Code into shared/ Folder

Problem

There was significant code duplication between export-and-sign, import, and other frames. This led to:

  • Maintenance overhead: Security patches and improvements needed to be applied in multiple places
  • Inconsistent implementations: Subtle differences between frames could lead to bugs

Solution

Created a new shared/ folder containing common utilities used across all frames, following the recommendation to "unify the code between all frames by extracting shared code into reusable libraries."

Changes

Updated Frames to Use Shared Code

  1. export-and-sign:

    • Updated turnkey-core.js to import from shared and keep frame-specific code (Ed25519, verifyEnclaveSignature using @turnkey/crypto)
    • Updated crypto-utils.js to re-export from shared
    • Updated webpack config to resolve @shared alias
  2. import:

    • Updated turnkey-core.js to import from shared and keep frame-specific applySettings logic
    • Updated index.js and standalone.js to use shared HpkeEncrypt
    • Updated webpack config to resolve @shared alias

Added CI for Shared Folder

  • Added shared to CI matrix for tests, linting, and formatting
  • Shared code is now validated on every push/PR

@socket-security
Copy link

socket-security bot commented Jan 9, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​babel/​preset-env@​7.28.5971007796100
Added@​testing-library/​jest-dom@​6.9.110010010089100

View full report

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.

2 participants