Skip to content

feat: add JavaScript/TypeScript client SDK #15

Description

@leoneperdigao

Description

Build a JavaScript/TypeScript client SDK for consuming the QRNG API from both browser and Node.js environments. The SDK should provide TypeScript type definitions, handle retries, and integrate with the Web Crypto API for browser-based cryptographic applications.

Tasks

  • Create @taoq-ai/qrng-client npm package with TypeScript source
  • Implement client class with methods:
    • client.randomBytes(count: number): Promise<Uint8Array>
    • client.randomIntegers(min: number, max: number, count: number): Promise<number[]>
    • client.randomUUID(): Promise<string>
    • client.randomGaussian(mean: number, stddev: number, count: number): Promise<number[]>
    • client.health(): Promise<HealthStatus>
  • Support both browser (fetch API) and Node.js (node-fetch / undici) environments
  • Bundle TypeScript type definitions (.d.ts files) with the package
  • Implement automatic retry with exponential backoff
  • Add configurable timeout and base URL
  • Provide Web Crypto API integration:
    • QRNGCryptoProvider implementing Crypto.getRandomValues() using QRNG backend
  • Support ESM and CommonJS module formats
  • Write tests with mocked HTTP responses (vitest or jest)
  • Set up npm publishing workflow (GitHub Actions)
  • Write usage documentation with code examples for browser and Node.js

References

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestsdkClient SDKs

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions