Package: sixauth
Table of ContetssixauthInstallationUsageInstancingWith Context ManagerWithout Context ManagerRemote or Local ConnectionsCurrent Working DirectoryLocal FolderServersSetting ValuesSigning UpLogging InSaving DataLoading DataDeleting DataRemoving UserExceptionssixauth.mainHosting a ServerLicense and DisclaimerAuthorssixauthsixauthis a collection of tools for user authentication and data management. The library is released under the MIT License and the documentation is generated by an AI trained by OpenAI.Thesixauthmodule provides a simple way to handle user authentication and data storage on a remote server or your local machine. TheAuthSeshclass allows you to sign up, log in, and manage their data in the database. For more details and examples, see theAuthSesh class documentation.InstallationYou can install sixauth using Python's built-in package manager:$ pip install sixauthOr by downloading this repo and moving thesixauth folderwhere its needed.UsageInstancingTo use theAuthSeshclass, you first need to create an instance of the class. There are two ways to do this, with a context manager or without.With Context ManagerTheAuthSeshclass can be used as a context manager:fromsixauthimportAuthSeshwithAuthSesh()asauth:# ...This will automatically log out and terminate the session when the context ends.Without Context ManagerTheAuthSeshclass can also be used without a context manager:fromsixauthimportAuthSeshauth =AuthSesh()# ...When you are done with the instance, you have to use theterminate()method to save your work and properly close connections:auth.terminate()IMPORTANT: If you do not do this, nothing you do will save.Remote or Local ConnectionsWhen creating aAuthSeshinstance there are a few options for where the instance will connect to. You can only pick from one of these, if you provide an address and a path, it will connect to the server and disreguard the path given.Current Working DirectoryThe simplest is connecting to a database in the current working directory of your script:AuthSesh()This will create a database.db file in the current working directory if one is not already there.Local FolderNext is connecting to a database in a path specified as a paramater:AuthSesh(Path="pathto/database/folder")This will create a database.db file in the specified path if one is not already there, it will not make the folder if it doesnt exsist though.ServersLastly, connecting to a remote server:AuthSesh(Address="0.0.0.0:5678")This will establish a secure connection to the remote server provided. If you want to host a server look atHosting a Server.Setting ValuesIn order to authenticate a user we need their name and password. You do that with theset_vals()method:auth.set_vals("username","password")You can call this method at anytime to change the user. However iflogin()is not called before attempting to manage data, it will still be connected to the previous user.Signing UpOnce a username and password are set, you use thesignup()method to sign up:auth.signup()If the signup is successful, you then have to login to actually manage user data.Logging InOnce you're ready to login, you can use thelogin()method to log in to the server:auth.login()If the login is successful, you can start managing the database.Saving DataAfter you've seccessfully logged in, you use thesave()mathod to save data into the database:auth.save("user_data/profile", {"name":"John Doe","email":"johndoe@example.com"})Data in the database is stored in a dictonary and parsed based on the the path provided.Loading DataYou access data in the database with theload()method:data = auth.load("user_data/profile")This will will return the data in the specified location, if no location is provided, it will return the whole dictionary.Deleting DataTo delete data in the database, you use thedelete()method:auth.delete("user_data/profile")Removing UserFinally, if you'd like to delete the user from the database, you use theremove()method:auth.remove()ExceptionsTheAuthSeshclass raises the following exceptions:AuthenticationError: Raised if there is an error authenticating the user.DataError: Raised if there is an error accessing or modifying the data on the server.LocationError: Raised if the specified location does not exist on the server.PasswordError: Raised if the password is incorrect or invalid.UsernameError: Raised if the username is invalid or already in use.sixauth.mainThesixauth.mainmodule provides all of the functionallity of thesixauthmodule, and then some. TheAuthSeshclass is basically just a wrapper for all the functions in this module. If you wish to use any of the raw functions in this module, it is recomended that you already have a very strong understanding of authentication, databases, and all the jazz. I tried my best to explain what happens in the comments of each of the functions, you can read themhere.Hosting a ServerThis module provides a very basic python server forAuthSeshinstances to connect to. You can start it with theserver()function:fromsixauth.mainimportserver
server("0.0.0.0", 5678)This will start a server in the console on port5678and will look for all incoming ip addresses. There are also a few keyword debug booleans,debugandlog_senseitive_info. The keyword option,cache_threshold, sets how long, in seconds, a user has to be inactive on the server before their cache position is deleted.License and DisclaimerThesixauthlibrary is licensed under the MIT License, which means it is free to use and distribute for both personal and commercial purposes. The documentation for the library has been generated by an AI trained by OpenAI, and may not be entirely accurate or up-to-date. It is recommended to consult the source code of the library for the most accurate information.Authors@maxwellewxam@3008362