stampery v0.2.0 Stampery behaviour

Behaviour implementing communication with Stampery API.

Summary

Functions

Sends a callback to the user module that is using the macro

Calculates the SHA-3 (FIPS-202) hash of the input data and returns a hexadecimal digest

Verify a proof and therefore prove its validity and the integrity of the original data

Sends a hexadecimal hash digest to the API backend for stamping

Start connection to API and Rabbit

Macros

This macro provides methods and callbacks for interacting with the Stampery API

Callbacks

Tells your module that something wrong happened

Tells your module that there is a new proof ready

Tells your module that everything is ready to start stamping

Types

error()
error :: {:error, String.t}
proof()
proof :: %Stampery.Proof{anchor: %Stampery.Proof.Anchor{chain: Integer.t, tx_id: String.t}, hash: String.t, root: String.t, siblings: [String.t], version: Integer.t}

Functions

call_back(mod, fun, args)
call_back(Module.t, Atom.t, List.t) :: {:ok, any} | error

Sends a callback to the user module that is using the macro.

hash(data)
hash(String.t) :: String.t

Calculates the SHA-3 (FIPS-202) hash of the input data and returns a hexadecimal digest.

prove(proof)
prove(proof) :: :ok | error

Verify a proof and therefore prove its validity and the integrity of the original data.

stamp(data, mod)
stamp(String.t, Module.t) :: :ok | error

Sends a hexadecimal hash digest to the API backend for stamping.

start(arg, mod)
start({String.t, Atom.t}, Module.t) :: any

Start connection to API and Rabbit.

Macros

__using__(params)

This macro provides methods and callbacks for interacting with the Stampery API.

Callbacks

on_error(error)
on_error(error) :: any

Tells your module that something wrong happened.

on_proof(proof)
on_proof(proof) :: any

Tells your module that there is a new proof ready.

on_ready()
on_ready :: any

Tells your module that everything is ready to start stamping.