Repository navigation
Add opt-in raw chat ID attribute to the Telegram provider - #326
Merged
Merged
Conversation
The Telegram user ID is a hash of the chat ID, so an app that logs users in with Telegram alone has no way to message them through its bot. ChatIDAttribute, when set, stores the raw chat ID as a string attribute under that key on a fresh login. Empty keeps the current behavior, so the raw ID does not reach the token and the user responses of apps that do not need it.
Coverage Report for CI Build 42523015358Coverage increased (+0.01%) to 86.841%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
Coverage Report for CI Build 42523015349Coverage increased (+0.1%) to 86.931%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
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.
Previously, the Telegram provider exposed only the hashed
telegram_...user ID, so an app that logs users in with Telegram alone could not message them through its bot. After this change,TelegramHandlerhas aChatIDAttributefield. Empty, the default, keeps the current behavior. When set, a fresh login stores the user's raw chat ID as a decimal string under that key in the user attributes, so it reaches the JWT and the/auth/userand login responses. The user ID stays hashed either way. v1 and v2 get the same change.Tokens issued before the key was set carry no attribute until the user logs in again.
TestTelegramProcessUpdates_ChatIDAttribute, in v1 and v2, covers both modes and checks the attribute in the login response and in the JWT read back through the token service; with theSetStrAttrcall removed, its set-key case fails. Tests pass with-racefor both modules, and golangci-lint v2.12.2 reports no issues.Resolves #267