@wildboar/pki-stub
Version:
X.510 PKI-Stub ASN.1 data structures in TypeScript
151 lines • 6.09 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports._encode_AttCertValidityPeriod = exports._decode_AttCertValidityPeriod = exports._extension_additions_list_spec_for_AttCertValidityPeriod = exports._root_component_type_list_2_spec_for_AttCertValidityPeriod = exports._root_component_type_list_1_spec_for_AttCertValidityPeriod = exports.AttCertValidityPeriod = void 0;
/* eslint-disable */
const asn1_ts_1 = require("asn1-ts");
const $ = require("asn1-ts/dist/node/functional");
/* START_OF_SYMBOL_DEFINITION AttCertValidityPeriod */
/**
* @summary AttCertValidityPeriod
* @description
*
* ### ASN.1 Definition:
*
* ```asn1
* AttCertValidityPeriod ::= SEQUENCE {
* notBeforeTime GeneralizedTime,
* notAfterTime GeneralizedTime,
* ... }
* ```
*
* @class
*/
class AttCertValidityPeriod {
constructor(
/**
* @summary `notBeforeTime`.
* @public
* @readonly
*/
notBeforeTime,
/**
* @summary `notAfterTime`.
* @public
* @readonly
*/
notAfterTime,
/**
* @summary Extensions that are not recognized.
* @public
* @readonly
*/
_unrecognizedExtensionsList = []) {
this.notBeforeTime = notBeforeTime;
this.notAfterTime = notAfterTime;
this._unrecognizedExtensionsList = _unrecognizedExtensionsList;
}
/**
* @summary Restructures an object into a AttCertValidityPeriod
* @description
*
* This takes an `object` and converts it to a `AttCertValidityPeriod`.
*
* @public
* @static
* @method
* @param {Object} _o An object having all of the keys and values of a `AttCertValidityPeriod`.
* @returns {AttCertValidityPeriod}
*/
static _from_object(_o) {
return new AttCertValidityPeriod(_o.notBeforeTime, _o.notAfterTime, _o._unrecognizedExtensionsList);
}
}
exports.AttCertValidityPeriod = AttCertValidityPeriod;
/* END_OF_SYMBOL_DEFINITION AttCertValidityPeriod */
/* START_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_AttCertValidityPeriod */
/**
* @summary The Leading Root Component Types of AttCertValidityPeriod
* @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_AttCertValidityPeriod = [
new $.ComponentSpec("notBeforeTime", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 24), undefined, undefined),
new $.ComponentSpec("notAfterTime", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 24), undefined, undefined),
];
/* END_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_AttCertValidityPeriod */
/* START_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_AttCertValidityPeriod */
/**
* @summary The Trailing Root Component Types of AttCertValidityPeriod
* @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_AttCertValidityPeriod = [];
/* END_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_AttCertValidityPeriod */
/* START_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_AttCertValidityPeriod */
/**
* @summary The Extension Addition Component Types of AttCertValidityPeriod
* @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_AttCertValidityPeriod = [];
/* END_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_AttCertValidityPeriod */
/* START_OF_SYMBOL_DEFINITION _cached_decoder_for_AttCertValidityPeriod */
let _cached_decoder_for_AttCertValidityPeriod = null;
/* END_OF_SYMBOL_DEFINITION _cached_decoder_for_AttCertValidityPeriod */
/* START_OF_SYMBOL_DEFINITION _decode_AttCertValidityPeriod */
/**
* @summary Decodes an ASN.1 element into a(n) AttCertValidityPeriod
* @function
* @param {_Element} el The element being decoded.
* @returns {AttCertValidityPeriod} The decoded data structure.
*/
function _decode_AttCertValidityPeriod(el) {
const sequence = el.sequence;
if (sequence.length < 2) {
throw new asn1_ts_1.ASN1ConstructionError("AttCertValidityPeriod contained only " +
sequence.length.toString() +
" elements.");
}
sequence[0].name = "notBeforeTime";
sequence[1].name = "notAfterTime";
let notBeforeTime;
let notAfterTime;
notBeforeTime = $._decodeGeneralizedTime(sequence[0]);
notAfterTime = $._decodeGeneralizedTime(sequence[1]);
return new AttCertValidityPeriod(notBeforeTime, notAfterTime, sequence.slice(2));
}
exports._decode_AttCertValidityPeriod = _decode_AttCertValidityPeriod;
/* END_OF_SYMBOL_DEFINITION _decode_AttCertValidityPeriod */
/* START_OF_SYMBOL_DEFINITION _cached_encoder_for_AttCertValidityPeriod */
let _cached_encoder_for_AttCertValidityPeriod = null;
/* END_OF_SYMBOL_DEFINITION _cached_encoder_for_AttCertValidityPeriod */
/* START_OF_SYMBOL_DEFINITION _encode_AttCertValidityPeriod */
/**
* @summary Encodes a(n) AttCertValidityPeriod 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 AttCertValidityPeriod, encoded as an ASN.1 Element.
*/
function _encode_AttCertValidityPeriod(value, elGetter) {
var _a;
const components = [
/* REQUIRED */ $._encodeGeneralizedTime(value.notBeforeTime, $.BER),
/* REQUIRED */ $._encodeGeneralizedTime(value.notAfterTime, $.BER),
...(_a = value._unrecognizedExtensionsList) !== null && _a !== void 0 ? _a : [],
];
return $._encodeSequence(components, $.BER);
}
exports._encode_AttCertValidityPeriod = _encode_AttCertValidityPeriod;
/* END_OF_SYMBOL_DEFINITION _encode_AttCertValidityPeriod */
/* eslint-enable */
//# sourceMappingURL=AttCertValidityPeriod.ta.js.map