-
-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ValidatesWebData trait #562
Conversation
Hi @Lukasss93, could we discuss connecting our tgWebValid library to provide the user validation functionality you need? We have support for working with several bots and all necessary tests |
Hello, thanks for the support (I use your library too). |
Of course, everyone's opinion is important. And I will accept any decision you make, but could I somehow influence it so that it would be positive, so that you could focus most of all on the development of the functionality of the bot, and I would take care of the rest. If you have any conditions, please tell me, let's talk |
2️⃣
For now I would keep the implementation as small as possible, if in the future there is a need for additional features, such as multi bot, the introduction of third-party libraries may be considered. |
Please note that this is not only about multibot. The library allows you to test both types of users (Telegram Login Widget and Telegram Web App) out of the box. Also, after parsing and checking the data, entities are created so that the user can get all the necessary data and later manipulate, store, and so on. And these entities have 100% autocomplete, which is very convenient for other developers. Another advantage is the ability to retrieve data as an array (which is what @Lukasss93 is trying to achieve in this enhancement). Your library can get all this in a matter of minutes. Of course, it's up to you to decide, but if you let me show you how it would look and feel... |
[ci skip] [skip ci]
Apply fixes from StyleCI
Code Climate has analyzed commit d6b7150 and detected 2 issues on this pull request. Here's the issue category breakdown:
The test coverage on the diff in this pull request is 100.0% (60% is the threshold). This pull request will bring the total coverage in the repository to 96.9% (0.1% change). View more on Code Climate. |
TODO
How to use
Question
How to implement this PR?
Variant 1 (boolean) ❌
isWebAppDataValid
andisLoginDataValid
will return a boolean valuegetWebAppDataAsArray
andgetIsLoginDataAsArray
after validation to read parsed dataVariant 2 (exception) ✅
isWebAppDataValid
andisLoginDataValid
tovalidateWebAppData
andvalidateLoginData
validateWebAppData
andvalidateLoginData
will return the parsed data otherwise anInvalidDataException