@wildboar/pki-stub
Version:
X.510 PKI-Stub ASN.1 data structures in TypeScript
135 lines • 5.57 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports._encode_BuiltInDomainDefinedAttribute = exports._decode_BuiltInDomainDefinedAttribute = exports._extension_additions_list_spec_for_BuiltInDomainDefinedAttribute = exports._root_component_type_list_2_spec_for_BuiltInDomainDefinedAttribute = exports._root_component_type_list_1_spec_for_BuiltInDomainDefinedAttribute = exports.BuiltInDomainDefinedAttribute = void 0;
/* eslint-disable */
const asn1_ts_1 = require("asn1-ts");
const $ = require("asn1-ts/dist/node/functional");
/* START_OF_SYMBOL_DEFINITION BuiltInDomainDefinedAttribute */
/**
* @summary BuiltInDomainDefinedAttribute
* @description
*
* ### ASN.1 Definition:
*
* ```asn1
* BuiltInDomainDefinedAttribute ::= SEQUENCE {
* type PrintableString(SIZE (1..ub-domain-defined-attribute-type-length)),
* value PrintableString(SIZE (1..ub-domain-defined-attribute-value-length)) }
* ```
*
* @class
*/
class BuiltInDomainDefinedAttribute {
constructor(
/**
* @summary `type_`.
* @public
* @readonly
*/
type_,
/**
* @summary `value`.
* @public
* @readonly
*/
value) {
this.type_ = type_;
this.value = value;
}
/**
* @summary Restructures an object into a BuiltInDomainDefinedAttribute
* @description
*
* This takes an `object` and converts it to a `BuiltInDomainDefinedAttribute`.
*
* @public
* @static
* @method
* @param {Object} _o An object having all of the keys and values of a `BuiltInDomainDefinedAttribute`.
* @returns {BuiltInDomainDefinedAttribute}
*/
static _from_object(_o) {
return new BuiltInDomainDefinedAttribute(_o.type_, _o.value);
}
}
exports.BuiltInDomainDefinedAttribute = BuiltInDomainDefinedAttribute;
/* END_OF_SYMBOL_DEFINITION BuiltInDomainDefinedAttribute */
/* START_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_BuiltInDomainDefinedAttribute */
/**
* @summary The Leading Root Component Types of BuiltInDomainDefinedAttribute
* @description
*
* This is an array of `ComponentSpec`s that define how to decode the leading root component type list of a SET or SEQUENCE.
*
* @constant
*/
exports._root_component_type_list_1_spec_for_BuiltInDomainDefinedAttribute = [
new $.ComponentSpec("type", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 19), undefined, undefined),
new $.ComponentSpec("value", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 19), undefined, undefined),
];
/* END_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_BuiltInDomainDefinedAttribute */
/* START_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_BuiltInDomainDefinedAttribute */
/**
* @summary The Trailing Root Component Types of BuiltInDomainDefinedAttribute
* @description
*
* This is an array of `ComponentSpec`s that define how to decode the trailing root component type list of a SET or SEQUENCE.
*
* @constant
*/
exports._root_component_type_list_2_spec_for_BuiltInDomainDefinedAttribute = [];
/* END_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_BuiltInDomainDefinedAttribute */
/* START_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_BuiltInDomainDefinedAttribute */
/**
* @summary The Extension Addition Component Types of BuiltInDomainDefinedAttribute
* @description
*
* This is an array of `ComponentSpec`s that define how to decode the extension addition component type list of a SET or SEQUENCE.
*
* @constant
*/
exports._extension_additions_list_spec_for_BuiltInDomainDefinedAttribute = [];
/* END_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_BuiltInDomainDefinedAttribute */
/* START_OF_SYMBOL_DEFINITION _decode_BuiltInDomainDefinedAttribute */
/**
* @summary Decodes an ASN.1 element into a(n) BuiltInDomainDefinedAttribute
* @function
* @param {_Element} el The element being decoded.
* @returns {BuiltInDomainDefinedAttribute} The decoded data structure.
*/
function _decode_BuiltInDomainDefinedAttribute(el) {
const sequence = el.sequence;
if (sequence.length < 2) {
throw new asn1_ts_1.ASN1ConstructionError("BuiltInDomainDefinedAttribute contained only " +
sequence.length.toString() +
" elements.");
}
sequence[0].name = "type";
sequence[1].name = "value";
let type_;
let value;
type_ = $._decodePrintableString(sequence[0]);
value = $._decodePrintableString(sequence[1]);
return new BuiltInDomainDefinedAttribute(type_, value);
}
exports._decode_BuiltInDomainDefinedAttribute = _decode_BuiltInDomainDefinedAttribute;
/* END_OF_SYMBOL_DEFINITION _decode_BuiltInDomainDefinedAttribute */
/* START_OF_SYMBOL_DEFINITION _encode_BuiltInDomainDefinedAttribute */
/**
* @summary Encodes a(n) BuiltInDomainDefinedAttribute into an ASN.1 Element.
* @function
* @param {value} el The element being decoded.
* @param elGetter A function that can be used to get new ASN.1 elements.
* @returns {_Element} The BuiltInDomainDefinedAttribute, encoded as an ASN.1 Element.
*/
function _encode_BuiltInDomainDefinedAttribute(value, elGetter) {
const components = [
$._encodePrintableString(value.type_, $.BER),
$._encodePrintableString(value.value, $.BER),
];
return $._encodeSequence(components, $.BER);
}
exports._encode_BuiltInDomainDefinedAttribute = _encode_BuiltInDomainDefinedAttribute;
/* END_OF_SYMBOL_DEFINITION _encode_BuiltInDomainDefinedAttribute */
/* eslint-enable */
//# sourceMappingURL=BuiltInDomainDefinedAttribute.ta.js.map