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

@instun/sm2-2023-cryptosuite

v1.2.0

Published

SM2 2023 cryptographic suite implementation for Data Integrity, compliant with W3C standards

Readme

SM2 2023 Cryptographic Suite

An implementation of the SM2 2023 cryptographic suite for Data Integrity, compliant with W3C standards and optimized for both Node.js and browser environments.

Overview

The SM2 2023 Cryptographic Suite provides a standards-compliant implementation for:

  • Data Integrity Proofs: Create and verify proofs using SM2 signatures
  • Document Canonicalization: URDNA2015 algorithm implementation
  • SM2/SM3: Signature generation and verification using SM2 with SM3 digest
  • Cross-Platform: Consistent behavior across Node.js and browsers

Features

  • Complete SM2 2023 cryptographic suite implementation
  • W3C Data Integrity 1.0 compatibility
  • URDNA2015 document canonicalization
  • Pluggable key management support
  • Comprehensive error handling

Standards Compliance

Cryptographic Standards

  • GB/T 32918.1-2016: SM2 Elliptic Curve Digital Signature Algorithm
  • GB/T 32905-2016: SM3 Cryptographic Hash Algorithm

W3C Standards

  • Data Integrity 1.0
    • Proof creation and verification
    • Document canonicalization
    • Signature suite specification

Installation

npm install @instun/sm2-2023-cryptosuite

Usage

import { cryptosuite } from '@instun/sm2-2023-cryptosuite';

// Initialize suite with a key
const suite = {
  ...cryptosuite,
  signer: () => key.signer(),
  verifier: () => key.verifier()
};

// Create a proof
const proof = await createProof({
  document,
  suite,
  purpose
});

// Verify a proof
const result = await verifyProof({
  document,
  proof,
  suite,
  purpose
});

API Documentation

Cryptographic Suite

Core implementation of the SM2 2023 cryptographic suite.

Properties

  • name: 'sm2-2023'
  • requiredAlgorithm: 'SM2'

Methods

canonize(input, options)

Canonicalizes a JSON-LD document.

  • Parameters:
    • input (Object|string): JSON-LD document
    • options (Object, optional): Canonicalization options
  • Returns: Promise Canonicalized document
createVerifier(options)

Creates a verifier for SM2 signatures.

  • Parameters:
    • options.verificationMethod (Object): Verification method object
  • Returns: Verifier object with verify() method

Error Handling

The module provides specific error types:

  • ArgumentError: Invalid argument errors
  • FormatError: Format conversion errors
  • CryptoError: Cryptographic operation errors

Each error includes:

  • Descriptive message
  • Error code
  • Original error cause (when applicable)

Platform Requirements

  • Node.js 16.x or later
  • Modern browsers with ES6+ support

License

Copyright (c) 2024 Instun, Inc. All rights reserved.