Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hazae41/asn1
Zero-copy ASN.1 and DER coding 🏎️
https://github.com/hazae41/asn1
asn1 browser decoding der encoding esmodules javascript nodejs parser typescript unit-testing zero-copy
Last synced: 3 months ago
JSON representation
Zero-copy ASN.1 and DER coding 🏎️
- Host: GitHub
- URL: https://github.com/hazae41/asn1
- Owner: hazae41
- Created: 2022-12-04T19:45:47.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-09-01T06:13:28.000Z (4 months ago)
- Last Synced: 2024-10-07T21:31:01.667Z (3 months ago)
- Topics: asn1, browser, decoding, der, encoding, esmodules, javascript, nodejs, parser, typescript, unit-testing, zero-copy
- Language: TypeScript
- Homepage:
- Size: 825 KB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
```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])
```