Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
dist
raindrop.egg-info
raindrop
LICENSE.txt
README.md
setup.py

README.md

Hydro Raindrop

This package provides a suite of convenience functions intended to simplify the integration of Hydro's Raindrop authentication into your project. An equivalent Javascript SDK is also available. More information, including detailed API documentation, is available in the Raindrop documentation. Raindrop comes in two flavors:

Client-side Raindrop

Client-side Raindrop is a next-gen 2FA solution. We've open-sourced the code powering Client-side Raindrop.

Server-side Raindrop

Server-side Raindrop is an enterprise-level security protocol to secure APIs and other shared resources. We've open-sourced the code powering Server-side Raindrop.

Installation

Recommended

Install raindrop on pypi. Supports Python >=3.6.

pip install raindrop

Getting started

The raindrop package defines two classes that you will interact with: ServerRaindropPartner and ClientRaindropPartner. To start making API calls, you'll need to instantiate each object. The SDK will automatically fetch you an OAuth token, and set your environment.

ClientRaindropPartner Functions

ClientRaindropPartner('Sandbox', 'your_id', 'your_secret', 'your_application_id')
  • environment (required): Sandbox | Production to set your environment
  • client_id (required): Your OAuth id for the Hydro API
  • client_secret (required): Your OAuth secret for the Hydro API
  • application_id (required): Your application id for the Hydro API

register_user(hydro_id)

Should be called when a user elects to use Raindrop Client for the first time with your application.

  • hydro_id: the new user's HydroID (the one they used when signing up for Hydro mobile app)

verify_signature(hydro_id, message)

Should be called each time you need to verify whether a user has signed a message.

  • hydro_id: the HydroID of the user that is meant to have signed message
  • message: a message generated from generate_message() (or any 6-digit numeric code)

Returns a tuple that looks like: (true|false, {...}). The first tuple element will only be true for successful verification attempts.

unregister_user(hydro_id)

Should be called when a user disables Client-side Raindrop with your application.

  • hydro_id: the user's Hydro HydroID (the one they used when signing up for Hydro mobile app)

generate_message()

Generates a random 6-digit integers for users to sign. Uses system-level CSPRNG.

ServerRaindropPartner Functions

ServerRaindropPartner('Sandbox', 'your_id', 'your_secret')
  • environment (required): Sandbox | Production to set your environment
  • client_id (required): Your OAuth id for the Hydro API
  • client_secret (required): Your OAuth secret for the Hydro API

whitelist(address)

A one-time call that whitelists a user to authenticate with your API via Server-side Raindrop.

  • address: The Ethereum address of the user you're whitelisting

request_challenge(hydro_address_id)

Initiate an authentication attempt on behalf of the user associated with hydro_address_id.

  • hydro_address_id: the hydro_address_id of the authenticating user

authenticate(hydro_address_id)

Checks whether the user correctly performed the raindrop.

  • hydro_address_id: the hydro_address_id of the user who claims to be authenticated

Returns a tuple that looks like: (true|false, {...}). The first tuple element will only be true for successful authentication attempts.

Generic Functions

refresh_token()

Manually refreshes OAuth token.

transactionStatus(transaction_hash)

This function returns true when the transaction referenced by transaction_hash has been included in a block on the Ethereum blockchain (Rinkeby if the environment is Sandbox, Mainnet if the environment is Production).

  • transaction_hash (required): Hash of a transaction

Note:

Many of the above functions have optional parameters raise_for_status and return_json. These parameters turn status code error handling and json return values on/off. They are set to sensible defaut parameters.

Copyright & License

Copyright 2018 The Hydrogen Technology Corporation under the GNU General Public License v3.0.

You can’t perform that action at this time.