Use v3.1.1

The CLI has a single method of usage, via a command-line interface.

Parameters

Usage

qo_cli [OPTIONS] SUBCOMMAND

Options

  • -h, --help Print a high-level help message and exits.

  • --version Displays program version information and exits.

  • -H, --help-all Displays help for all commands & options.

Subcommands

randomness

Generate randomness using Quantum Origin.

Options:

  • -c, --config TEXT:FILE (mandatory) Path to the configuration file.

  • -o, --outputFile TEXT Path to the output file. If not provided, randomness will be printed to the console (stdout).

  • -s, --size UINT (mandatory) Number of bytes of randomness required.

  • -f, --format TEXT:{binary,base64,hex} [binary] Output randomness format. Default is binary. Specify one of binary, base64 or hex depending on your selected output format.

Representative calling sequence

> qo_cli randomness --config config.conf --size 32 --format hex

dcff8554e3626d176019b8d67fe0f191bfc1976db7894765a048fc92cb9d7064

benchmark

Benchmark the performance of randomness generation.

Options:

  • -c, --config TEXT:FILE (mandatory) Path to the configuration file.

  • -d, --duration UINT [10] Duration to run the benchmark test, in seconds. Default is 10s.

Representative calling sequence

> qo_cli benchmark --config config.conf

Benchmarking randomness generation speed for 10 seconds.

6.15 MiB randomness generated in 10 seconds.
Randomness generation rate is 5.16 Mbit/s.

Example Commands

Examples are provided below on the usage of the Quantum Origin CLI. These examples include randomness output to the command line (screen), output to a file, as well as output as binary, base64, and hex-encoded formats.

Generate Binary Randomness

PS C:\> qo_cli randomness --config C:\config.yml --format binary --size 20
<20 bytes of binary data>

Generate Base64 Randomness

PS C:\> qo_cli randomness --config C:\config.yml --format base64 --size 20
uqOYWTK4fpRtnXc2qJD7ThYtokU=

Generate Hex Randomness

PS C:\> qo_cli randomness --config C:\config.yml --format hex --size 20
b04b30951301ecfb768bfbb85f261165040017d7

Generate Binary Randomness File

PS C:\> qo_cli randomness --config C:\config.yml --format binary --outputFile C:\file_binary.bin --size 20
PS C:\> Get-Content -Path C:\file_binary.bin
<20 bytes of binary data>

Generate Base64 Randomness File

PS C:\> qo_cli randomness --config C:\config.yml --format base64 --outputFile C:\file_base64.txt --size 20
PS C:\> Get-Content -Path C:\file_base64.txt
TVT1Ef08AYIqRvFXYnxgVfnb+nw=

Generate Hex Randomness File

PS C:\> qo_cli randomness --config C:\config.yml --format hex --outputFile C:\file_hex.txt --size 20
PS C:\> Get-Content -Path C:\file_hex.txt
fafe8898536cdc2d0df34e49ca06dcbf966b679c

Logging and error handling

The following section provides an example of the logs that are generated by the Quantum Origin CLI. These logs will not be present on the command line unless the stdout or stderr options are used.

Tip

The CLI outputs randomness to the console (stdout) by default, unless an output file is specified using --outputFile.

It is therefore recommended you avoid logging to stdout as it may be confused for randomness.

If logging to stderr, ensure you have separated the output and error streams prior to interpretation.

The CLI uses standard *nix-based error codes. The CLI will return 0 for a successful execution of the provided commands, or non-0 for non-successful execution.

Tip

In Production use, always confirm the result code is 0 for successful execution.

In this example, the Quantum Origin CLI will write the generated randomness to a file at info level. The randomness will not be present on the command line.

[2024-05-20 17:19:28.417] [quantinuum_qo_onboard_logger] [info] Logging to stdout.
[2024-05-20 17:19:28.422] [quantinuum_qo_onboard_logger] [info] License successfully loaded
[2024-05-20 17:19:28.423] [quantinuum_qo_onboard_logger] [info] License content:
Quantum Origin License Code:
Contract ID: 12345
License ID: 00000000-0000-0000-0000-000000003039
Customer Name: Test-Customer
Created At: 2024-03-02 01:05:38
Created By: origin-support@quantinuum.com
Point Of Contact: Name @ Customer
Restrictions:
    - Adaptors: all
    - Modes: normal
Quantum Seed Hash:
    y20pIWLo0g55xLM64Xe3n5GuiVntY7fDfpquQxoe4VgYvDYqEIRUR/a6XNojc2wt0ykKJVNcL/cXxVEs0vJa2Q==

[2024-05-20 17:19:28.423] [quantinuum_qo_onboard_logger] [info] License successfully validated
[2024-05-20 17:19:28.423] [quantinuum_qo_onboard_logger] [info] Using seed provided by license
[2024-05-20 17:19:28.425] [quantinuum_qo_onboard_logger] [info] Wrote 20 bytes