get_proof: Get the Proof (Merkle Tree) for the hash calculated from an R...

View source: R/get_proof.R

get_proofR Documentation

Get the Proof (Merkle Tree) for the hash calculated from an R object or file.

Description

Wrapper around https://api.originstamp.com/swagger/swagger-ui.html#/proof/getProof. The function downloads the merkle tree as proof.

Usage

get_proof(
  x,
  file,
  proof_type = "pdf",
  error_on_fail = TRUE,
  url = api_url(),
  key = api_key()
)

Arguments

x

an R object (character vector containing file names of existing files or strings) of which a hash will be calculated using the function hash(x). The resulting hash will be submitted to OriginStamp.

file

if provided, file name to store the proof in. Otherwise, the from OriginStamp is used proof.CURRENCY.HASH.xml for proof_type == "xml" or certificate.CURRENCY.HASH.pdf for proof_type == "pdf".

proof_type

The type of the proof format. Either "pdf" or "xml" are supported at the moment by OriginStamp.

error_on_fail

if TRUE, raise error when api call fails, otherwise return the failed response.

url

the url of the api. The default is to use the url as returned by the function api_url()

key

the api key. The default is to use the key as returned by the function api_key()

Value

object of class OriginStampResponse, with an additional element, file, which contains the name of the saved certificate or proof.

Examples


## Not run: 
# Retrieve complete merkle tree proof
x <- "2c5d36be542f8f0e7345d77753a5d7ea61a443ba6a9a86bb060332ad56dba38e"
class(x) <- "hash"
get_proof(
  x = x
)

## End(Not run)

rkrug/ROriginStamp documentation built on Aug. 16, 2022, 5:45 p.m.