@wildboar/pki-stub
Version:
X.510 PKI-Stub ASN.1 data structures in TypeScript
166 lines • 7.03 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports._encode_ORAddress = exports._decode_ORAddress = exports._extension_additions_list_spec_for_ORAddress = exports._root_component_type_list_2_spec_for_ORAddress = exports._root_component_type_list_1_spec_for_ORAddress = exports.ORAddress = void 0;
/* eslint-disable */
const asn1_ts_1 = require("asn1-ts");
const $ = require("asn1-ts/dist/node/functional");
const BuiltInDomainDefinedAttributes_ta_1 = require("../PkiPmiExternalDataTypes/BuiltInDomainDefinedAttributes.ta");
const BuiltInStandardAttributes_ta_1 = require("../PkiPmiExternalDataTypes/BuiltInStandardAttributes.ta");
const ExtensionAttributes_ta_1 = require("../PkiPmiExternalDataTypes/ExtensionAttributes.ta");
/* START_OF_SYMBOL_DEFINITION ORAddress */
/**
* @summary ORAddress
* @description
*
* ### ASN.1 Definition:
*
* ```asn1
* ORAddress ::= SEQUENCE {
* built-in-standard-attributes BuiltInStandardAttributes,
* built-in-domain-defined-attributes BuiltInDomainDefinedAttributes OPTIONAL,
* -- see also teletex-domain-defined-attributes
* extension-attributes ExtensionAttributes OPTIONAL }
* ```
*
* @class
*/
class ORAddress {
constructor(
/**
* @summary `built_in_standard_attributes`.
* @public
* @readonly
*/
built_in_standard_attributes,
/**
* @summary `built_in_domain_defined_attributes`.
* @public
* @readonly
*/
built_in_domain_defined_attributes,
/**
* @summary `extension_attributes`.
* @public
* @readonly
*/
extension_attributes) {
this.built_in_standard_attributes = built_in_standard_attributes;
this.built_in_domain_defined_attributes = built_in_domain_defined_attributes;
this.extension_attributes = extension_attributes;
}
/**
* @summary Restructures an object into a ORAddress
* @description
*
* This takes an `object` and converts it to a `ORAddress`.
*
* @public
* @static
* @method
* @param {Object} _o An object having all of the keys and values of a `ORAddress`.
* @returns {ORAddress}
*/
static _from_object(_o) {
return new ORAddress(_o.built_in_standard_attributes, _o.built_in_domain_defined_attributes, _o.extension_attributes);
}
}
exports.ORAddress = ORAddress;
/* END_OF_SYMBOL_DEFINITION ORAddress */
/* START_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_ORAddress */
/**
* @summary The Leading Root Component Types of ORAddress
* @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_ORAddress = [
new $.ComponentSpec("built-in-standard-attributes", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 16), undefined, undefined),
new $.ComponentSpec("built-in-domain-defined-attributes", true, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 16), undefined, undefined),
new $.ComponentSpec("extension-attributes", true, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 17), undefined, undefined),
];
/* END_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_ORAddress */
/* START_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_ORAddress */
/**
* @summary The Trailing Root Component Types of ORAddress
* @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_ORAddress = [];
/* END_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_ORAddress */
/* START_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_ORAddress */
/**
* @summary The Extension Addition Component Types of ORAddress
* @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_ORAddress = [];
/* END_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_ORAddress */
/* START_OF_SYMBOL_DEFINITION _decode_ORAddress */
/**
* @summary Decodes an ASN.1 element into a(n) ORAddress
* @function
* @param {_Element} el The element being decoded.
* @returns {ORAddress} The decoded data structure.
*/
function _decode_ORAddress(el) {
/* START_OF_SEQUENCE_COMPONENT_DECLARATIONS */
let built_in_standard_attributes;
let built_in_domain_defined_attributes;
let extension_attributes;
/* END_OF_SEQUENCE_COMPONENT_DECLARATIONS */
/* START_OF_CALLBACKS_MAP */
const callbacks = {
"built-in-standard-attributes": (_el) => {
built_in_standard_attributes =
BuiltInStandardAttributes_ta_1._decode_BuiltInStandardAttributes(_el);
},
"built-in-domain-defined-attributes": (_el) => {
built_in_domain_defined_attributes =
BuiltInDomainDefinedAttributes_ta_1._decode_BuiltInDomainDefinedAttributes(_el);
},
"extension-attributes": (_el) => {
extension_attributes = ExtensionAttributes_ta_1._decode_ExtensionAttributes(_el);
},
};
/* END_OF_CALLBACKS_MAP */
$._parse_sequence(el, callbacks, exports._root_component_type_list_1_spec_for_ORAddress, exports._extension_additions_list_spec_for_ORAddress, exports._root_component_type_list_2_spec_for_ORAddress, undefined);
return new ORAddress(
/* SEQUENCE_CONSTRUCTOR_CALL */ built_in_standard_attributes, built_in_domain_defined_attributes, extension_attributes);
}
exports._decode_ORAddress = _decode_ORAddress;
/* END_OF_SYMBOL_DEFINITION _decode_ORAddress */
/* START_OF_SYMBOL_DEFINITION _encode_ORAddress */
/**
* @summary Encodes a(n) ORAddress 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 ORAddress, encoded as an ASN.1 Element.
*/
function _encode_ORAddress(value, elGetter) {
var _a, _b;
const components = [
/* REQUIRED */ BuiltInStandardAttributes_ta_1._encode_BuiltInStandardAttributes(value.built_in_standard_attributes, $.BER),
];
if ((_a = value.built_in_domain_defined_attributes) === null || _a === void 0 ? void 0 : _a.length) {
const c = BuiltInDomainDefinedAttributes_ta_1._encode_BuiltInDomainDefinedAttributes(value.built_in_domain_defined_attributes, $.BER);
components.push(c);
}
if ((_b = value.extension_attributes) === null || _b === void 0 ? void 0 : _b.length) {
const c = ExtensionAttributes_ta_1._encode_ExtensionAttributes(value.extension_attributes, $.BER);
components.push(c);
}
return $._encodeSequence(components, $.BER);
}
exports._encode_ORAddress = _encode_ORAddress;
/* END_OF_SYMBOL_DEFINITION _encode_ORAddress */
/* eslint-enable */
//# sourceMappingURL=ORAddress.ta.js.map