@keeex/afterbc
Library that provide strings that could not have existed before the time of the
call.
The first version is based on the Bitcoin blockchain and BlockCypher.
It returns the last block hash value, providing a string that effectively could
not be guessed beforehand.
This value, combined with proper timestamping that provide a "not after" date
can provide a limited timeframe for the creation of any associated data.
Usage
The library exposes two functions as the default export.
A quick example follows:
import {getAfterString, parseAfterString} from "@keeex/afterbc";
const main = async() => {
const str = await getAfterString();
const ouptut = await parseAfterString(str);
console.log("Returned string date: ", output.date);
console.log("Check URL: ", output.checkUrl);
}
Restrictions
The output is limited to the resolution of the source.
In this case, bitcoin blocks are only created once in a while.
The library manages a cache that should be acceptable for any given source.
Multiple calls that uses the same source will use that cache and avoid hitting
the underlying service.
In the future, this library might support multiple data providers; the output
string is made in a way that allow transparent handling of these future sources.
Any string produced in the past should be handled appropriately to some extent.
We currently depend on BlockCypher's API to provide this service.