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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@synet/core

v0.1.3

Published

Core cryptographic and identity primitives for Synet agents.

Readme

@synet/core

Core cryptographic and identity primitives for Synet agents.

Installation

npm install @synet/core**

Features

  • Key management (RSA and Ed25519)
  • Digital signatures
  • Cryptographic hashing
  • Identity derivation
  • Zero dependencies

Usage

Key Management

Generate cryptographic key pairs, derive public keys from private keys, and manage key identities:

import { generateKeyPair, derivePublicKey, getShortId } from '@synet/core';

// Generate a new Ed25519 key pair
const keyPair = generateKeyPair('ed25519');
console.log('Private key:', keyPair.privateKey);
console.log('Public key:', keyPair.publicKey);

// Derive a public key from an existing private key
const derivedPublic = derivePublicKey(keyPair.privateKey);
console.log('Derived public key matches:', derivedPublic === keyPair.publicKey);

// Generate a short ID for a key (useful for display)
const shortId = getShortId(keyPair.publicKey);
console.log('Key short ID:', shortId); // e.g., "3f7b2a1c8e9d4f6a"

Digital Signatures

Create and verify cryptographic signatures for message authentication:

import { signMessage, verifySignature } from '@synet/core';

// Sign a message
const message = 'This message needs to be authenticated';
const signature = signMessage(keyPair.privateKey, message);

// Verify the signature
const isValid = verifySignature(keyPair.publicKey, message, signature);
console.log('Signature valid:', isValid); // true

// Tampering detection
const isForged = verifySignature(keyPair.publicKey, 'Forged message', signature);
console.log('Forged signature valid:', isForged); // false

Cryptographic Hashing

Create secure hash digests in various formats:

import { sha256Hex, sha256Base64, hashToAgentId } from '@synet/core';

// Create SHA-256 hash in hexadecimal format
const hexHash = sha256Hex('important data');
console.log('Hex hash:', hexHash);

// Create SHA-256 hash in base64 format
const base64Hash = sha256Base64('important data');
console.log('Base64 hash:', base64Hash);

// Generate an agent ID from a public key
const agentId = hashToAgentId(keyPair.publicKey);
console.log('Agent ID:', agentId); // e.g., "8f4d7c2b1a3e6d5f"

API Reference

Key Manager Functions

generateKeyPair(type: 'rsa' | 'ed25519'): KeyPair

Generates a new cryptographic key pair of the specified type.

derivePublicKey(privateKey: string): string | null

Extracts the public key from a private key.

getShortId(publicKey: string): string

Computes a 16-character hexadecimal identifier from a public key.

getFingerprint(publicKey: string): string

Computes a full 64-character hexadecimal fingerprint from a public key.

generateWireGuardKeyPair(): { privateKey: string, publicKey: string }

Generates Wireguard native Curve25519 (X25519) keypair exported in Base64

Signer Functions

signMessage(privateKey: string, message: string): string

Signs a message with a private key, returning a base64-encoded signature.

verifySignature(publicKey: string, message: string, signature: string): boolean

Verifies a signature against a message using a public key.

Hash Functions

sha256Hex(data: string | Buffer): string

Creates a SHA-256 hash of the input data in hexadecimal format.

sha256Base64(data: string | Buffer): string

Creates a SHA-256 hash of the input data in base64 format.

hashToAgentId(publicKey: string): string

Derives a 16-character agent identifier from a public key.

Types

type KeyType = 'rsa' | 'ed25519';

interface KeyPair {
  privateKey: string;
  publicKey: string;
  type: KeyType;
}

Development


# Install dependencies
npm install

# Run tests
npm test

# Run tests with coverage
npm run coverage

# Lint code
npm run lint

# Build the package
npm run build

License

MIT