UNPKG

ess-ts

Version:

Enhanced Security Services (ESS) in TypeScript

74 lines 4.79 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports._encode_ContentReference = exports._decode_ContentReference = exports._extension_additions_list_spec_for_ContentReference = exports._root_component_type_list_2_spec_for_ContentReference = exports._root_component_type_list_1_spec_for_ContentReference = exports.ContentReference = exports._encode_ContentIdentifier = exports._decode_ContentIdentifier = 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"); const ContentIdentifier_ta_1 = require("../ExtendedSecurityServices-2006/ContentIdentifier.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; } }); var ContentIdentifier_ta_2 = require("../ExtendedSecurityServices-2006/ContentIdentifier.ta"); Object.defineProperty(exports, "_decode_ContentIdentifier", { enumerable: true, get: function () { return ContentIdentifier_ta_2._decode_ContentIdentifier; } }); Object.defineProperty(exports, "_encode_ContentIdentifier", { enumerable: true, get: function () { return ContentIdentifier_ta_2._encode_ContentIdentifier; } }); class ContentReference { constructor(contentType, signedContentIdentifier, originatorSignatureValue) { this.contentType = contentType; this.signedContentIdentifier = signedContentIdentifier; this.originatorSignatureValue = originatorSignatureValue; } static _from_object(_o) { return new ContentReference(_o.contentType, _o.signedContentIdentifier, _o.originatorSignatureValue); } } exports.ContentReference = ContentReference; exports._root_component_type_list_1_spec_for_ContentReference = [ new $.ComponentSpec("contentType", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 6), undefined, undefined), new $.ComponentSpec("signedContentIdentifier", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 4), undefined, undefined), new $.ComponentSpec("originatorSignatureValue", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 4), undefined, undefined), ]; exports._root_component_type_list_2_spec_for_ContentReference = []; exports._extension_additions_list_spec_for_ContentReference = []; let _cached_decoder_for_ContentReference = null; function _decode_ContentReference(el) { if (!_cached_decoder_for_ContentReference) { _cached_decoder_for_ContentReference = function (el) { const sequence = el.sequence; if (sequence.length < 3) { throw new asn1_ts_1.ASN1ConstructionError("ContentReference contained only " + sequence.length.toString() + " elements."); } sequence[0].name = "contentType"; sequence[1].name = "signedContentIdentifier"; sequence[2].name = "originatorSignatureValue"; let contentType; let signedContentIdentifier; let originatorSignatureValue; contentType = ContentType_ta_1._decode_ContentType(sequence[0]); signedContentIdentifier = ContentIdentifier_ta_1._decode_ContentIdentifier(sequence[1]); originatorSignatureValue = $._decodeOctetString(sequence[2]); return new ContentReference(contentType, signedContentIdentifier, originatorSignatureValue); }; } return _cached_decoder_for_ContentReference(el); } exports._decode_ContentReference = _decode_ContentReference; let _cached_encoder_for_ContentReference = null; function _encode_ContentReference(value, elGetter) { if (!_cached_encoder_for_ContentReference) { _cached_encoder_for_ContentReference = function (value, elGetter) { return $._encodeSequence([] .concat([ ContentType_ta_1._encode_ContentType(value.contentType, $.BER), ContentIdentifier_ta_1._encode_ContentIdentifier(value.signedContentIdentifier, $.BER), $._encodeOctetString(value.originatorSignatureValue, $.BER), ]) .filter((c) => !!c), $.BER); }; } return _cached_encoder_for_ContentReference(value, elGetter); } exports._encode_ContentReference = _encode_ContentReference; //# sourceMappingURL=ContentReference.ta.js.map