zheng 3cabbb3159 webpack преди 1 ден
..
build 3cabbb3159 webpack преди 1 ден
LICENSE 3cabbb3159 webpack преди 1 ден
README.md 3cabbb3159 webpack преди 1 ден
package.json 3cabbb3159 webpack преди 1 ден

README.md

@peculiar/asn1-schema

License npm version

NPM

Decorators and helper APIs for declaring ASN.1 schemas in TypeScript.

This is the core package used by the schema modules in this repository. It lets you describe DER structures with decorators and convert them with AsnConvert, AsnParser, and AsnSerializer.

Installation

npm install @peculiar/asn1-schema

Overview

Abstract Syntax Notation One (ASN.1) is widely used across X.509, PKCS, CMS, OCSP, and related standards. This package keeps those mappings declarative and type-friendly by attaching schema metadata directly to classes.

TypeScript Example

import { AsnConvert, AsnProp, AsnPropTypes, AsnType, AsnTypeTypes } from "@peculiar/asn1-schema";

@AsnType({ type: AsnTypeTypes.Sequence })
class BasicConstraints {
  @AsnProp({ type: AsnPropTypes.Boolean, defaultValue: false })
  public cA = false;
}

const basicConstraints = new BasicConstraints();
basicConstraints.cA = true;

const encoded = AsnConvert.serialize(basicConstraints);
const decoded = AsnConvert.parse(encoded, BasicConstraints);

console.log(decoded.cA);

Related Links