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

x448-js

v1.0.3

Published

Pure JS/TS library with X448 curve for ECDH

Downloads

16

Readme

X448-js GitHub license Tests npm version Coverage Status Monthly Downloads

Pure JavaScript/TypeScript implementation of the X448 elliptic curve (RFC 7748) for ECDH key exchange. Uses the jsbn library for big integer operations.

Installation

Using npm:

npm install x448-js

or yarn:

yarn add x448-js

Then include it in your code:

import { getPublicKey, getSharedSecret } from "x448-js";

Usage

getPublicKey(privateKey)

Calculate public key from a provided private key

const privateKey = crypto.randomFillSync(new Uint8Array(56));
const publicKey = getPublicKey(privateKey);

The private key can be any random generated Buffer/byte-array of length 56

getSharedSecret(privateKey, publicKey)

Calculate shared secret from a locally stored private key and a remote public key

The results are represented as plain number arrays. They can be converted using Buffer.from, or Uint8Array.from.

Example

ECDH shared secret exchange

const alice_private = random(56); // 9a8f4925d1519f5775cf46b04b5800d4ee9ee8bae8bc5565d498c28dd9c9baf574a9419744897391006382a6f127ab1d9ac2d8c0a598726b
const bob_private = random(56); // 1c306a7ac2a0e2e0990b294470cba339e6453772b075811d8fad0d1d6927c120bb5ee8972b0d3e21374c9c921b09d1b0366f10b65173992d

const alice_public = getPublicKey(alice_private); // 9b08f7cc31b7e3e67d22d5aea121074a273bd2b83de09c63faa73d2c22c5d9bbc836647241d953d40c5b12da88120d53177f80e532c41fa0
const bob_public = getPublicKey(bob_private); // 3eb7a829b0cd20f5bcfc0b599b6feccf6da4627107bdb0d4f345b43027d8b972fc3e34fb4232a13ca706dcb57aec3dae07bdc1c67bf33609

const alice_shared_secret = getSharedSecret(alice_private, bob_public); // 07fff4181ac6cc95ec1c16a94a0f74d12da232ce40a77552281d282bb60c0b56fd2464c335543936521c24403085d59a449a5037514a879d
const bob_shared_secret = getSharedSecret(bob_private, alice_public); // 07fff4181ac6cc95ec1c16a94a0f74d12da232ce40a77552281d282bb60c0b56fd2464c335543936521c24403085d59a449a5037514a879d