Skip to content

Conversation

@lmcmz
Copy link
Contributor

@lmcmz lmcmz commented Jan 5, 2026

Related Issue

Summary of Changes

Need Regression Testing

  • Yes
  • No

Risk Assessment

  • Low
  • Medium
  • High

Additional Notes

Screenshots (if applicable)

@lmcmz lmcmz requested a review from a team as a code owner January 5, 2026 07:26
@github-actions
Copy link

github-actions bot commented Jan 5, 2026

PR Summary

Added a native-to-React Native bridge infrastructure for key rotation functionality. This includes new event emitter classes for bidirectional communication, models for key rotation check parameters and results, and integration with WalletManager to notify React Native when the wallet address changes. The implementation uses NSNotificationCenter to post nativeRequest events that React Native can observe, and handles nativeResponse callbacks from the JavaScript side.

Changes

File Summary
FRW.xcodeproj/project.pbxproj Added references for NativeEventModels.swift, NativeRequestEventEmitter.h, and NativeRequestEventEmitter.m to the Xcode project build phases and file groups.
FRW/Foundation/Bridge/NativeEventModels.swift New file defining RNNativeEvent enum containing KeyRotationCheckParams, KeyRotationCheckResult, NativeRequestPayload, NativeResponsePayload structs, and NativeEventName enum with keyrotationcheck case for typed communication between native and React Native.
FRW/Foundation/Bridge/NativeRequestEventEmitter.h New file declaring NativeRequestEventEmitter class that extends RCTEventEmitter and conforms to RCTBridgeModule protocol for React Native event emission.
FRW/Foundation/Bridge/NativeRequestEventEmitter.m New file implementing NativeRequestEventEmitter that listens for nativeRequest notifications via NSNotificationCenter and forwards them to React Native as events. Manages listener lifecycle with startObserving/stopObserving methods.
FRW/Foundation/Bridge/RCTNativeFRWBridge.mm Added three new bridge methods: signRotationRequest for signing rotation requests with public key and hash, removeOldKey for removing old keys by address, and nativeResponse for handling responses from React Native back to native code.
FRW/Foundation/Bridge/TurboModuleSwift.swift Added signRotationRequest, removeOldKey, and nativeResponse static methods. The nativeResponse method posts a .nativeResponse notification with request details to NotificationCenter for native handling.
FRW/Foundation/Define/NotificationDefine.swift Added two new notification names: .nativeRequest for sending requests to React Native and .nativeResponse for receiving responses from React Native.
FRW/Services/Manager/Wallet/WalletManager.swift Added observer for .nativeResponse notifications and handleNativeResponse method. Implemented notifyKeyRotationAddressChanged to post nativeRequest notifications when wallet address changes in changeAddress and switchSelectedAccount methods.

autogenerated by presubmit.ai

@lmcmz lmcmz marked this pull request as draft January 5, 2026 07:26
@github-actions
Copy link

github-actions bot commented Jan 5, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Copy link

@github-actions github-actions bot 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 needs attention.

Review Summary

Commits Considered (1)
  • 1fd9c2e: feat: add key rotation example
Files Processed (8)
  • FRW.xcodeproj/project.pbxproj (9 hunks)
  • FRW/Foundation/Bridge/NativeEventModels.swift (1 hunk)
  • FRW/Foundation/Bridge/NativeRequestEventEmitter.h (1 hunk)
  • FRW/Foundation/Bridge/NativeRequestEventEmitter.m (1 hunk)
  • FRW/Foundation/Bridge/RCTNativeFRWBridge.mm (1 hunk)
  • FRW/Foundation/Bridge/TurboModuleSwift.swift (1 hunk)
  • FRW/Foundation/Define/NotificationDefine.swift (1 hunk)
  • FRW/Services/Manager/Wallet/WalletManager.swift (4 hunks)
Actionable Comments (1)
  • FRW/Foundation/Bridge/TurboModuleSwift.swift [164-167]

    possible issue: "Function body is empty and discards all parameters."

Skipped Comments (3)
  • FRW/Foundation/Bridge/TurboModuleSwift.swift [156-161]

    maintainability: "Unused parameters are explicitly discarded without explanation."

  • FRW/Services/Manager/Wallet/WalletManager.swift [547-550]

    possible bug: "Missing validation for required notification fields."

  • FRW/Foundation/Bridge/NativeRequestEventEmitter.m [40-42]

    possible issue: "Nil userInfo handling may silently drop valid notifications."

Comment on lines +164 to +167
static func removeOldKey(address: String, publicKey: String) async throws {
_ = address
_ = publicKey
}
Copy link

Choose a reason for hiding this comment

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

The removeOldKey function accepts address and publicKey parameters but does nothing with them. This appears to be a stub implementation that should either be completed or documented as a placeholder.

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