@wildboar/pki-stub
Version:
X.510 PKI-Stub ASN.1 data structures in TypeScript
191 lines • 7.67 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports._encode_PresentationAddress = exports._decode_PresentationAddress = exports._extension_additions_list_spec_for_PresentationAddress = exports._root_component_type_list_2_spec_for_PresentationAddress = exports._root_component_type_list_1_spec_for_PresentationAddress = exports.PresentationAddress = void 0;
/* eslint-disable */
const asn1_ts_1 = require("asn1-ts");
const $ = require("asn1-ts/dist/node/functional");
/* START_OF_SYMBOL_DEFINITION PresentationAddress */
/**
* @summary PresentationAddress
* @description
*
* ### ASN.1 Definition:
*
* ```asn1
* PresentationAddress ::= SEQUENCE {
* pSelector [0] OCTET STRING OPTIONAL,
* sSelector [1] OCTET STRING OPTIONAL,
* tSelector [2] OCTET STRING OPTIONAL,
* nAddresses [3] SET SIZE (1..MAX) OF OCTET STRING,
* ... }
* ```
*
* @class
*/
class PresentationAddress {
constructor(
/**
* @summary `pSelector`.
* @public
* @readonly
*/
pSelector,
/**
* @summary `sSelector`.
* @public
* @readonly
*/
sSelector,
/**
* @summary `tSelector`.
* @public
* @readonly
*/
tSelector,
/**
* @summary `nAddresses`.
* @public
* @readonly
*/
nAddresses,
/**
* @summary Extensions that are not recognized.
* @public
* @readonly
*/
_unrecognizedExtensionsList = []) {
this.pSelector = pSelector;
this.sSelector = sSelector;
this.tSelector = tSelector;
this.nAddresses = nAddresses;
this._unrecognizedExtensionsList = _unrecognizedExtensionsList;
}
/**
* @summary Restructures an object into a PresentationAddress
* @description
*
* This takes an `object` and converts it to a `PresentationAddress`.
*
* @public
* @static
* @method
* @param {Object} _o An object having all of the keys and values of a `PresentationAddress`.
* @returns {PresentationAddress}
*/
static _from_object(_o) {
return new PresentationAddress(_o.pSelector, _o.sSelector, _o.tSelector, _o.nAddresses, _o._unrecognizedExtensionsList);
}
}
exports.PresentationAddress = PresentationAddress;
/* END_OF_SYMBOL_DEFINITION PresentationAddress */
/* START_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_PresentationAddress */
/**
* @summary The Leading Root Component Types of PresentationAddress
* @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_PresentationAddress = [
new $.ComponentSpec("pSelector", true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 0), undefined, undefined),
new $.ComponentSpec("sSelector", true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 1), undefined, undefined),
new $.ComponentSpec("tSelector", true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 2), undefined, undefined),
new $.ComponentSpec("nAddresses", false, $.hasTag(asn1_ts_1.ASN1TagClass.context, 3), undefined, undefined),
];
/* END_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_PresentationAddress */
/* START_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_PresentationAddress */
/**
* @summary The Trailing Root Component Types of PresentationAddress
* @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_PresentationAddress = [];
/* END_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_PresentationAddress */
/* START_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_PresentationAddress */
/**
* @summary The Extension Addition Component Types of PresentationAddress
* @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_PresentationAddress = [];
/* END_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_PresentationAddress */
/* START_OF_SYMBOL_DEFINITION _cached_decoder_for_PresentationAddress */
let _cached_decoder_for_PresentationAddress = null;
/* END_OF_SYMBOL_DEFINITION _cached_decoder_for_PresentationAddress */
/* START_OF_SYMBOL_DEFINITION _decode_PresentationAddress */
/**
* @summary Decodes an ASN.1 element into a(n) PresentationAddress
* @function
* @param {_Element} el The element being decoded.
* @returns {PresentationAddress} The decoded data structure.
*/
function _decode_PresentationAddress(el) {
/* START_OF_SEQUENCE_COMPONENT_DECLARATIONS */
let pSelector;
let sSelector;
let tSelector;
let nAddresses;
let _unrecognizedExtensionsList = [];
/* END_OF_SEQUENCE_COMPONENT_DECLARATIONS */
/* START_OF_CALLBACKS_MAP */
const callbacks = {
pSelector: (_el) => {
pSelector = $._decode_explicit(() => $._decodeOctetString)(_el);
},
sSelector: (_el) => {
sSelector = $._decode_explicit(() => $._decodeOctetString)(_el);
},
tSelector: (_el) => {
tSelector = $._decode_explicit(() => $._decodeOctetString)(_el);
},
nAddresses: (_el) => {
nAddresses = $._decode_explicit(() => $._decodeSetOf(() => $._decodeOctetString))(_el);
},
};
/* END_OF_CALLBACKS_MAP */
$._parse_sequence(el, callbacks, exports._root_component_type_list_1_spec_for_PresentationAddress, exports._extension_additions_list_spec_for_PresentationAddress, exports._root_component_type_list_2_spec_for_PresentationAddress, (ext) => {
_unrecognizedExtensionsList.push(ext);
});
return new PresentationAddress(
/* SEQUENCE_CONSTRUCTOR_CALL */ pSelector, sSelector, tSelector, nAddresses, _unrecognizedExtensionsList);
}
exports._decode_PresentationAddress = _decode_PresentationAddress;
/* END_OF_SYMBOL_DEFINITION _decode_PresentationAddress */
/* START_OF_SYMBOL_DEFINITION _encode_PresentationAddress */
/**
* @summary Encodes a(n) PresentationAddress 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 PresentationAddress, encoded as an ASN.1 Element.
*/
function _encode_PresentationAddress(value, elGetter) {
var _a;
const components = [];
if (value.pSelector) {
const c = $._encode_explicit(asn1_ts_1.ASN1TagClass.context, 0, () => $._encodeOctetString, $.BER)(value.pSelector, $.BER);
components.push(c);
}
if (value.sSelector) {
const c = $._encode_explicit(asn1_ts_1.ASN1TagClass.context, 1, () => $._encodeOctetString, $.BER)(value.sSelector, $.BER);
components.push(c);
}
if (value.tSelector) {
const c = $._encode_explicit(asn1_ts_1.ASN1TagClass.context, 2, () => $._encodeOctetString, $.BER)(value.tSelector, $.BER);
components.push(c);
}
components.push($._encode_explicit(asn1_ts_1.ASN1TagClass.context, 3, () => $._encodeSetOf(() => $._encodeOctetString, $.BER), $.BER)(value.nAddresses, $.BER));
components.push(...(_a = value._unrecognizedExtensionsList) !== null && _a !== void 0 ? _a : []);
return $._encodeSequence(components, $.BER);
}
exports._encode_PresentationAddress = _encode_PresentationAddress;
/* END_OF_SYMBOL_DEFINITION _encode_PresentationAddress */
/* eslint-enable */
//# sourceMappingURL=PresentationAddress.ta.js.map