anuastra
v1.1.2
Published
Official Node.js SDK for the Aṇu Astra Virtual Quantum Processor and Post-Quantum Cryptography API
Maintainers
Readme
Aṇu Astra Node.js SDK (v1.1.0)
The official Node.js SDK for the Aṇu Astra Virtual Quantum Processor and Post-Quantum Cryptography (PQC) API.
Build and evaluate path-integral quantum circuits locally, run native OpenQASM 2.0 payloads, and secure your applications against "Store Now, Decrypt Later" threats using NIST-standardized Kyber and Dilithium algorithms.
Installation
Install the package via npm:
npm install anuastraQuick Start: Quantum Execution (Qiskit-Style)
The QuantumCircuit builder provides a declarative, strictly-typed interface mirroring industry standards like IBM Qiskit.
import { AṇuAstra, QuantumCircuit } from 'anuastra';
// As of v1.1.0, the baseUrl automatically points to astra.cryptopix.in
const astra = new AṇuAstra({ apiKey: 'YOUR_API_KEY_HERE' });
async function runQuantum() {
// Scaffold a 2-qubit circuit
const circuit = new QuantumCircuit(2);
// Create a Bell State (Superposition + Entanglement)
circuit.h(0);
circuit.cx(0, 1);
// Execute the circuit using the Aṇu Astra path-integral engine
const result = await astra.executeQuantum(circuit, 1);
// Extracted telemetry and engine data
console.log(`Executed on: ${result.engine}`);
console.log(`Feynman Paths Explored: ${result.telemetry.feynman_paths_explored}`);
// The quantum state collapse result (e.g. "00" or "11")
console.log(`Measurement Result (Binary): ${result.results.state_binary}`);
}
runQuantum();Supported Quantum Gates
Aṇu Astra natively supports a sprawling library of quantum operators. You can chain these directly onto your QuantumCircuit object in JavaScript or TypeScript.
| Category | Supported Gates & Method Shortcuts |
| :--- | :--- |
| Pauli & Basic | h(q), x(q), y(q), z(q), id(q) |
| Phase & S/T | s(q), sdg(q), t(q), tdg(q), p(q, lambda) |
| Rotations | rx(q, theta), ry(q, theta), rz(q, theta) |
| Square Root | sx(q), sxdg(q) |
| General Unitary | u1(q, l), u2(q, p, l), u3(q, t, p, l) / u(...) |
| 2-Qubit (Controlled) | cnot(c, t) / cx(...), cz(c, t), cy(c, t), ch(c, t) |
| 2-Qubit (Advanced) | swap(q1, q2), iswap(q1, q2), ecr(q1, q2), dcx(q1, q2) |
| 2-Qubit (Rotations)| crx(c, t, theta), cry(...), crz(...), cp(...), cu(...) |
| 2-Qubit (Ising/XX) | rxx(q1, q2, theta), ryy(...), rzz(...), rzx(...) |
| 3+ Qubit (Multi) | ccx(q1, q2, q3) / toffoli(...), ccz(...), cswap(...) / fredkin(...), c3x(...), c4x(...) / quadx(...) |
Quick Start: OpenQASM 2.0 Ingestion
For research teams migrating from legacy hardware (like IBM Quantum), Aṇu Astra natively ingests raw .qasm strings and executes them instantly.
import { AṇuAstra } from 'anuastra';
const astra = new AṇuAstra({ apiKey: 'YOUR_API_KEY' });
const qasmPayload = `OPENQASM 2.0;
include "qelib1.inc";
qreg q[2];
creg c[2];
h q[0];
cx q[0],q[1];
measure q[0] -> c[0];
measure q[1] -> c[1];
`;
async function runQasm() {
// Execute the raw OpenQASM string natively
const response = await astra.executeQasm(qasmPayload);
// Log the JSON parsed results
console.log(JSON.stringify(response.results, null, 2));
}
runQasm();Post-Quantum Cryptography (PQC)
The Aṇu Astra SDK exposes NIST FIPS-203 and FIPS-204 standardized algorithms.
1. Key Encapsulation (ML-KEM / Kyber)
Used for establishing symmetric quantum-resistant tunnels over public networks (TLS/TCP).
[!IMPORTANT] Zero-Trust Architecture (v1.0.2+):
keygenanddecapsulateare now executed entirely locally on your device using WebAssembly/JS runtimes. Aṇu Astra never transmits or stores your private parameters.
// 1. Generate keys LOCALLY (Server A)
// No private keys leave your device
const { public_key, private_key } = await astra.kyber.keygen(768);
// 2. Encapsulate via VQP (Server B)
// Server B uses Public Key to create a Shared Secret + Ciphertext via Aṇu Astra
const capsule = await astra.kyber.encapsulate(public_key);
// 3. Decapsulate LOCALLY (Server A)
// Server A uses Private Key + Ciphertext to derive the exact same Shared Secret
const resolved = await astra.kyber.decapsulate(capsule.ciphertext, private_key);
console.log(`Shared Secret Established: ${resolved.shared_secret === capsule.shared_secret}`);2. Digital Signatures (ML-DSA / Dilithium)
Used for unbreakable document signing, firmware validation, and transaction authentication.
const { public_key, private_key } = await astra.dilithium.keygen(3);
const message = "Quantum Safe transaction payload";
const { signature } = await astra.dilithium.sign(message, private_key);
const validation = await astra.dilithium.verify(signature, message, public_key);
console.log(validation.is_valid);TypeScript Support
This SDK is written entirely in TypeScript. Type definitions are automatically bundled, providing comprehensive intellisense and compile-time validation.
License
MIT
