tomer8007 / kik-bot-api-unofficial

Python API for writing unoffical Kik bots that act like humans
MIT License
127 stars 77 forks source link

Refactor device_id and android_id #228

Closed karlebot closed 1 year ago

karlebot commented 1 year ago

Since device_id and android_id are so tightly-bound to a username/ login session, and because there are potential problems surrounding globally-configured values (i.e. account bans), I'd like to see the API require the user to explicitly set these values.

I've removed the concept of a device_id or android_id "override", which creates a more intuitive interface, while forcing the user to be cognizant of these values.

While the user is able to manage these values however they like, I've provided a suggested config-file-base approach in the example files. Users can create a new configuration file using the generate_credentials_file.py script, or make use of the credentials file generated by register_client.py.

I realize that these API changes are not backwards-compatible. This was a conscious decision, as it requires the user to reevaluate how they are using device_id and android_id and make any necessary changes at this time. The burden of code changes required should be fairly minimal for any user of this library.

Let me know if you have any feedback, comments or suggestions. Thanks~~

tomer8007 commented 1 year ago

Thanks for the PR. While constant Android ID \ Device ID might indeed cause account bans and are problematic, I don't like forcing the user to generate these IDs because it makes the API more complicated to use for beginners. So the override option was good in my opinion.

Maybe we can warn the user about using the default IDs / generate random ones at startup.

bluemods commented 1 year ago

It's worth pointing out that a past contributor to this API is now a current employee working against unofficial clients. Given they are 100% aware of this client, it would be a good idea to force ID uniqueness.

I suggest that if supplying IDs manually is too much work, you could change the KikClient constructor to be something like

    def __init__(self, callback: callbacks.KikClientCallback, kik_username, kik_password,
                 kik_node=None, device_id=random_device_id(), android_id=random_android_id()):

where the generation of new IDs will happen by default without the user having to specify them.

karlebot commented 1 year ago

I think that's a reasonable compromise. I've made those changes.

I'd just like to add that for libraries such as this one, which are unofficial and operate in a "hostile" environment, ease of use tends to become less of a priority than stability and reliability. While this change increases complexity a bit, it should help it to survive a bit longer into the future.