@wildboar/pki-stub
Version:
X.510 PKI-Stub ASN.1 data structures in TypeScript
143 lines • 6.12 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports._encode_Attribute_valuesWithContext_Item = exports._decode_Attribute_valuesWithContext_Item = exports._extension_additions_list_spec_for_Attribute_valuesWithContext_Item = exports._root_component_type_list_2_spec_for_Attribute_valuesWithContext_Item = exports._root_component_type_list_1_spec_for_Attribute_valuesWithContext_Item = exports.Attribute_valuesWithContext_Item = void 0;
/* eslint-disable */
const asn1_ts_1 = require("asn1-ts");
const $ = require("asn1-ts/dist/node/functional");
const Context_ta_1 = require("../InformationFramework/Context.ta");
/* START_OF_SYMBOL_DEFINITION Attribute_valuesWithContext_Item */
/**
* @summary Attribute_valuesWithContext_Item
* @description
*
* ### ASN.1 Definition:
*
* ```asn1
* Attribute-valuesWithContext-Item ::= SEQUENCE { -- REMOVED_FROM_UNNESTING -- }
* ```
*
* @class
*/
class Attribute_valuesWithContext_Item {
constructor(
/**
* @summary `value`.
* @public
* @readonly
*/
value,
/**
* @summary `contextList`.
* @public
* @readonly
*/
contextList,
/**
* @summary Extensions that are not recognized.
* @public
* @readonly
*/
_unrecognizedExtensionsList = []) {
this.value = value;
this.contextList = contextList;
this._unrecognizedExtensionsList = _unrecognizedExtensionsList;
}
/**
* @summary Restructures an object into a Attribute_valuesWithContext_Item
* @description
*
* This takes an `object` and converts it to a `Attribute_valuesWithContext_Item`.
*
* @public
* @static
* @method
* @param {Object} _o An object having all of the keys and values of a `Attribute_valuesWithContext_Item`.
* @returns {Attribute_valuesWithContext_Item}
*/
static _from_object(_o) {
return new Attribute_valuesWithContext_Item(_o.value, _o.contextList, _o._unrecognizedExtensionsList);
}
}
exports.Attribute_valuesWithContext_Item = Attribute_valuesWithContext_Item;
/* END_OF_SYMBOL_DEFINITION Attribute_valuesWithContext_Item */
/* START_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_Attribute_valuesWithContext_Item */
/**
* @summary The Leading Root Component Types of Attribute_valuesWithContext_Item
* @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_Attribute_valuesWithContext_Item = [
new $.ComponentSpec("value", false, $.hasAnyTag, undefined, undefined),
new $.ComponentSpec("contextList", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 17), undefined, undefined),
];
/* END_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_Attribute_valuesWithContext_Item */
/* START_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_Attribute_valuesWithContext_Item */
/**
* @summary The Trailing Root Component Types of Attribute_valuesWithContext_Item
* @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_Attribute_valuesWithContext_Item = [];
/* END_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_Attribute_valuesWithContext_Item */
/* START_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_Attribute_valuesWithContext_Item */
/**
* @summary The Extension Addition Component Types of Attribute_valuesWithContext_Item
* @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_Attribute_valuesWithContext_Item = [];
/* END_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_Attribute_valuesWithContext_Item */
/* START_OF_SYMBOL_DEFINITION _decode_Attribute_valuesWithContext_Item */
/**
* @summary Decodes an ASN.1 element into a(n) Attribute_valuesWithContext_Item
* @function
* @param {_Element} el The element being decoded.
* @returns {Attribute_valuesWithContext_Item} The decoded data structure.
*/
function _decode_Attribute_valuesWithContext_Item(el) {
const sequence = el.sequence;
if (sequence.length < 2) {
throw new asn1_ts_1.ASN1ConstructionError("Attribute-valuesWithContext-Item contained only " +
sequence.length.toString() +
" elements.");
}
sequence[0].name = "value";
sequence[1].name = "contextList";
let value;
let contextList;
value = $._decodeAny(sequence[0]);
contextList = $._decodeSetOf(() => Context_ta_1._decode_Context)(sequence[1]);
return new Attribute_valuesWithContext_Item(value, contextList, sequence.slice(2));
}
exports._decode_Attribute_valuesWithContext_Item = _decode_Attribute_valuesWithContext_Item;
/* END_OF_SYMBOL_DEFINITION _decode_Attribute_valuesWithContext_Item */
/* START_OF_SYMBOL_DEFINITION _encode_Attribute_valuesWithContext_Item */
/**
* @summary Encodes a(n) Attribute_valuesWithContext_Item 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 Attribute_valuesWithContext_Item, encoded as an ASN.1 Element.
*/
function _encode_Attribute_valuesWithContext_Item(value, elGetter) {
var _a;
const components = [
/* REQUIRED */ $._encodeAny(value.value, $.BER),
/* REQUIRED */ $._encodeSetOf(() => Context_ta_1._encode_Context, $.BER)(value.contextList, $.BER),
...(_a = value._unrecognizedExtensionsList) !== null && _a !== void 0 ? _a : [],
];
return $._encodeSequence(components, $.BER);
}
exports._encode_Attribute_valuesWithContext_Item = _encode_Attribute_valuesWithContext_Item;
/* END_OF_SYMBOL_DEFINITION _encode_Attribute_valuesWithContext_Item */
/* eslint-enable */
//# sourceMappingURL=Attribute-valuesWithContext-Item.ta.js.map