Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@hazae41/asn1

hazae41173MIT1.3.31TypeScript support: included

Zero-copy ASN.1 <=> DER encoding for the web

asn1, x509, der, ber, buffer, encoding, encoder, decoding, decoder, binary, parsing, parser, esmodules, browser, zero-copy, typescript, unit-tested

readme

npm i @hazae41/asn1

Node Package 📦

Features

Current features

  • 100% TypeScript and ESM
  • No external dependency
  • Rust-like patterns
  • Zero-copy DER <=> ASN1 reading and writing
  • Almost all universal triplets
  • Implicit and explicit tagged types

Upcoming features

  • More string types
  • More encodings

Usage

import { DER } from "@hazae41/asn1"

const input = new Uint8Array([0x01, 0x01, 0xFF])

const triplet = DER.tryFromBytes(input).unwrap() // Boolean

console.log(triplet.toString()) // "BOOLEAN true"

const output = DER.tryToBytes(triplet).unwrap() // Uint8Array([0x01, 0x01, 0xFF])