@wildboar/pki-stub
Version:
X.510 PKI-Stub ASN.1 data structures in TypeScript
155 lines • 6.11 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports._encode_EDIPartyName = exports._decode_EDIPartyName = exports._extension_additions_list_spec_for_EDIPartyName = exports._root_component_type_list_2_spec_for_EDIPartyName = exports._root_component_type_list_1_spec_for_EDIPartyName = exports.EDIPartyName = void 0;
/* eslint-disable */
const asn1_ts_1 = require("asn1-ts");
const $ = require("asn1-ts/dist/node/functional");
const UnboundedDirectoryString_ta_1 = require("../SelectedAttributeTypes/UnboundedDirectoryString.ta");
/* START_OF_SYMBOL_DEFINITION EDIPartyName */
/**
* @summary EDIPartyName
* @description
*
* ### ASN.1 Definition:
*
* ```asn1
* EDIPartyName ::= SEQUENCE {
* nameAssigner [0] UnboundedDirectoryString OPTIONAL,
* partyName [1] UnboundedDirectoryString,
* ... }
* ```
*
* @class
*/
class EDIPartyName {
constructor(
/**
* @summary `nameAssigner`.
* @public
* @readonly
*/
nameAssigner,
/**
* @summary `partyName`.
* @public
* @readonly
*/
partyName,
/**
* @summary Extensions that are not recognized.
* @public
* @readonly
*/
_unrecognizedExtensionsList = []) {
this.nameAssigner = nameAssigner;
this.partyName = partyName;
this._unrecognizedExtensionsList = _unrecognizedExtensionsList;
}
/**
* @summary Restructures an object into a EDIPartyName
* @description
*
* This takes an `object` and converts it to a `EDIPartyName`.
*
* @public
* @static
* @method
* @param {Object} _o An object having all of the keys and values of a `EDIPartyName`.
* @returns {EDIPartyName}
*/
static _from_object(_o) {
return new EDIPartyName(_o.nameAssigner, _o.partyName, _o._unrecognizedExtensionsList);
}
}
exports.EDIPartyName = EDIPartyName;
/* END_OF_SYMBOL_DEFINITION EDIPartyName */
/* START_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_EDIPartyName */
/**
* @summary The Leading Root Component Types of EDIPartyName
* @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_EDIPartyName = [
new $.ComponentSpec("nameAssigner", true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 0), undefined, undefined),
new $.ComponentSpec("partyName", false, $.hasTag(asn1_ts_1.ASN1TagClass.context, 1), undefined, undefined),
];
/* END_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_EDIPartyName */
/* START_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_EDIPartyName */
/**
* @summary The Trailing Root Component Types of EDIPartyName
* @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_EDIPartyName = [];
/* END_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_EDIPartyName */
/* START_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_EDIPartyName */
/**
* @summary The Extension Addition Component Types of EDIPartyName
* @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_EDIPartyName = [];
/* END_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_EDIPartyName */
/* START_OF_SYMBOL_DEFINITION _decode_EDIPartyName */
/**
* @summary Decodes an ASN.1 element into a(n) EDIPartyName
* @function
* @param {_Element} el The element being decoded.
* @returns {EDIPartyName} The decoded data structure.
*/
function _decode_EDIPartyName(el) {
/* START_OF_SEQUENCE_COMPONENT_DECLARATIONS */
let nameAssigner;
let partyName;
let _unrecognizedExtensionsList = [];
/* END_OF_SEQUENCE_COMPONENT_DECLARATIONS */
/* START_OF_CALLBACKS_MAP */
const callbacks = {
nameAssigner: (_el) => {
nameAssigner = $._decode_explicit(() => UnboundedDirectoryString_ta_1._decode_UnboundedDirectoryString)(_el);
},
partyName: (_el) => {
partyName = $._decode_explicit(() => UnboundedDirectoryString_ta_1._decode_UnboundedDirectoryString)(_el);
},
};
/* END_OF_CALLBACKS_MAP */
$._parse_sequence(el, callbacks, exports._root_component_type_list_1_spec_for_EDIPartyName, exports._extension_additions_list_spec_for_EDIPartyName, exports._root_component_type_list_2_spec_for_EDIPartyName, (ext) => {
_unrecognizedExtensionsList.push(ext);
});
return new EDIPartyName(
/* SEQUENCE_CONSTRUCTOR_CALL */ nameAssigner, partyName, _unrecognizedExtensionsList);
}
exports._decode_EDIPartyName = _decode_EDIPartyName;
/* END_OF_SYMBOL_DEFINITION _decode_EDIPartyName */
/* START_OF_SYMBOL_DEFINITION _encode_EDIPartyName */
/**
* @summary Encodes a(n) EDIPartyName 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 EDIPartyName, encoded as an ASN.1 Element.
*/
function _encode_EDIPartyName(value, elGetter) {
var _a;
const components = [
/* IF_ABSENT */ value.nameAssigner === undefined
? undefined
: $._encode_explicit(asn1_ts_1.ASN1TagClass.context, 0, () => UnboundedDirectoryString_ta_1._encode_UnboundedDirectoryString, $.BER)(value.nameAssigner, $.BER),
/* REQUIRED */ $._encode_explicit(asn1_ts_1.ASN1TagClass.context, 1, () => UnboundedDirectoryString_ta_1._encode_UnboundedDirectoryString, $.BER)(value.partyName, $.BER),
...(_a = value._unrecognizedExtensionsList) !== null && _a !== void 0 ? _a : [],
];
return $._encodeSequence(components, $.BER);
}
exports._encode_EDIPartyName = _encode_EDIPartyName;
/* END_OF_SYMBOL_DEFINITION _encode_EDIPartyName */
/* eslint-enable */
//# sourceMappingURL=EDIPartyName.ta.js.map