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 is a next-gen 2FA solution. We've open-sourced the code powering Client-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.
Install raindrop on pypi. Supports Python >=3.6.
pip install raindrop
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('Sandbox', 'your_id', 'your_secret', 'your_application_id')
environment
(required):Sandbox
|Production
to set your environmentclient_id
(required): Your OAuth id for the Hydro APIclient_secret
(required): Your OAuth secret for the Hydro APIapplication_id
(required): Your application id for the Hydro API
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)
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 signedmessage
message
: a message generated fromgenerate_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.
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)
Generates a random 6-digit integers for users to sign. Uses system-level CSPRNG.
ServerRaindropPartner('Sandbox', 'your_id', 'your_secret')
environment
(required):Sandbox
|Production
to set your environmentclient_id
(required): Your OAuth id for the Hydro APIclient_secret
(required): Your OAuth secret for the Hydro API
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
Initiate an authentication attempt on behalf of the user associated with hydro_address_id
.
hydro_address_id
: thehydro_address_id
of the authenticating user
Checks whether the user correctly performed the raindrop.
hydro_address_id
: thehydro_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.
Manually refreshes OAuth token.
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
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 2018 The Hydrogen Technology Corporation under the GNU General Public License v3.0.