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

hpke

v0.5.0

Published

hybrid public key encryption

Downloads

5,235

Readme

Hybrid public key encryption with algorithms dispatched at runtime

This crate provides a generic-free interface to the hpke crate, a rust implementation of the draft RFC9180 hybrid public key encryption scheme. If you know the specific (aead, kdf, kem) triple at compile time, you should use the hpke crate directly.

Currently, this crate only exposes interfaces for the Base mode (0) described in the hpke draft, and within base mode, only stateless single-shot message encryption/decryption, as defined in RFC9180§6

WebAssembly ready

This crate is also published to npm as hpke as a typescript/javascript package, and can also be custom built for specific wasm use cases (omitting unused algorithms) with wasm-pack. For an example of using the library from node, see examples/example.ts

Nightly-only feature to work around a wasm-bindgen bug: cfg_eval

In order to opt out of algo-all for a wasm build, you must use nightly and enable the cfg_eval cargo feature. This is due to wasm-bindgen#2058. This is not necessary for use from rust, even when opting out of algo-all.

Available cargo features:

  • cfg_eval: allows this crate to be built on nightly rust for wasm without algo-all. Note that algo-all (all algorithms) will build for wasm on any channel without this feature. disabled by default. Attempting to build for wasm with a subset.

  • base-mode-open: Enables hpke base-mode one-shot open behavior (receiver functionality). Enabled by default.

  • base-mode-seal: Enables hpke base-mode one-shot seal behavior (sender functionality). Enabled by default.

  • algo-all: enables all aead, kdf, and kem algorithms. enabled by default.

  • aead-all: Enables aead-aes-gcm-128, aead-aes-gcm-256, and aead-chacha-20-poly-1305 algorithm features. Enabled by default.

  • kdf-all: Enables kdf-sha256, kdf-sha384, kdf-sha512 algorithm features. Enabled by default.

  • kem-all: Enables both kem-dh-p256-hkdf-sha256 and kem-x25519-hkdf-sha256 algorithm features. Enabled by default.

  • serde: enables derived serde serialization and deserialization for all public structs and enums. Disabled by default.

Example feature usage:

To depend on this crate from rust with all algorithms, base-mode-open, and base-mode-seal, use default features.

To depend on this crate from rust with all algorithms and serde enabled, but without base-mode-seal: default-features = false, features = ["algo-all", "base-mode-open", "serde"]

To build for wasm without kem-x25519-hkdf-sha256 or base-mode-open: wasm-pack build --no-default-features --features aead-all,kdf-all,kem-dh-p256-hkdf-sha256,base-mode-seal,cfg_eval

To build for wasm with all algorithms but without base-mode-open: wasm-pack build --no-default-features --features algo-all,base-mode-seal