Retry v6 push registration after identity rejection#959
Open
czien wants to merge 4 commits into
Open
Conversation
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.
Summary
Retry v6
register_push_tokenonce when the cached Mega identity is rejected withCODE_NEED_NEGOTIATE_KEYorCODE_SIGNATURE_ERROR, then persist the refreshed Mega session after successful push registration.Why
When the cached v6/Mega identity is stale,
register_push_tokencan fail even though the account still has a valid Mega auth session.MegaHTTPApi.signedPostalready clears cached identities for these response codes, so retrying the push-token registration lets the second attempt perform a fresh key exchange and register successfully.Persisting the session after a successful push registration keeps the refreshed identity available for later startups.
Validation
npm test -- --runTestsByPath src/http/__test__/megaApiPushSelector.test.tsx --runInBand./node_modules/.bin/tsc -p tsconfig.build.json./node_modules/.bin/prettier --check src/http/megaTransition.ts src/http/__test__/megaApiPushSelector.test.tsxAlso validated against a real Home Assistant Eufy WS add-on setup where v6 push registration recovered and doorbell ring events began reaching the original ringing sensor after this patch.