npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

synnq_tqi_sdk

v1.0.5

Published

SDK for interacting with SYNNQ TQI services, including ZKP and Node management.

Downloads

7

Readme

SYNNQ TQI SDK

The SYNNQ TQI SDK is a TypeScript library designed to facilitate interaction with SYNNQ's TQI services. It provides comprehensive support for managing Zero-Knowledge Proofs (ZKP) and Nodes within the SYNNQ network.

Table of Contents

Features

  • Zero-Knowledge Proofs (ZKP): Generate and verify ZKPs using cryptographic methods.
  • Node Management: Register, manage, and interact with nodes in the SYNNQ network.
  • Flexible API: Provides an easy-to-use interface for managing both ZKP and Node operations.

Installation

To install the SYNNQ TQI SDK, run:

npm install synnq_tqi_sdk

Getting Started

Initialization

To start using the SDK, you need to create an APIManager instance. This will allow you to manage both ZKP and Node operations.

import { createAPIManager } from 'synnq_tqi_sdk';

// Initialize the APIManager with the Node base URL
const apiManager = createAPIManager('http://node-api.synnq.io');

The createAPIManager function initializes the SDK:

  • ZKP operations will always use the fixed URL https://zkp.synnq.io.
  • Node operations will use the base URL provided when initializing the APIManager.

ZKP Operations

Once you have initialized the APIManager, you can perform ZKP operations such as generating and verifying proofs.

Generate a ZKP

const zkpManager = apiManager.getZKPManager();
const proofResponse = await zkpManager.generateProof('my-secret');

console.log('Generated Proof:', proofResponse);

Verify a ZKP

const isValid = await zkpManager.verifyProof(
  proofResponse.proof,
  'my-secret',
  proofResponse.blinding
);

console.log('Proof is valid:', isValid);

Node Operations

You can also manage nodes by using the NodeManager from the APIManager.

Register a Node

const nodeManager = apiManager.getNodeManager();
await nodeManager.registerNode(
  'node-id',
  'http://node-address.com',
  'public-key'
);

console.log('Node registered successfully');

Get Nodes

const nodes = await nodeManager.getNodes();
console.log('Nodes:', nodes);

Send Data

await nodeManager.sendData({ key: 'value' });
console.log('Data sent successfully');

Receive Broadcast

await nodeManager.receiveBroadcast({ transaction: 'data' });
console.log('Broadcast received successfully');

API Reference

ZKPManager

Handles Zero-Knowledge Proof (ZKP) operations.

  • generateProof(secret: string): Promise<ProofResponse>
    Generates a Zero-Knowledge Proof for the given secret.

  • verifyProof(proof: string, secret: string, blinding: string): Promise<boolean>
    Verifies the provided ZKP using the stored blinding factor.

NodeManager

Handles Node management operations.

  • registerNode(id: string, address: string, publicKey: string): Promise<void>
    Registers a new node in the SYNNQ network.

  • getNodes(): Promise<any[]>
    Retrieves the list of nodes from the SYNNQ network.

  • sendData(data: any): Promise<void>
    Sends data to the SYNNQ network.

  • receiveBroadcast(data: any): Promise<void>
    Receives broadcasted data from the SYNNQ network.

APIManager

Manages both ZKP and Node operations by coordinating ZKPManager and NodeManager.

  • getZKPManager(): ZKPManager
    Returns an instance of the ZKPManager to handle ZKP-related operations.

  • getNodeManager(): NodeManager
    Returns an instance of the NodeManager to handle Node-related operations.

Development

Prerequisites

Building the Project

  1. Clone the repository:

    git clone https://github.com/your-repo/synnq_tqi_sdk.git
    cd synnq_tqi_sdk
  2. Install dependencies:

    npm install
  3. Compile the TypeScript code:

    npm run build

Running Tests

Currently, the project does not include any tests. You can add your own tests using your preferred testing framework (e.g., Jest).

Publishing the Package

  1. Ensure your code is compiled and all files are in the dist folder.
  2. Publish to NPM:
    npm publish --access public

License

This project is licensed under the MIT License. See the LICENSE file for details.

Explanation:

  1. Features: Describes what the SDK offers.
  2. Installation: Provides the command to install the SDK via NPM.
  3. Getting Started: Explains how to initialize and use the SDK for both ZKP and Node operations.
  4. API Reference: Details the methods available in ZKPManager, NodeManager, and APIManager.
  5. Development: Offers guidance on how to set up the project, build it, and publish the SDK.
  6. License: Includes the license under which the SDK is released.

This README.md should provide comprehensive documentation for users of the SDK, guiding them from installation to advanced usage and contributing. Let me know if you need any further adjustments!