Skip to content

li0ard/sm2

Repository files navigation

@li0ard/sm2
SM2 curves and DSA in pure TypeScript
docs




Installation

# from NPM
npm i @li0ard/sm2

# from JSR
bunx jsr i @li0ard/sm2

Supported modes:

  • DSA
  • Key exchange
  • Encryption schema

Features

  • Provides simple and modern API
  • Most of the APIs are strictly typed
  • Fully complies with GB/T 32918-2016 standard
  • Supports Bun, Node.js, Deno, Browsers

Examples

Create signature

import { sign } from "@li0ard/sm2";

const privateKey = hexToBytes("39...B8");
const message = hexToBytes("6D65737361676520646967657374");

console.log(sign(privateKey, message));

About

SM2 curves and DSA in pure TypeScript

Topics

Resources

License

Stars

Watchers

Forks

Contributors