2.1.0 • Published 12 months ago

qranode v2.1.0

Weekly downloads
2
License
GPL-3.0-or-later
Repository
github
Last release
12 months ago

QRANode

A wrapper for ANUs Quantum RNG API.

See here for more info: https://anuquantumoptics.org/research-topics/qrng

NPM Link

Installation

npm i qranode

Usage:

const qranode = require('qranode')

// .then.catch
qranode({apiKey: "THIS_IS_A_KEY", dataType: 'uint8', amount: 5}) // get 5 numbers from 0 to 255
.then(console.log) // log the output
.catch(console.error) // or the errors, if any

// async/await
let numbers = await qranode({apiKey: "THIS_IS_A_KEY", dataType: 'uint8', amount: 5}) // get 5 numbers from 0 to 65535

// you can even get hex!

qranode({apiKey: "THIS_IS_A_KEY", dataType: 'hex16', amount: 5, blockSize: 2}) // get 5 hex strings, each string consisting of 2 hex blocks between 0000 and ffff

The API returns a JSON object with the success status, the type requested, the length of the array, and the array of numbers. The example below is the result of a request for two hex16 numbers with a block size of 4.

{
  success: true,
  type: 'hex16',
  length: '2',
  data: [ '2f2497d207a39d67', 'dd537fa2b1c4c6b2' ]
}
2.1.0

12 months ago

2.0.0

2 years ago

1.5.1

3 years ago

1.5.0

3 years ago

1.0.0

4 years ago