# @hazae41/asn1

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

Latest version **1.3.35** (published 2025-08-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install @hazae41/asn1
pnpm add @hazae41/asn1
yarn add @hazae41/asn1
bun add @hazae41/asn1
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.35 |
| Published | 2025-08-15 |
| First published | 2022-12-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 383.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | hazae41 |
| Maintainers | hazae41 |
| Keywords | asn1, x509, der, ber, buffer, encoding, encoder, decoding, decoder, binary, parsing, parser, esmodules, browser, zero-copy, typescript, unit-tested |

## Links

- npm: https://www.npmjs.com/package/@hazae41/asn1
- Repository: https://github.com/hazae41/asn1
- Issues: https://github.com/hazae41/asn1/issues
- npm.io page: https://npm.io/package/@hazae41/asn1

## Dependencies (3)

- [@hazae41/base16](https://npm.io/package/@hazae41/base16.md) ^2.0.2
- [@hazae41/binary](https://npm.io/package/@hazae41/binary.md) ^1.3.11
- [@hazae41/cursor](https://npm.io/package/@hazae41/cursor.md) ^2.0.7

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M weekly downloads
- [jwt-simple](https://npm.io/package/jwt-simple.md) — 259.5K weekly downloads
- [@exodus/patch-broken-hermes-typed-arrays](https://npm.io/package/@exodus/patch-broken-hermes-typed-arrays.md) — 28.5K weekly downloads
- [@native-to-anchor/buffer-layout](https://npm.io/package/@native-to-anchor/buffer-layout.md) — 12.2K weekly downloads
- [binary-parser-encoder](https://npm.io/package/binary-parser-encoder.md) — 5.3K weekly downloads

## Recent versions

- 1.3.35 (latest) — 2025-08-15
- 1.3.34 — 2025-08-15
- 1.3.33 — 2025-08-15
- 1.3.32 — 2025-08-13
- 1.3.31 — 2024-09-01
- 1.3.30 — 2024-09-01
- 1.3.28 — 2024-03-11
- 1.3.27 — 2024-03-11
- 1.3.26 — 2023-11-30
- 1.3.25 — 2023-11-14
- 1.3.24 — 2023-11-14
- 1.3.23 — 2023-11-14
- 1.3.22 — 2023-11-14
- 1.3.21 — 2023-11-14
- 1.3.20 — 2023-11-14
- … 82 more at https://npm.io/package/@hazae41/asn1/versions

## README

<div align="center">
<img src="https://user-images.githubusercontent.com/4405263/219944360-d138f86e-5517-4859-a532-1a6e45579074.png" />
</div>

```bash
npm i @hazae41/asn1
```

[**Node Package 📦**](https://www.npmjs.com/package/@hazae41/asn1)

## 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](https://github.com/sponsors/hazae41)
- More string types
- More encodings

## Usage

```typescript
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])
```

---
_Source: https://npm.io/package/@hazae41/asn1 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
