Skip to content

Retry v6 push registration after identity rejection#958

Closed
czien wants to merge 1 commit into
bropat:masterfrom
czien:fix/mega-push-registration-retry
Closed

Retry v6 push registration after identity rejection#958
czien wants to merge 1 commit into
bropat:masterfrom
czien:fix/mega-push-registration-retry

Conversation

@czien

@czien czien commented Jul 14, 2026

Copy link
Copy Markdown

Summary

Retry v6 register_push_token once when the cached Mega identity is rejected with CODE_NEED_NEGOTIATE_KEY or CODE_SIGNATURE_ERROR, then persist the refreshed Mega session after successful push registration.

Why

When the cached v6/Mega identity is stale, register_push_token can fail even though the account still has a valid Mega auth session. MegaHTTPApi.signedPost already 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

  • Focused Jest test:
    npm test -- --runTestsByPath src/http/__test__/megaApiPushSelector.test.tsx --runInBand
  • Direct TypeScript compile:
    ./node_modules/.bin/tsc -p tsconfig.build.json
  • Prettier check:
    ./node_modules/.bin/prettier --check src/http/megaTransition.ts src/http/__test__/megaApiPushSelector.test.tsx

Also 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.

@github-actions

Copy link
Copy Markdown

Thanks for your contribution! 🙏

However, this pull request targets the master branch. All contributions should target the develop branch instead.

Please re-open this PR against develop:

gh pr edit 958 --base develop

Or create a new PR targeting develop from the GitHub UI.

@github-actions github-actions Bot closed this Jul 14, 2026
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