WARNING: DO NOT USE BEACON GENERATED VALUES AS SECRET CRYPTOGRAPHIC KEYS.
A required library pycryptodome
is used with nistbeacon
.
Ubuntu, and other Linux-based users should have python3-dev
installed.
apt-get install python3-dev
To install the beacon library, simply use pip
:
pip install nistbeacon
It is easy to use the beacon. Most queries are performed through
NistBeacon
which produces NistBeaconValue
objects.
from nistbeacon import NistBeacon
# In the examples below I will be using 1447873020
# as my <timestamp> when required
# Current Record (or next closest)
# https://beacon.nist.gov/rest/record/<timestamp>
record = NistBeacon.get_record(1447873020)
# Previous Record
# https://beacon.nist.gov/rest/record/previous/<timestamp>
prev_record = NistBeacon.get_previous(1447873020)
# Next Record
# https://beacon.nist.gov/rest/record/next/<timestamp>
next_record = NistBeacon.get_next(1447873020)
# First Record
# https://beacon.nist.gov/rest/record/1378395540
first_record = NistBeacon.get_first_record(download=True)
# Last Record
# https://beacon.nist.gov/rest/record/last
last_record = NistBeacon.get_last_record()
# Verify the record and the record chain
record_chain_result = NistBeacon.chain_check(1447873020)
Please refer to the
official documentation
to dive deeper into NistBeacon
and NistBeaconValue
objects.
Please refer to the CONTRIBUTING document on GitHub
Branch | Linting Checks | Testing Status | Code Coverage Status |
---|---|---|---|
Master |