{"id":15288071,"url":"https://github.com/antonlydell/streamlit-passwordless","last_synced_at":"2025-04-13T06:32:46.007Z","repository":{"id":215673572,"uuid":"737298788","full_name":"antonlydell/streamlit-passwordless","owner":"antonlydell","description":"A user for Streamlit applications using Bitwarden Passwordless.dev","archived":false,"fork":false,"pushed_at":"2024-05-10T18:42:02.000Z","size":303,"stargazers_count":1,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-05-12T10:54:13.211Z","etag":null,"topics":["passkeys","streamlit","streamlit-component"],"latest_commit_sha":null,"homepage":"https://passwordless.streamlit.app/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/antonlydell.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-30T14:28:03.000Z","updated_at":"2024-05-13T18:56:56.104Z","dependencies_parsed_at":"2024-01-23T22:03:27.273Z","dependency_job_id":"caa71d5a-782b-4e01-aef1-fab8863eadd8","html_url":"https://github.com/antonlydell/streamlit-passwordless","commit_stats":null,"previous_names":["antonlydell/streamlit-passwordless"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonlydell%2Fstreamlit-passwordless","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonlydell%2Fstreamlit-passwordless/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonlydell%2Fstreamlit-passwordless/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonlydell%2Fstreamlit-passwordless/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/antonlydell","download_url":"https://codeload.github.com/antonlydell/streamlit-passwordless/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248674658,"owners_count":21143760,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["passkeys","streamlit","streamlit-component"],"created_at":"2024-09-30T15:44:02.232Z","updated_at":"2025-04-13T06:32:45.979Z","avatar_url":"https://github.com/antonlydell.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"streamlit-passwordless\n======================\n\n|PyPI| |conda-forge| |conda-forge-platform| |Python| |LICENSE|\n\n\nstreamlit-passwordless provides a user model for Streamlit applications based on the Bitwarden\npasswordless.dev technology. It allows users to securely authenticate with a Streamlit application\nusing passkeys. The project is under development and not ready for production yet.\n\nA demo of the project is available at: https://passwordless.streamlit.app\n\n\nInstallation\n------------\n\nstreamlit-passwordless is available on `PyPI`_ and `conda-forge`_ and can be installed with `pip`_\nor `conda`_.\n\n.. _conda: https://docs.conda.io/en/latest/\n.. _conda-forge: https://anaconda.org/conda-forge/streamlit_passwordless\n.. _pip: https://pip.pypa.io/en/stable/getting-started/\n.. _PyPI: https://pypi.org/project/streamlit-passwordless/\n\n\nInstall with pip:\n\n.. code-block:: bash\n\n   $ pip install streamlit-passwordless\n\n\nInstall with conda:\n\n.. code-block:: bash\n\n   $ conda install conda-forge::streamlit_passwordless\n\n\nLicense\n-------\n\nstreamlit-passwordless is distributed under the `MIT-license`_.\n\n.. _MIT-license: https://opensource.org/licenses/mit-license.php\n\n\nExample\n-------\n\nLet's create an example Streamlit app using streamlit-passwordless. First create an account with\n`Bitwarden Passwordless.dev`_ and make your *public* and *private* key accessible to your\napplication. This can be accomplished through environment variables or the `Streamlit secrets`_.\nCreate a new virtual environment and install streamlit-passwordless.\n\n.. _Bitwarden Passwordless.dev: https://admin.passwordless.dev/Account/Login\n.. _python-dotenv: https://pypi.org/project/python-dotenv/\n.. _Streamlit secrets: https://docs.streamlit.io/develop/api-reference/connections/secrets.toml\n\n\n.. code-block:: bash\n\n   ~ $ mkdir stp_demo \u0026\u0026 cd stp_demo\n   ~/stp_demo $ python -m venv .venv\n   ~/stp_demo $ source .venv/bin/activate\n   ~/stp_demo (.venv) $ python -m pip install streamlit-passwordless\n   ~/stp_demo (.venv) $ mkdir .streamlit \u0026\u0026 touch .streamlit/secrets.toml\n\n\nOn Windows you should replace with ``source .venv/bin/activate`` with ``.venv/bin/Activate.ps1``.\nThe contents of the file *~/stp_demo/.streamlit/secrets.toml* is shown below. Replace ``\u003cPUBLIC_KEY\u003e``\nand ``\u003cPRIVATE_KEY\u003e`` with your actual *public* and *private* key from Bitwarden Passwordless.dev. The\n*private key* is called *secret key* in Bitwarden Passwordless.dev. Alternatively you can set the\nenvironment variables `STP_BWP_PUBLIC_KEY` and `STP_BWP_PRIVATE_KEY` to the values of the *public*\nand *private* keys respectively.\n\n\n.. code-block:: toml\n\n   [streamlit-passwordless]\n   STP_BWP_PUBLIC_KEY = '\u003cPUBLIC_KEY\u003e'\n   STP_BWP_PRIVATE_KEY = '\u003cPRIVATE_KEY\u003e'\n\n\nCopy the code of the example app below into a file called *app.py* and place it in your\nworking directory *stp_demo*.\n\n\n.. code-block:: python\n\n   # app.py\n\n\n   import streamlit as st\n   import streamlit_passwordless as stp\n\n\n   def main() -\u003e None:\n      r\"\"\"The main function to run the app.\"\"\"\n\n      page_title = 'Streamlit Passwordless Minimal Example'\n      st.set_page_config(page_title=page_title)\n      st.title(page_title)\n\n      client, session_factory, _ = stp.setup(create_database=True)\n      with session_factory() as session:\n         stp.db.init(_session=session)\n         register_tab, signin_in_tab = st.tabs(['Register', 'Sign in'])\n         with register_tab:\n            stp.bitwarden_register_form(client=client, db_session=session)\n         with signin_in_tab:\n            stp.bitwarden_sign_in_form(client=client, db_session=session)\n\n      stp.sign_out_button(use_container_width=True)\n\n\n   if __name__ == '__main__':\n      main()\n\n\nThe ``stp.setup`` function initializes the session state variables needed by streamlit-passwordless,\nloads and validates the configuration, creates the ``client`` for communicating with Bitwarden\nPasswordless.dev and finally creates the ``session_factory`` for interacting with the user database.\nBy setting ``create_database=True`` the tables of the database are created. By default a SQLite\ndatabase (*streamlit_passwordless.db*) located in the current working directory is used. The database\nto use can be specified through the config key or environment variable ``STP_DB_URL``, which takes a\n`SQLAlchemy database URL`_.\n\nThe function ``stp.db.init`` initializes the database by creating the default user roles. This function\nis cached with st.cache_resource_, which makes it only execute once. The database can also be initialized\nthrough the streamlit-passwordless CLI by running the command ``stp run init``. It launches a Streamlit\napp that initializes the database and lets you create an admin user for the application. Lastly the forms\nto *register* and *sign in* are rendered in separate tabs, and finally the *sign out* button is rendered.\n\n.. _st.cache_resource : https://docs.streamlit.io/develop/api-reference/caching-and-state/st.cache_resource\n.. _SQLAlchemy database URL : https://docs.sqlalchemy.org/en/20/core/engines.html#database-urls\n\n\nRun the example app with the following command:\n\n.. code-block:: bash\n\n   ~/stp_demo (.venv) $ python -m streamlit run app.py\n\n   You can now view your Streamlit app in your browser.\n\n   Local URL: http://localhost:8501\n\n\nOpen the url in your favorite web browser and try it out!\n\n\n.. |conda-forge| image:: https://img.shields.io/conda/vn/conda-forge/streamlit_passwordless?style=plastic\n   :alt: conda-forge - Version\n   :target: https://anaconda.org/conda-forge/streamlit_passwordless\n\n\n.. |conda-forge-platform| image:: https://img.shields.io/conda/pn/conda-forge/streamlit_passwordless?color=yellowgreen\u0026style=plastic\n   :alt: conda-forge - Platform\n   :target: https://anaconda.org/conda-forge/streamlit_passwordless\n\n\n.. |LICENSE| image:: https://img.shields.io/pypi/l/streamlit-passwordless?style=plastic\n   :alt: PyPI - License\n   :target: https://github.com/antonlydell/streamlit-passwordless/blob/main/LICENSE\n\n\n.. |PyPI| image:: https://img.shields.io/pypi/v/streamlit-passwordless?style=plastic\n   :alt: PyPI\n   :target: https://pypi.org/project/streamlit-passwordless/\n\n\n.. |Python| image:: https://img.shields.io/pypi/pyversions/streamlit-passwordless?style=plastic\n   :alt: PyPI - Python Version\n   :target: https://pypi.org/project/streamlit-passwordless/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantonlydell%2Fstreamlit-passwordless","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantonlydell%2Fstreamlit-passwordless","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantonlydell%2Fstreamlit-passwordless/lists"}