pkcs-ts
Version:
PKCS #1 through #15 (Except #11) - Private and Public Keys, Certificates, and More
57 lines • 3.23 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports._encode_CertBasedAuthenticationAttributes = exports._decode_CertBasedAuthenticationAttributes = exports._extension_additions_list_spec_for_CertBasedAuthenticationAttributes = exports._root_component_type_list_2_spec_for_CertBasedAuthenticationAttributes = exports._root_component_type_list_1_spec_for_CertBasedAuthenticationAttributes = exports.CertBasedAuthenticationAttributes = void 0;
const tslib_1 = require("tslib");
const asn1_ts_1 = require("asn1-ts");
const $ = tslib_1.__importStar(require("asn1-ts/dist/node/functional"));
class CertBasedAuthenticationAttributes {
constructor(cha, _unrecognizedExtensionsList = []) {
this.cha = cha;
this._unrecognizedExtensionsList = _unrecognizedExtensionsList;
}
static _from_object(_o) {
return new CertBasedAuthenticationAttributes(_o.cha, _o._unrecognizedExtensionsList);
}
}
exports.CertBasedAuthenticationAttributes = CertBasedAuthenticationAttributes;
exports._root_component_type_list_1_spec_for_CertBasedAuthenticationAttributes = [
new $.ComponentSpec("cha", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 4), undefined, undefined),
];
exports._root_component_type_list_2_spec_for_CertBasedAuthenticationAttributes = [];
exports._extension_additions_list_spec_for_CertBasedAuthenticationAttributes = [];
let _cached_decoder_for_CertBasedAuthenticationAttributes = null;
function _decode_CertBasedAuthenticationAttributes(el) {
if (!_cached_decoder_for_CertBasedAuthenticationAttributes) {
_cached_decoder_for_CertBasedAuthenticationAttributes = function (el) {
const sequence = el.sequence;
if (sequence.length < 1) {
throw new asn1_ts_1.ASN1ConstructionError("CertBasedAuthenticationAttributes contained only " +
sequence.length.toString() +
" elements.");
}
sequence[0].name = "cha";
let cha;
cha = $._decodeOctetString(sequence[0]);
return new CertBasedAuthenticationAttributes(cha, sequence.slice(1));
};
}
return _cached_decoder_for_CertBasedAuthenticationAttributes(el);
}
exports._decode_CertBasedAuthenticationAttributes = _decode_CertBasedAuthenticationAttributes;
let _cached_encoder_for_CertBasedAuthenticationAttributes = null;
function _encode_CertBasedAuthenticationAttributes(value, elGetter) {
if (!_cached_encoder_for_CertBasedAuthenticationAttributes) {
_cached_encoder_for_CertBasedAuthenticationAttributes = function (value, elGetter) {
return $._encodeSequence([]
.concat([
$._encodeOctetString(value.cha, $.BER),
], value._unrecognizedExtensionsList
? value._unrecognizedExtensionsList
: [])
.filter((c) => !!c), $.BER);
};
}
return _cached_encoder_for_CertBasedAuthenticationAttributes(value, elGetter);
}
exports._encode_CertBasedAuthenticationAttributes = _encode_CertBasedAuthenticationAttributes;
//# sourceMappingURL=CertBasedAuthenticationAttributes.ta.js.map