From 9810fd18db280f16a7037dbb6daf019bcf6d6926 Mon Sep 17 00:00:00 2001 From: projectmoon Date: Sun, 23 May 2021 23:17:49 +0000 Subject: [PATCH] Add 'Feature: User Accounts and State' --- Feature%3A-User-Accounts-and-State.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Feature%3A-User-Accounts-and-State.md diff --git a/Feature%3A-User-Accounts-and-State.md b/Feature%3A-User-Accounts-and-State.md new file mode 100644 index 0000000..5a70199 --- /dev/null +++ b/Feature%3A-User-Accounts-and-State.md @@ -0,0 +1,22 @@ +# User Accounts and State +This documents user accounts and state, a foundational feature required for building a functional web UI for users to manage their information in the bot. The core of this idea is that users can register an "account" with the bot, which is just a record of their matrix user ID and a hashed password. But it also includes the ability to create and manage user state, like the active room for the user. + +## User Accounts +The primary part. We need to store user information in the bot. + + - [X] User account table: A DB table. Duh. + - [X] Secure command handling: Registration command is sensitive and contains password. Can only be done in E2EE room alone with the bot. Password is not logged. + - [X] Registration command: `!register ` to create or update an account with the bot. + - [ ] Registration command for bridges: For bridged non-Matrix platforms, we must support a method of registration that doesn't require E2EE rooms. Likely way to do this is a temp password/activation code sent via email + complete registration in a web UI somewhere. + - [X] Check account command. Give it the password and it will tell you if you are able to log in. + + +The trickier part of this is supporting bridged platforms, since those don't work with the native end-to-end encryption in Matrix. For this, we'll need to add the ability to send emails to the bot (Optional SMTP config), and an account status that tells us if we are full or only partially active. Partially active accounts need to complete registration elsewhere (web UI). + +## User State + +Store some information about what the user is doing, and provide commands to manage it. The primary use case for this is for Private Commands (contextually managing info in any room from a DM with the bot). If we store the active room for a user, we can then add that room to any command executed from a DM, and it will even hook into the existing context system (mostly). + +- [ ] User state DB table with columns `user_id, account_status, active_room`. +- [ ] `!room` command to switch active room. +- [ ] Add `originating_room` to Context, so we can differentiate between room where command is executed, and room where command should apply. \ No newline at end of file