Skip to content

Conversation

@fAnselmi-Ledger
Copy link
Contributor

@fAnselmi-Ledger fAnselmi-Ledger commented Dec 2, 2025

πŸ“ Solana byte-level transaction crafter

Following this study this tool replaces the public key in a Solana transaction, allowing users to test-sign a transaction they do not own.

High-Level Behaviour

  • It decodes the base64 payload, detects whether it’s a transaction (signatures + message) or a bare message, and whether it’s legacy or v0.
  • It locates the first account key in the message (the fee-payer) and overwrites exactly those 32 bytes with the new 32-byte pubkey (decoded from base58).
  • If the input is a transaction, it also zeros out all existing signatures so it must be re-signed, instructions and all other accounts remain unchanged.
  • If the payload isn’t a valid legacy/v0 message or transaction, or the new pubkey isn’t 32 bytes, it throws with a clear error.
Screen.Recording.2025-12-02.at.17.59.55.mov

  • JIRA or GitHub link: [NO-ISSUE]

βœ… Checklist

Pull Requests must pass CI checks and undergo code review. Set the PR as Draft if it is not yet ready for review.

  • Covered by automatic tests
  • Changeset is provided
  • Documentation is up-to-date
  • Impact of the changes:
    • list of the changes

🧐 Checklist for the PR Reviewers

  • The code aligns with the requirements described in the linked JIRA or GitHub issue.
  • The PR description clearly documents the changes made and explains any technical trade-offs or design decisions.
  • There are no undocumented trade-offs, technical debt, or maintainability issues.
  • The PR has been tested thoroughly, and any potential edge cases have been considered and handled.
  • Any new dependencies have been justified and documented.

@vercel
Copy link

vercel bot commented Dec 2, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
device-sdk-ts-sample Ready Ready Preview Comment Dec 12, 2025 3:27pm
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
doc-device-management-kit Ignored Ignored Dec 12, 2025 3:27pm

@fAnselmi-Ledger fAnselmi-Ledger changed the title ✨ (solana-signer) [NO-ISSUE]: Add solana pubkey swap ✨ (solana-signer) [NO-ISSUE]: Solana transaction crafter Dec 5, 2025
@fAnselmi-Ledger fAnselmi-Ledger force-pushed the feat/no-issue-solana-swap-transaction-signer branch from 756a03d to 70c9dea Compare December 8, 2025 08:25
@fAnselmi-Ledger fAnselmi-Ledger marked this pull request as ready for review December 12, 2025 10:11
@fAnselmi-Ledger fAnselmi-Ledger requested a review from a team as a code owner December 12, 2025 10:11
Copilot AI review requested due to automatic review settings December 12, 2025 10:11
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a Solana transaction crafter tool that enables swapping the fee-payer public key in Solana transactions. The implementation handles both legacy and v0 transaction formats, as well as bare messages, making it useful for testing scenarios where users need to sign transactions they don't originally own.

Key Changes

  • Implements SwapSigner service with byte-level transaction manipulation capabilities for legacy and v0 Solana transactions
  • Adds SwapTransactionSignerDeviceAction, use case, and integration into the Solana signer toolkit
  • Introduces bufferToBase64String utility function in device-management-kit for cross-environment base64 encoding

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
packages/signer/signer-solana/src/internal/app-binder/services/SwapSigner.ts Core logic for detecting and swapping fee-payer keys in Solana transactions/messages with signature zeroing
packages/signer/signer-solana/src/internal/app-binder/services/SwapSigner.test.ts Comprehensive test suite covering legacy/v0 transactions, messages, edge cases, and malformed inputs
packages/signer/signer-solana/src/internal/app-binder/device-action/SwapTransactionSignerDeviceAction.ts State machine implementation for the swap transaction signer device action
packages/signer/signer-solana/src/internal/app-binder/device-action/SwapTransactionSignerDeviceAction.test.ts Device action state machine tests covering happy path and error scenarios
packages/signer/signer-solana/src/internal/app-binder/SolanaAppBinder.ts Integration of SwapTransactionSigner method into the app binder
packages/signer/signer-solana/src/internal/app-binder/SolanaAppBinder.test.ts Tests for the app binder integration
packages/signer/signer-solana/src/internal/use-cases/swap-transaction-signer/SwapTransactionSignerUseCase.ts Use case that wraps the app binder call with optional skipOpenApp support
packages/signer/signer-solana/src/internal/use-cases/swap-transaction-signer/SwapTransactionSignerUseCase.test.ts Use case tests verifying parameter passing and options handling
packages/signer/signer-solana/src/internal/use-cases/di/useCasesTypes.ts DI symbol registration for the new use case
packages/signer/signer-solana/src/internal/use-cases/di/useCasesModule.ts DI module binding for the swap transaction signer use case
packages/signer/signer-solana/src/internal/use-cases/di/useCasesModule.test.ts DI module binding verification test
packages/signer/signer-solana/src/internal/DefaultSolanaTools.ts Public API implementation for swapTransactionSigner method
packages/signer/signer-solana/src/internal/DefaultSolanaTools.test.ts Integration test verifying the method calls executeDeviceAction
packages/signer/signer-solana/src/api/app-binder/SwapTransactionSignerDeviceActionTypes.ts Type definitions for device action input/output/errors/state
packages/device-management-kit/src/api/utils/BufferToBase64String.ts Cross-environment utility for converting Uint8Array to base64 strings
packages/device-management-kit/src/api/utils/BufferToBase64String.test.ts Comprehensive tests for BufferToBase64String covering btoa, Buffer, and edge cases
packages/device-management-kit/src/api/index.ts Export of bufferToBase64String utility function
apps/sample/src/components/SignerSolanaView/index.tsx Sample app UI integration for the swap transaction signer feature
.changeset/slimy-walls-talk.md Changeset for minor version bump in device-signer-kit-solana
.changeset/calm-beds-fly.md Changeset for patch version bump in device-management-kit

πŸ’‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

3 participants