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 🙏

© 2026 – Pkg Stats / Ryan Hefner

ks-gateway-connector

v1.0.3

Published

KALP blockchain SDK for cryptographic operations and blockchain interactions

Readme

KALP SDK

A comprehensive TypeScript SDK for interacting with the KALP blockchain network. This package provides cryptographic operations, key management, user registration, and transaction capabilities.

Features

  • 🔐 Cryptographic Operations: Generate key pairs, create CSRs, and handle digital signatures
  • 🌱 Seed Phrase Support: Generate and derive keys from mnemonic phrases
  • 🔗 Multi-Network Support: Support for Stagenet, Testnet, and Mainnet environments
  • 📝 Transaction Handling: Submit and evaluate blockchain transactions
  • 👤 User Management: Register and enroll users on the KALP network
  • 🔒 Encryption Utilities: Built-in text encryption and decryption
  • 🌐 Cross-Platform: Works in both browser and Node.js environments

Installation

npm install ks-gateway-connector

Quick Start

import { 
  getSeedPhrase, 
  getKeyPair, 
  getEnrollmentId, 
  createCsr,
  registerAndEnrollUser,
  Network 
} from 'ks-gateway-connector';

// Generate a new seed phrase
const seedPhrase = await getSeedPhrase();
console.log('Seed Phrase:', seedPhrase);

// Generate key pair
const keyPair = await getKeyPair();
console.log('Public Key:', keyPair.pemPublicKey);
console.log('Private Key:', keyPair.pemPrivateKey);

// Get enrollment ID
const enrollmentId = await getEnrollmentId(keyPair.pemPublicKey);
console.log('Enrollment ID:', enrollmentId);

// Create CSR
const csr = createCsr(enrollmentId, keyPair.pemPrivateKey, keyPair.pemPublicKey);

// Register and enroll user
const certificate = await registerAndEnrollUser(
  Network.Testnet,
  null, // Use default network governance URL
  null, // Use default channel name
  enrollmentId,
  csr
);

API Reference

Key Generation

getSeedPhrase()

Generates a random mnemonic seed phrase.

const seedPhrase = await getSeedPhrase();

getKeyPair()

Generates a new ECDSA key pair.

const { pemPrivateKey, pemPublicKey } = await getKeyPair();

getKeyPairFromSeedPhrase(seedPhrase: string)

Derives a key pair from a seed phrase.

const keyPair = await getKeyPairFromSeedPhrase(seedPhrase);

User Management

getEnrollmentId(publicKey: string)

Generates an enrollment ID from a public key.

const enrollmentId = await getEnrollmentId(publicKey);

createCsr(enrollmentID: string, privateKeyPem: string, publicKeyPem: string)

Creates a Certificate Signing Request (CSR).

const csr = createCsr(enrollmentId, privateKey, publicKey);

registerAndEnrollUser(...)

Registers and enrolls a user in one step.

const certificate = await registerAndEnrollUser(
  network,
  nglURL,
  channelName,
  enrollmentID,
  csr
);

Transactions

submitTransaction(...)

Submits a transaction to the blockchain.

const transactionId = await submitTransaction(
  network,
  gatewayURL,
  enrollmentID,
  privateKey,
  certificate,
  channelName,
  chaincodeName,
  transactionName,
  transactionParams
);

evaluateTransaction(...)

Evaluates a transaction without committing to the blockchain.

const result = await evaluateTransaction(
  network,
  gatewayURL,
  enrollmentID,
  privateKey,
  certificate,
  channelName,
  chaincodeName,
  transactionName,
  transactionParams
);

Encryption

encryptText(text: string)

Encrypts text using AES encryption.

const encrypted = encryptText('Hello World');

decryptText(ciphertext: string)

Decrypts AES-encrypted text.

const decrypted = decryptText(encrypted);

Networks

The SDK supports multiple network environments:

import { Network } from 'ks-gateway-connector';

// Available networks
Network.Stagenet          // 'STAGENET'
Network.Testnet           // 'TESTNET' 
Network.Mainnet           // 'MAINNET'
Network.IntegrationMainnet // 'INTEGRATIONMAINNET'

Error Handling

All functions throw descriptive errors. Wrap calls in try-catch blocks:

try {
  const keyPair = await getKeyPair();
  // Use keyPair...
} catch (error) {
  console.error('Key generation failed:', error.message);
}

Environment Compatibility

This SDK works in both browser and Node.js environments:

  • Browser: Uses native Web Crypto API
  • Node.js: Uses Node.js crypto module with webcrypto polyfill
  • TypeScript: Full type definitions included

Dependencies

  • ethers: Ethereum library for blockchain interactions
  • elliptic: Elliptic curve cryptography
  • jsrsasign: JavaScript RSA signing and encryption
  • crypto-js: Cryptographic functions
  • cross-fetch: Universal fetch for HTTP requests

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

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

Support

For support and questions, please open an issue on the GitHub repository.