pkcs-ts
Version:
PKCS #1 through #15 (Except #11) - Private and Public Keys, Certificates, and More
61 lines • 3.59 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports._encode_WTLSCertificateAttributes = exports._decode_WTLSCertificateAttributes = exports._extension_additions_list_spec_for_WTLSCertificateAttributes = exports._root_component_type_list_2_spec_for_WTLSCertificateAttributes = exports._root_component_type_list_1_spec_for_WTLSCertificateAttributes = exports.WTLSCertificateAttributes = exports._get_encoder_for_ObjectValue = exports._get_decoder_for_ObjectValue = 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 ObjectValue_ta_1 = require("../PKCS-15/ObjectValue.ta");
var ObjectValue_ta_2 = require("../PKCS-15/ObjectValue.ta");
Object.defineProperty(exports, "_get_decoder_for_ObjectValue", { enumerable: true, get: function () { return ObjectValue_ta_2._get_decoder_for_ObjectValue; } });
Object.defineProperty(exports, "_get_encoder_for_ObjectValue", { enumerable: true, get: function () { return ObjectValue_ta_2._get_encoder_for_ObjectValue; } });
class WTLSCertificateAttributes {
constructor(value, _unrecognizedExtensionsList = []) {
this.value = value;
this._unrecognizedExtensionsList = _unrecognizedExtensionsList;
}
static _from_object(_o) {
return new WTLSCertificateAttributes(_o.value, _o._unrecognizedExtensionsList);
}
}
exports.WTLSCertificateAttributes = WTLSCertificateAttributes;
exports._root_component_type_list_1_spec_for_WTLSCertificateAttributes = [
new $.ComponentSpec("value", false, $.hasAnyTag, undefined, undefined),
];
exports._root_component_type_list_2_spec_for_WTLSCertificateAttributes = [];
exports._extension_additions_list_spec_for_WTLSCertificateAttributes = [];
let _cached_decoder_for_WTLSCertificateAttributes = null;
function _decode_WTLSCertificateAttributes(el) {
if (!_cached_decoder_for_WTLSCertificateAttributes) {
_cached_decoder_for_WTLSCertificateAttributes = function (el) {
const sequence = el.sequence;
if (sequence.length < 1) {
throw new asn1_ts_1.ASN1ConstructionError("WTLSCertificateAttributes contained only " +
sequence.length.toString() +
" elements.");
}
sequence[0].name = "value";
let value;
value = ObjectValue_ta_1._get_decoder_for_ObjectValue($._decodeAny)(sequence[0]);
return new WTLSCertificateAttributes(value, sequence.slice(1));
};
}
return _cached_decoder_for_WTLSCertificateAttributes(el);
}
exports._decode_WTLSCertificateAttributes = _decode_WTLSCertificateAttributes;
let _cached_encoder_for_WTLSCertificateAttributes = null;
function _encode_WTLSCertificateAttributes(value, elGetter) {
if (!_cached_encoder_for_WTLSCertificateAttributes) {
_cached_encoder_for_WTLSCertificateAttributes = function (value, elGetter) {
return $._encodeSequence([]
.concat([
ObjectValue_ta_1._get_encoder_for_ObjectValue($._encodeAny)(value.value, $.BER),
], value._unrecognizedExtensionsList
? value._unrecognizedExtensionsList
: [])
.filter((c) => !!c), $.BER);
};
}
return _cached_encoder_for_WTLSCertificateAttributes(value, elGetter);
}
exports._encode_WTLSCertificateAttributes = _encode_WTLSCertificateAttributes;
//# sourceMappingURL=WTLSCertificateAttributes.ta.js.map