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

@zkred/agent-id

v1.1.0

Published

A package for zkred agent identification

Readme

zkred-agent-id

A package for agent identification and management.

Installation

npm install @zkred/agent-id

Usage

import zkredAgentId from "@zkred/agent-id";

// Generate a new private key
const privateKey = zkredAgentId.generatePrivateKey();

// Create an agent identity
const identity = await zkredAgentId.createIdentity(
  privateKey,
  "My Agent Description",
  80002, // Polygon Amoy testnet
  "https://my-agent-service.com"
);

API Reference

Core Functions

generateDID(ethAddress, chain, network)

Generates a Decentralized Identifier (DID) from an Ethereum address.

  • Parameters:
    • ethAddress: Ethereum address (0x-prefixed, 20 bytes)
    • chain: Chain name (e.g., "polygon", "privado")
    • network: Network name (e.g., "amoy", "main")
  • Returns: DID string in the format did:iden3:chain:network:base58Id

getETHPublicKeyFromDID(didFull)

Extracts the Ethereum public key from a DID.

  • Parameters:
    • didFull: Full DID string (e.g., "did:iden3:polygon:amoy:x6x5sor7zpyT5mmpg4fADaR47NADVbohtww4ppWZF")
  • Returns: Ethereum public key (hex) or null if not Ethereum-controlled

createIdentity(privateKey, description, chainId, serviceEndpoint, rpcUrl)

Registers an agent to the central Registry using native token payment.

  • Parameters:
    • privateKey: Private key of wallet to register
    • description: Description of the agent
    • chainId: Chain ID (80002 for Polygon Amoy, 296 for Hedera, 16602 for OG)
    • serviceEndpoint: Service endpoint URL
    • rpcUrl: (Optional) RPC URL for the chain
  • Returns: Object containing transaction hash, DID, description, service endpoint, and agent ID

validateAgent(did, chainId, rpcUrl)

Validates an agent's registration.

  • Parameters:
    • did: DID of the agent
    • chainId: Chain ID
    • rpcUrl: (Optional) RPC URL
  • Returns: Agent details including DID, agent ID, description, and service endpoint

registerAgentByUSDC(privateKey, description, chainId, serviceEndpoint, rpcUrl)

Registers an agent using USDC payment via x402 payment interceptor.

  • Parameters:
    • privateKey: Private key of wallet to register
    • description: Description of the agent
    • chainId: Chain ID
    • serviceEndpoint: Service endpoint URL
    • rpcUrl: (Optional) RPC URL
  • Returns: Promise resolving to agent details

Handshake Functions

initiateHandshake(initiatorDid, initiatorChainId, receiverDid, receiverChainId, initiatorRpcUrl, receiverRpcUrl)

Initiates a handshake between two agents.

  • Parameters:
    • initiatorDid: DID of the initiating agent
    • initiatorChainId: Chain ID of the initiator
    • receiverDid: DID of the receiving agent
    • receiverChainId: Chain ID of the receiver
    • initiatorRpcUrl: (Optional) RPC URL for initiator chain
    • receiverRpcUrl: (Optional) RPC URL for receiver chain
  • Returns: Session details including session ID, callback endpoint, and challenge

copmleteHandshake(privateKey, sessionId, receiverAgentCallbackEndPoint, challenge)

Completes a handshake by signing the challenge.

  • Parameters:
    • privateKey: Private key for signing
    • sessionId: Session ID from initiate handshake
    • receiverAgentCallbackEndPoint: Callback endpoint of receiver
    • challenge: Challenge to sign
  • Returns: Boolean indicating success

verifySignature(sessionId, challenge, signature, did)

Verifies a signature from a handshake.

  • Parameters:
    • sessionId: Session ID
    • challenge: Challenge that was signed
    • signature: Signature to verify
    • did: DID of the signer
  • Returns: Boolean indicating if signature is valid

Utility Functions

generatePrivateKey()

Generates a new random Ethereum private key.

  • Returns: Private key string

generateChallenge(length)

Generates a random challenge string for authentication.

  • Parameters:
    • length: (Optional) Length of challenge, default is 10
  • Returns: Random string

Supported Networks

  • Polygon Amoy (Chain ID: 80002)
  • Hedera (Chain ID: 296)
  • OG (Chain ID: 16602)