askfmforhumans / afh-bot Goto Github PK
View Code? Open in Web Editor NEWMultifunctional bot intended to mend some of ASKfm's screwups
Home Page: https://afh.snowwm.ml/bot
License: MIT License
Multifunctional bot intended to mend some of ASKfm's screwups
Home Page: https://afh.snowwm.ml/bot
License: MIT License
ASKfm doesn't support OAuth (sigh).
Storing users' passwords is of course insane, but that's what's currently implemented.
We can also use the password to get an access token and store that token. This is preferable (practically this is OAuth). The downside is that it can require manual re-logins when the token gets invalidated.
Backend storage is simple, reliable, presumably more secure, but less fun.
The idea of an (almost) completely stateless service appeals to me (I mean no state on the central server, the state is decentralized). That's why I want to store secrets client-side and that obviously requires encryption.
Again, symmetric is just more simple and secure, but less fun.
I think asymmetric is more flexible as it enables more auth flows. Tech-savvy users may generate and encrypt the token themselves or we can offer a client-side utility for it.
Currently we use RSA with a 1024-bit key, which is not outright insane, but the recommended key size is at least 2048 bits (see this). However, we have very limited space in the user's profile, so anything beyond 128 bytes seems imparctical.
A promising option is eciespy, which requires just 97 + data size bytes and provides integrity guarantees on top of encryption.
Currently we have Password + Encrypted + Asymmetric + 1024-bit RSA.
I want to move to Token + Encrypted + Asymmetric + ECIES.
Config type | Examples | Managed by |
---|---|---|
global | enabled features, UI messages/localizations | admins |
global secrets | API tokens and other credentials | admins |
user | enabled features (autoblock , filter="go mutual likes" ) |
users |
user meta | user access token and some metadata | users/app |
Storage type | Config type | Capacity | Management | Pros | Cons |
---|---|---|---|---|---|
env variables | global | medium | easy | needs app restart (at least on Heroku) | |
cloud config service (e.g. https://config.ly/) | global | high | easy | ||
database | global | high | medium | ||
database | user | high | hard (need to create an interface) | non-transparent for users | |
profile description | user | low (300 characters including user's own info) | easy | decentralized | messes user's personal info |
profile hashtags | user | low (50 lowercase letters per hashtag) | almost easy | decentralized | messes user's personal info |
I prefer decentralized approaches, so I'm after storing user config in users' own profiles.
Credentials are an important subtype of user config. ASKfm doesn't support OAuth (sigh), but we can use the user's password to get an access token and store that token. This is practically OAuth. The downside is that it can require manual re-logins when the token gets invalidated.
Storing credentials on users' profiles obviously requires encryption.
Symmetric is simple and secure, but I think asymmetric is more flexible as it enables more auth flows. Tech-savvy users may generate and encrypt the token themselves or we can offer a client-side utility for it.
A promising option is eciespy, which requires just 97 + data size bytes and provides integrity guarantees on top of encryption.
In the end, storing credentials on users' profiles seems impractical since:
Config type | Storage type |
---|---|
global | database |
global secrets | env variables |
user | profile description |
user meta | database |
TBD
I've been running the bot for ~1 week with 3-4 active users before it was blocked by ASKfm without any warning.
Don't know if it's because it asked users for their passwords or for other reasons.
Running in simple mode without a bot has been OK so far.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.