pkcs-ts
Version:
PKCS #1 through #15 (Except #11) - Private and Public Keys, Certificates, and More
63 lines • 3.46 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports._encode_OtherKeyAttribute = exports._decode_OtherKeyAttribute = exports._extension_additions_list_spec_for_OtherKeyAttribute = exports._root_component_type_list_2_spec_for_OtherKeyAttribute = exports._root_component_type_list_1_spec_for_OtherKeyAttribute = exports.OtherKeyAttribute = exports.OtherKeyAttributeTable = void 0;
const tslib_1 = require("tslib");
const asn1_ts_1 = require("asn1-ts");
const $ = tslib_1.__importStar(require("asn1-ts/dist/node/functional"));
var OtherKeyAttributeTable_osa_1 = require("../PKCS7/OtherKeyAttributeTable.osa");
Object.defineProperty(exports, "OtherKeyAttributeTable", { enumerable: true, get: function () { return OtherKeyAttributeTable_osa_1.OtherKeyAttributeTable; } });
class OtherKeyAttribute {
constructor(keyAttributeIdentifier, keyAttribute) {
this.keyAttributeIdentifier = keyAttributeIdentifier;
this.keyAttribute = keyAttribute;
}
static _from_object(_o) {
return new OtherKeyAttribute(_o.keyAttributeIdentifier, _o.keyAttribute);
}
}
exports.OtherKeyAttribute = OtherKeyAttribute;
exports._root_component_type_list_1_spec_for_OtherKeyAttribute = [
new $.ComponentSpec("keyAttributeIdentifier", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 6), undefined, undefined),
new $.ComponentSpec("keyAttribute", true, $.hasAnyTag, undefined, undefined),
];
exports._root_component_type_list_2_spec_for_OtherKeyAttribute = [];
exports._extension_additions_list_spec_for_OtherKeyAttribute = [];
let _cached_decoder_for_OtherKeyAttribute = null;
function _decode_OtherKeyAttribute(el) {
if (!_cached_decoder_for_OtherKeyAttribute) {
_cached_decoder_for_OtherKeyAttribute = function (el) {
let keyAttributeIdentifier;
let keyAttribute;
const callbacks = {
keyAttributeIdentifier: (_el) => {
keyAttributeIdentifier = $._decodeObjectIdentifier(_el);
},
keyAttribute: (_el) => {
keyAttribute = $._decodeAny(_el);
},
};
$._parse_sequence(el, callbacks, exports._root_component_type_list_1_spec_for_OtherKeyAttribute, exports._extension_additions_list_spec_for_OtherKeyAttribute, exports._root_component_type_list_2_spec_for_OtherKeyAttribute, undefined);
return new OtherKeyAttribute(keyAttributeIdentifier, keyAttribute);
};
}
return _cached_decoder_for_OtherKeyAttribute(el);
}
exports._decode_OtherKeyAttribute = _decode_OtherKeyAttribute;
let _cached_encoder_for_OtherKeyAttribute = null;
function _encode_OtherKeyAttribute(value, elGetter) {
if (!_cached_encoder_for_OtherKeyAttribute) {
_cached_encoder_for_OtherKeyAttribute = function (value, elGetter) {
return $._encodeSequence([]
.concat([
$._encodeObjectIdentifier(value.keyAttributeIdentifier, $.BER),
value.keyAttribute === undefined
? undefined
: $._encodeAny(value.keyAttribute, $.BER),
])
.filter((c) => !!c), $.BER);
};
}
return _cached_encoder_for_OtherKeyAttribute(value, elGetter);
}
exports._encode_OtherKeyAttribute = _encode_OtherKeyAttribute;
//# sourceMappingURL=OtherKeyAttribute.ta.js.map