UNPKG

ess-ts

Version:

Enhanced Security Services (ESS) in TypeScript

65 lines 3.57 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports._encode_ContentHints = exports._decode_ContentHints = exports._extension_additions_list_spec_for_ContentHints = exports._root_component_type_list_2_spec_for_ContentHints = exports._root_component_type_list_1_spec_for_ContentHints = exports.ContentHints = exports._encode_ContentType = exports._decode_ContentType = void 0; const tslib_1 = require("tslib"); const asn1_ts_1 = require("asn1-ts"); const $ = tslib_1.__importStar(require("asn1-ts/dist/node/functional")); const ContentType_ta_1 = require("../CryptographicMessageSyntax2004/ContentType.ta"); var ContentType_ta_2 = require("../CryptographicMessageSyntax2004/ContentType.ta"); Object.defineProperty(exports, "_decode_ContentType", { enumerable: true, get: function () { return ContentType_ta_2._decode_ContentType; } }); Object.defineProperty(exports, "_encode_ContentType", { enumerable: true, get: function () { return ContentType_ta_2._encode_ContentType; } }); class ContentHints { constructor(contentDescription, contentType) { this.contentDescription = contentDescription; this.contentType = contentType; } static _from_object(_o) { return new ContentHints(_o.contentDescription, _o.contentType); } } exports.ContentHints = ContentHints; exports._root_component_type_list_1_spec_for_ContentHints = [ new $.ComponentSpec("contentDescription", true, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 12), undefined, undefined), new $.ComponentSpec("contentType", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 6), undefined, undefined), ]; exports._root_component_type_list_2_spec_for_ContentHints = []; exports._extension_additions_list_spec_for_ContentHints = []; let _cached_decoder_for_ContentHints = null; function _decode_ContentHints(el) { if (!_cached_decoder_for_ContentHints) { _cached_decoder_for_ContentHints = function (el) { let contentDescription; let contentType; const callbacks = { contentDescription: (_el) => { contentDescription = $._decodeUTF8String(_el); }, contentType: (_el) => { contentType = ContentType_ta_1._decode_ContentType(_el); }, }; $._parse_sequence(el, callbacks, exports._root_component_type_list_1_spec_for_ContentHints, exports._extension_additions_list_spec_for_ContentHints, exports._root_component_type_list_2_spec_for_ContentHints, undefined); return new ContentHints(contentDescription, contentType); }; } return _cached_decoder_for_ContentHints(el); } exports._decode_ContentHints = _decode_ContentHints; let _cached_encoder_for_ContentHints = null; function _encode_ContentHints(value, elGetter) { if (!_cached_encoder_for_ContentHints) { _cached_encoder_for_ContentHints = function (value, elGetter) { return $._encodeSequence([] .concat([ value.contentDescription === undefined ? undefined : $._encodeUTF8String(value.contentDescription, $.BER), ContentType_ta_1._encode_ContentType(value.contentType, $.BER), ]) .filter((c) => !!c), $.BER); }; } return _cached_encoder_for_ContentHints(value, elGetter); } exports._encode_ContentHints = _encode_ContentHints; //# sourceMappingURL=ContentHints.ta.js.map