Copyright | (c) Bryan St. Amour, 2015 |
---|---|
License | BSD |
Maintainer | bryan@bryanstamour.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
This module is for interacting with the NIST Randomness Beacon (prototype) web API. The Randomness Beacon is designed to be a public source of random information. It generates and publishes 512-bit blocks of random data collected from a quantum mechanical process every 60 seconds.
For more information about the project, see
- type Timestamp = Int
- data Record
- version :: Record -> String
- frequency :: Record -> Int
- timeStamp :: Record -> Int
- seedValue :: Record -> ByteString
- previousOutputValue :: Record -> ByteString
- signatureValue :: Record -> ByteString
- outputValue :: Record -> ByteString
- statusCode :: Record -> Int
- getLastRecord :: IO (Maybe Record)
- getCurrentRecord :: Timestamp -> IO (Maybe Record)
- getPreviousRecord :: Timestamp -> IO (Maybe Record)
- getNextRecord :: Timestamp -> IO (Maybe Record)
- getStartChainRecord :: Timestamp -> IO (Maybe Record)
Documentation
A single record: the random data plus some additional information.
timeStamp :: Record -> Int Source
The time the seed value was generated as the number of seconds since January 1, 1970.
seedValue :: Record -> ByteString Source
A seed value represented as a 64 byte (512-bit) hex string value.
previousOutputValue :: Record -> ByteString Source
The SHA-512 hash value for the previous record - 64 byte hex string.
signatureValue :: Record -> ByteString Source
A digital signature (RSA) computed over (in order): version, frequency, timeStamp, seedValue, previousHashValue, errorCode.
Note: Except for version, the hash is on the byte representations and not the string representations of the data values.
outputValue :: Record -> ByteString Source
The SHA-512 hash of the signatureValue as a 64 byte hex string.
statusCode :: Record -> Int Source
The status code value: 0 - Chain intact, values all good 1 - Start of a new chain of values, previous hash value will be all zeroes 2 - Time between values is greater than the frequency, but the chain is still intact
getLastRecord :: IO (Maybe Record) Source
Last record published.