Client library for Proof of Existence API.
Installation
Add this line to your application's Gemfile:
gem 'docproof'
And then execute:
$ bundle
Or install it yourself as:
$ gem install docproof
Configuration
If you want to use Docproof::Document#notarize!
you'll need to set the following environment variables (Note that we are currently only support Coinbase):
COINBASE_API_KEY=YOUR-COINBASE-API-KEY
COINBASE_API_SECRET=YOUR-COINBASE-API-SECRET
COINBASE_ACCOUNT_ID=YOUR-COINBASE-ACCOUNT-ID # this is optional, we'll use your primary_account if you don't specify this
and require the coinbase/wallet
, e.g.:
require 'coinbase/wallet`
docproof_document = Docproof::Document.new('y0urd0cum3nt5ha256h45h')
docproof_document.register! && docproof_document.notarize!
You can also configure the Coinbase API Key, Secret and Account ID like so:
require 'coinbase/wallet`
#
# Docproof::PaymentProcessor::Coinbase.configure do |config|
# config.api_key = 'YOUR-COINBASE-API-KEY'
# config.api_secret = 'YOUR-COINBASE-API-SECRET'
# config.api_secret = 'YOUR-COINBASE-ACCOUNT-ID'
# end
#
# or pass a hash as configuration (the hash key must be string)
Docproof::PaymentProcessor::Coinbase.configure(
'api_key' => 'YOUR-COINBASE-API-KEY'
'api_secret' => 'YOUR-COINBASE-API-SECRET'
'api_secret' => 'YOUR-COINBASE-ACCOUNT-ID'
)
docproof_document = Docproof::Document.new('y0urd0cum3nt5ha256h45h')
docproof_document.register! && docproof_document.notarize!
Usage
To register a new document's SHA256 digest:
docproof_document.register!
To post the registered document SHA256 digest to the blockchain (make payment to the indicated bitcoin address using the Coinbase you've specify):
docproof_document.notarize!
To lookup the status of the registered document's SHA256 digest:
docproof_document.lookup!
Response
The JSON response is stored in Docproof::Document#response
and keys with the value of empty string are ignored.
Errors
If the request is not successful, the gem will raise an error. All errors are subclasses of Docproof::Error
.