Ident
=====

``pip install ident``

Simple syntax sugar for logging on users to your website without using
password, just with their ``~/.ssh`` keypair, that they use to sign-in
to servers.

.. image:: https://wiki.mindey.com/shared/shots/4ea36c57ab5361af7e0576ab5.png
   :target: https://wiki.mindey.com/shared/shots/d3639065aab62d04931c78ddc-python-ident.mp4

Signing
-------

Sign a message with your own ``~/.ssh/id_rsa`` key, and providing your
public key ``~/.ssh/id_rsa.pub`` after ``:`` symbol

.. code:: python

   from ident import sign

   result = sign('MyChallengeMessage')

**Note.** There is a colon (``:``) in the string produced, which separates
the base64-encoded signature (left) from the public key (right).

Verifying
---------

Verify the signed message, with public key included after the ``:``
sign:

.. code:: python

   from ident import verify

   verify(' : ')

Usage
=====

Flow
-----

1. Server generates ``MyRandomChallengeMessage``, and displays it in a
   box, asking user to copy it, and provide digest of the ``$ solve``
   command, which they can install by adding the below function to
   ``~/.bashrc`` or ``~/.zshrc``:

.. code:: bash

   solve(){
       if [ -z "$1" ]
         then
           echo "No arguments supplied"
       fi
       echo "$1" | openssl rsautl -sign -inkey ~/.ssh/id_rsa | base64 -w 0 && echo -n ":" && cat ~/.ssh/id_rsa.pub | base64 -w 0
   }

2. User runs locally, and produces signed message with their public key
   included after ``:``, and pastes to server textarea box:

::

   $ solve MyRandomChallengeMessage

3. Server uses ``ident.verify()`` to recognize that the random message was signed with the public key provided, and save that public key as a user.
