@li0ard/bign
Bign (STB 34.101.45) curves and DSA in pure TypeScript
docs
# from NPM
npm i @li0ard/bign
# from JSR
bunx jsr i @li0ard/bign
- DSA (standard curves included)
- Provides simple and modern API
- Most of the APIs are strictly typed
- Fully complies with STB 34.101.45 (in Russian) standard
- Supports Bun, Node.js, Deno, Browsers
import { BIGN128, sign, verify, getPublicKey } from "@li0ard/bign";
let curve = BIGN128;
let privKey = hexToBytes("1F66B5B84B7339674533F0329C74F21834281FED0732429E0C79235FC273E269");
let publicKey = getPublicKey(curve, privKey);
let digest = hexToBytes("ABEF9725D4C5A83597A367D14494CC2542F20F659DDFECC961A3EC550CBA8C75");
let signature = sign(curve, privKey, digest);
console.log(signature); // -> Uint8Array [...]
console.log(verify(curve, publicKey, digest, signature)); // -> true
import { SignMode, BIGN128, sign, verify, getPublicKey } from "@li0ard/bign";
let curve = BIGN128;
let privKey = hexToBytes("1F66B5B84B7339674533F0329C74F21834281FED0732429E0C79235FC273E269");
let publicKey = getPublicKey(curve, privKey);
let digest = hexToBytes("ABEF9725D4C5A83597A367D14494CC2542F20F659DDFECC961A3EC550CBA8C75");
let signature = sign(curve, privKey, digest, { mode: SignMode.DEFAULT });
console.log(signature); // -> Uint8Array [...]
console.log(verify(curve, publicKey, digest, signature)); // -> true