asn1tools-js
Version:
ASN.1 encoding and decoding library for TypeScript/JavaScript, compatible with Python asn1tools
57 lines • 1.46 kB
TypeScript
/**
* Complex ASN.1 type implementations
*/
import { Asn1Type } from '../types';
import { BaseType } from './types';
/**
* ASN.1 SEQUENCE type
*/
export declare class SequenceType extends BaseType {
private members;
constructor(name: string, members: Array<{
name: string;
type: Asn1Type;
optional?: boolean;
defaultValue?: any;
}>);
encode(value: any): Uint8Array;
decode(data: Uint8Array, offset?: number): {
value: any;
length: number;
};
}
/**
* ASN.1 SEQUENCE OF type
*/
export declare class SequenceOfType extends BaseType {
private elementType;
constructor(name: string, elementType: Asn1Type);
encode(value: any): Uint8Array;
decode(data: Uint8Array, offset?: number): {
value: any[];
length: number;
};
}
/**
* ASN.1 CHOICE type
*/
export declare class ChoiceType extends BaseType {
private choices;
private tagToChoice;
constructor(name: string, choices: Array<{
name: string;
type: Asn1Type;
tag?: number;
}>);
encode(value: any): Uint8Array;
decode(data: Uint8Array, offset?: number): {
value: any;
length: number;
};
protected decodeWithTag(_data: Uint8Array, _offset?: number): {
content: Uint8Array;
totalLength: number;
};
protected encodeWithTag(_content: Uint8Array): Uint8Array;
}
//# sourceMappingURL=complex-types.d.ts.map