Docproof
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
Currently the only supported Bitcoin Payment Gateway is Coinbase, so if you want to use the Docproof::Document#notarize!
you'll need to set the following environment variables:
COINBASE_API_KEY=YOUR-COINBASE-API-KEY
COINBASE_API_SECRET=YOUR-COINBASE-API-SECRET
and requires coinbase/wallet
require 'coinbase/wallet`
docproof_document = Docproof::Document.new('y0urd0cum3nt5ha256h45h')
docproof_document.register! && docproof_document.notarize!
You can also configure the Coinbase API Key and Secret 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'
end
docproof_document = Docproof::Document.new('y0urd0cum3nt5ha256h45h')
docproof_document.register! && docproof_document.notarize!
Usage
To register a new document's SHA256 digest:
doc.register!
To post the document's SHA256 digest to the blockchain (making payment to indicated bitcoind address):
doc.notarize!
To lookup the status of the document's SHA256 digest:
doc.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
.