refactor(kyc-controller): move Moonpay frame handling out of KycController - #10082
Merged
Merged
Conversation
Signed-off-by: Sébastien Van Eyck <sebastien.vaneyck@consensys.net>
Akaryatrh
previously approved these changes
Sep 3, 2026
Akaryatrh
enabled auto-merge
September 3, 2026 13:55
…ay-specific-flow' into jl/kyc-controller-refactor-moonpay-specific-flow
Akaryatrh
deleted the
jl/kyc-controller-refactor-moonpay-specific-flow
branch
September 3, 2026 15:21
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation
Starting the pattern of abstracting vendor specific flows out of the KycController
References
Checklist
Note
Medium Risk
Behavior is largely a move of authentication-critical frame/crypto logic; regressions would affect MoonPay login and token handling, though the refactor is covered by relocated unit tests and unchanged public controller APIs.
Overview
Extracts MoonPay Check/Auth frame logic from
KycControllerintovendors/MoonPayFrameHandler, as the first step toward isolating vendor-specific flows.KycControllerstill exposes the same frame APIs (handleFrameMessage,buildCheckFrameUrl,buildAuthFrameUrl,buildResetFrameUrl) but delegates to a composedMoonPayFrameHandlerwired with callbacks (getState,update,fail,onAuthenticated,requireTermsReacceptance). Frame keypairs, auth client tokens, message parsing, credential decryption, URL construction, and phase transitions for Check/Auth now live in the handler;clearMoonPaySessionis shared from that module for state teardown on vendor switch, session recreate, andreset.Tests move detailed frame-protocol coverage to
MoonPayFrameHandler.test.ts;KycController.test.tsmocks the handler and asserts delegation, lifecycle hooks (startFlow,ensureKeypair,clear,clearAuthentication), and controller callback wiring. ARCHITECTURE.md documents the new file in the appendix.Reviewed by Cursor Bugbot for commit 160ea1b. Bugbot is set up for automated code reviews on this repo. Configure here.