@peculiar/asn1-schema
Advanced tools
Comparing version 2.1.9 to 2.2.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.defaultConverter = exports.AsnNullConverter = exports.AsnGeneralizedTimeConverter = exports.AsnUTCTimeConverter = exports.AsnCharacterStringConverter = exports.AsnGeneralStringConverter = exports.AsnVisibleStringConverter = exports.AsnGraphicStringConverter = exports.AsnIA5StringConverter = exports.AsnVideotexStringConverter = exports.AsnTeletexStringConverter = exports.AsnPrintableStringConverter = exports.AsnNumericStringConverter = exports.AsnUniversalStringConverter = exports.AsnBmpStringConverter = exports.AsnUtf8StringConverter = exports.AsnOctetStringConverter = exports.AsnBooleanConverter = exports.AsnObjectIdentifierConverter = exports.AsnBitStringConverter = exports.AsnIntegerArrayBufferConverter = exports.AsnEnumeratedConverter = exports.AsnIntegerConverter = exports.AsnAnyConverter = void 0; | ||
exports.defaultConverter = exports.AsnNullConverter = exports.AsnGeneralizedTimeConverter = exports.AsnUTCTimeConverter = exports.AsnCharacterStringConverter = exports.AsnGeneralStringConverter = exports.AsnVisibleStringConverter = exports.AsnGraphicStringConverter = exports.AsnIA5StringConverter = exports.AsnVideotexStringConverter = exports.AsnTeletexStringConverter = exports.AsnPrintableStringConverter = exports.AsnNumericStringConverter = exports.AsnUniversalStringConverter = exports.AsnBmpStringConverter = exports.AsnUtf8StringConverter = exports.AsnOctetStringConverter = exports.AsnBooleanConverter = exports.AsnObjectIdentifierConverter = exports.AsnBitStringConverter = exports.AsnIntegerBigIntConverter = exports.AsnIntegerArrayBufferConverter = exports.AsnEnumeratedConverter = exports.AsnIntegerConverter = exports.AsnAnyConverter = void 0; | ||
const asn1 = require("asn1js"); | ||
@@ -20,3 +20,3 @@ const enums_1 = require("./enums"); | ||
exports.AsnIntegerConverter = { | ||
fromASN: (value) => value.valueBlock.valueHex.byteLength > 4 | ||
fromASN: (value) => value.valueBlock.valueHexView.byteLength >= 4 | ||
? value.valueBlock.toString() | ||
@@ -34,2 +34,6 @@ : value.valueBlock.valueDec, | ||
}; | ||
exports.AsnIntegerBigIntConverter = { | ||
fromASN: (value) => value.toBigInt(), | ||
toASN: (value) => asn1.Integer.fromBigInt(value), | ||
}; | ||
exports.AsnBitStringConverter = { | ||
@@ -36,0 +40,0 @@ fromASN: (value) => value.valueBlock.valueHex, |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AsnProp = exports.AsnType = void 0; | ||
exports.AsnProp = exports.AsnSequenceType = exports.AsnSetType = exports.AsnChoiceType = exports.AsnType = void 0; | ||
const converters = require("./converters"); | ||
const enums_1 = require("./enums"); | ||
const storage_1 = require("./storage"); | ||
@@ -18,2 +19,8 @@ const AsnType = (options) => (target) => { | ||
exports.AsnType = AsnType; | ||
const AsnChoiceType = () => (0, exports.AsnType)({ type: enums_1.AsnTypeTypes.Choice }); | ||
exports.AsnChoiceType = AsnChoiceType; | ||
const AsnSetType = (options) => (0, exports.AsnType)({ type: enums_1.AsnTypeTypes.Set, ...options }); | ||
exports.AsnSetType = AsnSetType; | ||
const AsnSequenceType = (options) => (0, exports.AsnType)({ type: enums_1.AsnTypeTypes.Sequence, ...options }); | ||
exports.AsnSequenceType = AsnSequenceType; | ||
const AsnProp = (options) => (target, propertyKey) => { | ||
@@ -20,0 +27,0 @@ let schema; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AsnSerializer = exports.AsnParser = exports.AsnPropTypes = exports.AsnTypeTypes = exports.AsnType = exports.AsnProp = void 0; | ||
exports.AsnSerializer = exports.AsnParser = exports.AsnPropTypes = exports.AsnTypeTypes = exports.AsnSetType = exports.AsnSequenceType = exports.AsnChoiceType = exports.AsnType = exports.AsnProp = void 0; | ||
const tslib_1 = require("tslib"); | ||
@@ -10,2 +10,5 @@ tslib_1.__exportStar(require("./converters"), exports); | ||
Object.defineProperty(exports, "AsnType", { enumerable: true, get: function () { return decorators_1.AsnType; } }); | ||
Object.defineProperty(exports, "AsnChoiceType", { enumerable: true, get: function () { return decorators_1.AsnChoiceType; } }); | ||
Object.defineProperty(exports, "AsnSequenceType", { enumerable: true, get: function () { return decorators_1.AsnSequenceType; } }); | ||
Object.defineProperty(exports, "AsnSetType", { enumerable: true, get: function () { return decorators_1.AsnSetType; } }); | ||
var enums_1 = require("./enums"); | ||
@@ -12,0 +15,0 @@ Object.defineProperty(exports, "AsnTypeTypes", { enumerable: true, get: function () { return enums_1.AsnTypeTypes; } }); |
@@ -17,3 +17,3 @@ import * as asn1 from "asn1js"; | ||
export const AsnIntegerConverter = { | ||
fromASN: (value) => value.valueBlock.valueHex.byteLength > 4 | ||
fromASN: (value) => value.valueBlock.valueHexView.byteLength >= 4 | ||
? value.valueBlock.toString() | ||
@@ -31,2 +31,6 @@ : value.valueBlock.valueDec, | ||
}; | ||
export const AsnIntegerBigIntConverter = { | ||
fromASN: (value) => value.toBigInt(), | ||
toASN: (value) => asn1.Integer.fromBigInt(value), | ||
}; | ||
export const AsnBitStringConverter = { | ||
@@ -33,0 +37,0 @@ fromASN: (value) => value.valueBlock.valueHex, |
import * as converters from "./converters"; | ||
import { AsnTypeTypes } from "./enums"; | ||
import { schemaStorage } from "./storage"; | ||
@@ -14,2 +15,5 @@ export const AsnType = (options) => (target) => { | ||
}; | ||
export const AsnChoiceType = () => AsnType({ type: AsnTypeTypes.Choice }); | ||
export const AsnSetType = (options) => AsnType({ type: AsnTypeTypes.Set, ...options }); | ||
export const AsnSequenceType = (options) => AsnType({ type: AsnTypeTypes.Sequence, ...options }); | ||
export const AsnProp = (options) => (target, propertyKey) => { | ||
@@ -16,0 +20,0 @@ let schema; |
export * from "./converters"; | ||
export * from "./types/index"; | ||
export { AsnProp, AsnType } from "./decorators"; | ||
export { AsnProp, AsnType, AsnChoiceType, AsnSequenceType, AsnSetType } from "./decorators"; | ||
export { AsnTypeTypes, AsnPropTypes } from "./enums"; | ||
@@ -5,0 +5,0 @@ export { AsnParser } from "./parser"; |
@@ -0,1 +1,2 @@ | ||
import * as asn1 from "asn1js"; | ||
import { AnyConverterType, IAsnConverter, IntegerConverterType } from "./types"; | ||
@@ -14,3 +15,3 @@ import { AsnPropTypes } from "./enums"; | ||
*/ | ||
export declare const AsnIntegerConverter: IAsnConverter<IntegerConverterType>; | ||
export declare const AsnIntegerConverter: IAsnConverter<IntegerConverterType, asn1.Integer>; | ||
/** | ||
@@ -25,2 +26,6 @@ * ASN.1 ENUMERATED converter | ||
/** | ||
* ASN.1 INTEGER to BigInt converter | ||
*/ | ||
export declare const AsnIntegerBigIntConverter: IAsnConverter<bigint, asn1.Integer>; | ||
/** | ||
* ASN.1 BIT STRING converter | ||
@@ -27,0 +32,0 @@ */ |
import { AsnPropTypes, AsnTypeTypes } from "./enums"; | ||
import { IAsnConverter, IEmptyConstructor } from "./types"; | ||
interface IAsn1TypeOptions { | ||
export declare type AsnItemType<T = any> = AsnPropTypes | IEmptyConstructor<T>; | ||
export interface IAsn1TypeOptions { | ||
type: AsnTypeTypes; | ||
itemType?: AsnPropTypes | IEmptyConstructor<any>; | ||
itemType?: AsnItemType; | ||
} | ||
export declare type AsnRepeatTypeString = "sequence" | "set"; | ||
export declare type AsnRepeatType = AsnRepeatTypeString; | ||
interface IAsn1PropOptions { | ||
type: AsnPropTypes | IEmptyConstructor<any>; | ||
export interface IAsn1PropOptions { | ||
type: AsnItemType; | ||
optional?: boolean; | ||
@@ -19,3 +20,11 @@ defaultValue?: any; | ||
export declare const AsnType: (options: IAsn1TypeOptions) => (target: object) => void; | ||
export declare const AsnChoiceType: () => (target: object) => void; | ||
export interface IAsn1SetOptions { | ||
itemType: AsnItemType; | ||
} | ||
export declare const AsnSetType: (options: IAsn1SetOptions) => (target: object) => void; | ||
export interface IAsn1SequenceOptions { | ||
itemType?: AsnItemType; | ||
} | ||
export declare const AsnSequenceType: (options: IAsn1SequenceOptions) => (target: object) => void; | ||
export declare const AsnProp: (options: IAsn1PropOptions) => (target: object, propertyKey: string) => void; | ||
export {}; |
export * from "./converters"; | ||
export * from "./types/index"; | ||
export { AsnProp, AsnType } from "./decorators"; | ||
export { AsnProp, AsnType, AsnChoiceType, AsnSequenceType, AsnSetType } from "./decorators"; | ||
export { AsnTypeTypes, AsnPropTypes } from "./enums"; | ||
@@ -5,0 +5,0 @@ export { AsnParser } from "./parser"; |
{ | ||
"name": "@peculiar/asn1-schema", | ||
"version": "2.1.9", | ||
"version": "2.2.0", | ||
"description": "Decorators for ASN.1 schemas building", | ||
@@ -41,3 +41,3 @@ "files": [ | ||
"dependencies": { | ||
"asn1js": "^3.0.4", | ||
"asn1js": "^3.0.5", | ||
"pvtsutils": "^1.3.2", | ||
@@ -56,3 +56,3 @@ "tslib": "^2.4.0" | ||
], | ||
"gitHead": "ee7315518c61871fa288cade956822e266b7e113" | ||
"gitHead": "1c4af9723af2807d960c3b850109ef0d3c74e52b" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
148057
2061
Updatedasn1js@^3.0.5