Project

docproof

0.0
No commit activity in last 3 years
No release in over 3 years
Client library for Proof of Existence API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.14
~> 5.0
~> 10.0
~> 0.13.0
~> 1.4.8
~> 2.3.2
 Project Readme

Docproof GitHub license Gem Code Climate Test Coverage Issue Count Build Status

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.