@epochcore/qaas-sdk 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -78,6 +78,26 @@ interface HealthResponse {
78
78
  frameworks: string[];
79
79
  timestamp: string;
80
80
  }
81
+ interface QRNGResponse {
82
+ bits: number;
83
+ value: string | number[] | string;
84
+ format: 'hex' | 'integer' | 'bytes';
85
+ entropy_source: string;
86
+ frequency?: number;
87
+ timestamp: string;
88
+ }
89
+ interface QRNGKeyResponse {
90
+ key: string;
91
+ bits: number;
92
+ algorithm: string;
93
+ timestamp: string;
94
+ }
95
+ interface QRNGUuidResponse {
96
+ uuid: string;
97
+ version: number;
98
+ algorithm: string;
99
+ timestamp: string;
100
+ }
81
101
  type AlgorithmCategory = 'amplitude_estimation' | 'grover_search' | 'qaoa_optimization' | 'qubo' | 'bernstein_vazirani' | 'deutsch_jozsa' | 'simon' | 'phase_estimation' | 'variational' | 'qml_classification' | 'qml_regression' | 'qml_clustering' | 'qml_anomaly';
82
102
  /**
83
103
  * EpochCore QaaS Client — Quantum-Hardened
@@ -165,6 +185,34 @@ declare class QaaSClient {
165
185
  state?: string;
166
186
  strategy?: string;
167
187
  }): Promise<Record<string, unknown>>;
188
+ /**
189
+ * Generate quantum random bits.
190
+ *
191
+ * @param params.bits - Number of random bits (1–4096, default 256)
192
+ * @param params.format - Output format: 'hex' | 'int' | 'bytes' (default 'hex')
193
+ */
194
+ generateQRNG(params?: {
195
+ bits?: number;
196
+ format?: 'hex' | 'int' | 'bytes';
197
+ }): Promise<QRNGResponse>;
198
+ /**
199
+ * Generate a quantum random number in the range [0, 1).
200
+ * Convenience wrapper over generateQRNG for normalized floats.
201
+ *
202
+ * @param count - How many floats to generate (1–1024, default 1)
203
+ * @returns Array of floats in [0, 1), each derived from 32 quantum bits
204
+ */
205
+ generateQuantumFloats(count?: number): Promise<number[]>;
206
+ /**
207
+ * Generate a quantum-random cryptographic key.
208
+ *
209
+ * @param length - Key length in bytes (1–64, default 32)
210
+ */
211
+ generateQuantumKey(length?: number): Promise<QRNGKeyResponse>;
212
+ /**
213
+ * Generate a quantum-random UUID v4.
214
+ */
215
+ generateQuantumUUID(): Promise<QRNGUuidResponse>;
168
216
  }
169
217
  declare class QaaSError extends Error {
170
218
  readonly statusCode: number;
@@ -207,4 +255,4 @@ declare const ALGORITHMS: {
207
255
  };
208
256
  };
209
257
 
210
- export { ALGORITHMS, type Algorithm, type AlgorithmCategory, type AlgorithmsResponse, type HealthResponse, type PricingResponse, type PricingTier, QaaSClient, type QaaSConfig, QaaSError, QaaSRateLimitError, QaaSValidationError, type RunRequest, type RunResponse, SIGNATURE_MAX_AGE_MS, type UsageResponse };
258
+ export { ALGORITHMS, type Algorithm, type AlgorithmCategory, type AlgorithmsResponse, type HealthResponse, type PricingResponse, type PricingTier, type QRNGKeyResponse, type QRNGResponse, type QRNGUuidResponse, QaaSClient, type QaaSConfig, QaaSError, QaaSRateLimitError, QaaSValidationError, type RunRequest, type RunResponse, SIGNATURE_MAX_AGE_MS, type UsageResponse };
package/dist/index.d.ts CHANGED
@@ -78,6 +78,26 @@ interface HealthResponse {
78
78
  frameworks: string[];
79
79
  timestamp: string;
80
80
  }
81
+ interface QRNGResponse {
82
+ bits: number;
83
+ value: string | number[] | string;
84
+ format: 'hex' | 'integer' | 'bytes';
85
+ entropy_source: string;
86
+ frequency?: number;
87
+ timestamp: string;
88
+ }
89
+ interface QRNGKeyResponse {
90
+ key: string;
91
+ bits: number;
92
+ algorithm: string;
93
+ timestamp: string;
94
+ }
95
+ interface QRNGUuidResponse {
96
+ uuid: string;
97
+ version: number;
98
+ algorithm: string;
99
+ timestamp: string;
100
+ }
81
101
  type AlgorithmCategory = 'amplitude_estimation' | 'grover_search' | 'qaoa_optimization' | 'qubo' | 'bernstein_vazirani' | 'deutsch_jozsa' | 'simon' | 'phase_estimation' | 'variational' | 'qml_classification' | 'qml_regression' | 'qml_clustering' | 'qml_anomaly';
82
102
  /**
83
103
  * EpochCore QaaS Client — Quantum-Hardened
@@ -165,6 +185,34 @@ declare class QaaSClient {
165
185
  state?: string;
166
186
  strategy?: string;
167
187
  }): Promise<Record<string, unknown>>;
188
+ /**
189
+ * Generate quantum random bits.
190
+ *
191
+ * @param params.bits - Number of random bits (1–4096, default 256)
192
+ * @param params.format - Output format: 'hex' | 'int' | 'bytes' (default 'hex')
193
+ */
194
+ generateQRNG(params?: {
195
+ bits?: number;
196
+ format?: 'hex' | 'int' | 'bytes';
197
+ }): Promise<QRNGResponse>;
198
+ /**
199
+ * Generate a quantum random number in the range [0, 1).
200
+ * Convenience wrapper over generateQRNG for normalized floats.
201
+ *
202
+ * @param count - How many floats to generate (1–1024, default 1)
203
+ * @returns Array of floats in [0, 1), each derived from 32 quantum bits
204
+ */
205
+ generateQuantumFloats(count?: number): Promise<number[]>;
206
+ /**
207
+ * Generate a quantum-random cryptographic key.
208
+ *
209
+ * @param length - Key length in bytes (1–64, default 32)
210
+ */
211
+ generateQuantumKey(length?: number): Promise<QRNGKeyResponse>;
212
+ /**
213
+ * Generate a quantum-random UUID v4.
214
+ */
215
+ generateQuantumUUID(): Promise<QRNGUuidResponse>;
168
216
  }
169
217
  declare class QaaSError extends Error {
170
218
  readonly statusCode: number;
@@ -207,4 +255,4 @@ declare const ALGORITHMS: {
207
255
  };
208
256
  };
209
257
 
210
- export { ALGORITHMS, type Algorithm, type AlgorithmCategory, type AlgorithmsResponse, type HealthResponse, type PricingResponse, type PricingTier, QaaSClient, type QaaSConfig, QaaSError, QaaSRateLimitError, QaaSValidationError, type RunRequest, type RunResponse, SIGNATURE_MAX_AGE_MS, type UsageResponse };
258
+ export { ALGORITHMS, type Algorithm, type AlgorithmCategory, type AlgorithmsResponse, type HealthResponse, type PricingResponse, type PricingTier, type QRNGKeyResponse, type QRNGResponse, type QRNGUuidResponse, QaaSClient, type QaaSConfig, QaaSError, QaaSRateLimitError, QaaSValidationError, type RunRequest, type RunResponse, SIGNATURE_MAX_AGE_MS, type UsageResponse };
package/dist/index.js CHANGED
@@ -28,7 +28,7 @@ __export(index_exports, {
28
28
  SIGNATURE_MAX_AGE_MS: () => SIGNATURE_MAX_AGE_MS
29
29
  });
30
30
  module.exports = __toCommonJS(index_exports);
31
- var SDK_VERSION = "1.1.0";
31
+ var SDK_VERSION = "1.2.0";
32
32
  var SDK_USER_AGENT = `EpochCore-QaaS-SDK/${SDK_VERSION}`;
33
33
  var _crypto = typeof globalThis.crypto !== "undefined" ? globalThis.crypto : require("crypto").webcrypto;
34
34
  var MIN_TIMEOUT_MS = 5e3;
@@ -358,6 +358,81 @@ var QaaSClient = class {
358
358
  })
359
359
  );
360
360
  }
361
+ // ═══════════════════════════════════════════════════════════════════
362
+ // Quantum Random Number Generation (QRNG)
363
+ // ═══════════════════════════════════════════════════════════════════
364
+ /**
365
+ * Generate quantum random bits.
366
+ *
367
+ * @param params.bits - Number of random bits (1–4096, default 256)
368
+ * @param params.format - Output format: 'hex' | 'int' | 'bytes' (default 'hex')
369
+ */
370
+ async generateQRNG(params = {}) {
371
+ const bits = params.bits ?? 256;
372
+ if (typeof bits !== "number" || !Number.isInteger(bits)) {
373
+ throw new QaaSValidationError("bits must be an integer");
374
+ }
375
+ if (bits < 1 || bits > 4096) {
376
+ throw new QaaSValidationError("bits must be between 1 and 4096");
377
+ }
378
+ const format = params.format ?? "hex";
379
+ if (!["hex", "int", "bytes"].includes(format)) {
380
+ throw new QaaSValidationError("format must be hex, int, or bytes");
381
+ }
382
+ return this.request(
383
+ "POST",
384
+ "/v1/random/generate",
385
+ JSON.stringify({ bits, format })
386
+ );
387
+ }
388
+ /**
389
+ * Generate a quantum random number in the range [0, 1).
390
+ * Convenience wrapper over generateQRNG for normalized floats.
391
+ *
392
+ * @param count - How many floats to generate (1–1024, default 1)
393
+ * @returns Array of floats in [0, 1), each derived from 32 quantum bits
394
+ */
395
+ async generateQuantumFloats(count = 1) {
396
+ if (typeof count !== "number" || !Number.isInteger(count)) {
397
+ throw new QaaSValidationError("count must be an integer");
398
+ }
399
+ if (count < 1 || count > 1024) {
400
+ throw new QaaSValidationError("count must be between 1 and 1024");
401
+ }
402
+ const totalBits = count * 32;
403
+ const response = await this.generateQRNG({ bits: Math.min(totalBits, 4096), format: "bytes" });
404
+ const bytes = response.value;
405
+ const floats = [];
406
+ for (let i = 0; i < count && i * 4 + 3 < bytes.length; i++) {
407
+ const u32 = (bytes[i * 4] << 24 | bytes[i * 4 + 1] << 16 | bytes[i * 4 + 2] << 8 | bytes[i * 4 + 3]) >>> 0;
408
+ floats.push(u32 / 4294967295);
409
+ }
410
+ return floats;
411
+ }
412
+ /**
413
+ * Generate a quantum-random cryptographic key.
414
+ *
415
+ * @param length - Key length in bytes (1–64, default 32)
416
+ */
417
+ async generateQuantumKey(length = 32) {
418
+ if (typeof length !== "number" || !Number.isInteger(length)) {
419
+ throw new QaaSValidationError("length must be an integer");
420
+ }
421
+ if (length < 1 || length > 64) {
422
+ throw new QaaSValidationError("length must be between 1 and 64");
423
+ }
424
+ return this.request(
425
+ "POST",
426
+ "/v1/random/key",
427
+ JSON.stringify({ length })
428
+ );
429
+ }
430
+ /**
431
+ * Generate a quantum-random UUID v4.
432
+ */
433
+ async generateQuantumUUID() {
434
+ return this.request("POST", "/v1/random/uuid", "{}");
435
+ }
361
436
  };
362
437
  var QaaSError = class extends Error {
363
438
  constructor(message, statusCode) {
package/dist/index.mjs CHANGED
@@ -6,7 +6,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
6
6
  });
7
7
 
8
8
  // src/index.ts
9
- var SDK_VERSION = "1.1.0";
9
+ var SDK_VERSION = "1.2.0";
10
10
  var SDK_USER_AGENT = `EpochCore-QaaS-SDK/${SDK_VERSION}`;
11
11
  var _crypto = typeof globalThis.crypto !== "undefined" ? globalThis.crypto : __require("crypto").webcrypto;
12
12
  var MIN_TIMEOUT_MS = 5e3;
@@ -336,6 +336,81 @@ var QaaSClient = class {
336
336
  })
337
337
  );
338
338
  }
339
+ // ═══════════════════════════════════════════════════════════════════
340
+ // Quantum Random Number Generation (QRNG)
341
+ // ═══════════════════════════════════════════════════════════════════
342
+ /**
343
+ * Generate quantum random bits.
344
+ *
345
+ * @param params.bits - Number of random bits (1–4096, default 256)
346
+ * @param params.format - Output format: 'hex' | 'int' | 'bytes' (default 'hex')
347
+ */
348
+ async generateQRNG(params = {}) {
349
+ const bits = params.bits ?? 256;
350
+ if (typeof bits !== "number" || !Number.isInteger(bits)) {
351
+ throw new QaaSValidationError("bits must be an integer");
352
+ }
353
+ if (bits < 1 || bits > 4096) {
354
+ throw new QaaSValidationError("bits must be between 1 and 4096");
355
+ }
356
+ const format = params.format ?? "hex";
357
+ if (!["hex", "int", "bytes"].includes(format)) {
358
+ throw new QaaSValidationError("format must be hex, int, or bytes");
359
+ }
360
+ return this.request(
361
+ "POST",
362
+ "/v1/random/generate",
363
+ JSON.stringify({ bits, format })
364
+ );
365
+ }
366
+ /**
367
+ * Generate a quantum random number in the range [0, 1).
368
+ * Convenience wrapper over generateQRNG for normalized floats.
369
+ *
370
+ * @param count - How many floats to generate (1–1024, default 1)
371
+ * @returns Array of floats in [0, 1), each derived from 32 quantum bits
372
+ */
373
+ async generateQuantumFloats(count = 1) {
374
+ if (typeof count !== "number" || !Number.isInteger(count)) {
375
+ throw new QaaSValidationError("count must be an integer");
376
+ }
377
+ if (count < 1 || count > 1024) {
378
+ throw new QaaSValidationError("count must be between 1 and 1024");
379
+ }
380
+ const totalBits = count * 32;
381
+ const response = await this.generateQRNG({ bits: Math.min(totalBits, 4096), format: "bytes" });
382
+ const bytes = response.value;
383
+ const floats = [];
384
+ for (let i = 0; i < count && i * 4 + 3 < bytes.length; i++) {
385
+ const u32 = (bytes[i * 4] << 24 | bytes[i * 4 + 1] << 16 | bytes[i * 4 + 2] << 8 | bytes[i * 4 + 3]) >>> 0;
386
+ floats.push(u32 / 4294967295);
387
+ }
388
+ return floats;
389
+ }
390
+ /**
391
+ * Generate a quantum-random cryptographic key.
392
+ *
393
+ * @param length - Key length in bytes (1–64, default 32)
394
+ */
395
+ async generateQuantumKey(length = 32) {
396
+ if (typeof length !== "number" || !Number.isInteger(length)) {
397
+ throw new QaaSValidationError("length must be an integer");
398
+ }
399
+ if (length < 1 || length > 64) {
400
+ throw new QaaSValidationError("length must be between 1 and 64");
401
+ }
402
+ return this.request(
403
+ "POST",
404
+ "/v1/random/key",
405
+ JSON.stringify({ length })
406
+ );
407
+ }
408
+ /**
409
+ * Generate a quantum-random UUID v4.
410
+ */
411
+ async generateQuantumUUID() {
412
+ return this.request("POST", "/v1/random/uuid", "{}");
413
+ }
339
414
  };
340
415
  var QaaSError = class extends Error {
341
416
  constructor(message, statusCode) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epochcore/qaas-sdk",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Official SDK for EpochCore Quantum as a Service (QaaS) API - Access 100 quantum computing algorithms",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",