Welcome to Co Sign 👋

Version

A service that provide collaborative and secure custody of bitcoin. A M of N multi-sig wallet where the user holds Mof the keys and the service holds one, that way the service is unable to sign transactions since they only have one key. Users can make use of their M keys or allow service to provide the other key necessary for transaction (User has to give service permission to sign with their key)

Backend

Requirements

python
pip
virtualenv
postgres

Running The Backend

  1. clone the repository git clone https://github.com/toshmanuel/co-sign.git
  2. cd Backend
  3. virtualenv venv
  4. for MACOS/LINUX source venv/bin/activate
  5. for WINDOWS venv\Scripts\activate
  6. pip install -r requirements.txt
  7. create a .env file in the Backend directory
  8. check the .env.sample file and copy to variable to the .env file
  9. replace the ‘somevalues’ with the neccesary value
  10. python manage.py runserver

API Examples

  1. POST /api/v1/register

Request Body

{
 "email": "[email protected]",
 "password": "somepassword",
 "password2": "somepassword"
}

On a successful request, this endpoint would return a 201 status code and

Response Body

{
   "email": "[email protected]"
}

On a failed request e.g, email is not provided or the password does not match, or the password is too common, or the user already exists. this endpoint would return a 400 bad request status code

Possible Error Response, may return one or more of the following error

{
   "email": [
      "This field must be unique.", 
      "Enter a valid email address."
   ],
   "password": [
       "This password is too common.",
       "Password fields didn't match.",
   ]
}
  1. POST /api/v1/login

Request Body

{
 "username": "[email protected]",
 "password": "somepassword",
}

On a successful request, this endpoint would return a 200 status code and

Response Body

{
   "expiry": "2022-05-10T06:01:06.930521+01:00",
   "token": "3ee47e529230b68e12685924f1da2aa0cf67e228ea486626b6e2bbbeda117936"
}

On a failed request e.g, username is not provided, or the username is wrong or does not exist, or the password is incorrect, this endpoint would return a 400 bad request status code

Possible Error Response, may return one or more of the following error

{
   "non_field_errors": [
       "Unable to log in with provided credentials."
   ],
   "username": [
       "This field may not be blank."
   ],
   "password": [
       "This field may not be blank."
   ]
}
  1. POST /api/v1/logout/

Request Header should contain Authorzation: Token token_generated_from_login

On a successful request, this endpoint would return a 204 status code

On a failed request e.g, if the key “Authorization” is not provided in the header, this endpoint would return a 400 bad request status code

Possible Error Response, may return one or more of the following error

{
   "detail": "Invalid token."
}

{
   "detail": "Authentication credentials were not provided."
}

Authors

👤 toshmanuel 👤 Muneerah1612 👤 j-kon

Show your support

Give a ⭐️ if this project helped you!

GitHub

View Github