Skip to content

fix: wrap buffer.subarray() calls with Buffer.from()#233

Merged
matthewjablack merged 2 commits intomasterfrom
fix/react-native-buffer-compatibility
Oct 20, 2025
Merged

fix: wrap buffer.subarray() calls with Buffer.from()#233
matthewjablack merged 2 commits intomasterfrom
fix/react-native-buffer-compatibility

Conversation

@matthewjablack
Copy link
Contributor

Problem

React Native's Buffer implementation doesn't handle subarray() the same way as Node.js, causing deserialization failures in DLC messaging components when used in React Native environments.

Solution

  • wrap all buffer.subarray() calls with Buffer.from() to ensure proper Buffer instances
  • fix nextBytes buffer reading in DlcOffer.ts by using BufferReader instead of direct buffer methods
  • ensure compatibility across Node.js and React Native environments

Changes

  • fix ContractInfo.ts deserialization for React Native
  • fix DlcAccept.ts CET adaptor signature parsing
  • fix DlcOffer.ts nextBytes buffer reading compatibility
  • fix DlcSign.ts funding signature deserialization

Testing

  • all existing tests pass
  • maintains backward compatibility with Node.js
  • eliminates need for manual patches in React Native projects

Fixes React Native compatibility issues without breaking existing functionality.

- fix ContractInfo deserialization for React Native
- fix DlcAccept CET adaptor signature parsing
- fix DlcOffer nextBytes buffer reading compatibility
- fix DlcSign funding signature deserialization
- ensure all buffer operations work in React Native
@matthewjablack matthewjablack merged commit bd4732f into master Oct 20, 2025
2 checks passed
@matthewjablack matthewjablack deleted the fix/react-native-buffer-compatibility branch October 20, 2025 22:35
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.

1 participant

Comments