pkcs-ts
Version:
PKCS #1 through #15 (Except #11) - Private and Public Keys, Certificates, and More
61 lines • 3.85 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports._encode_CommonAuthenticationObjectAttributes = exports._decode_CommonAuthenticationObjectAttributes = exports._extension_additions_list_spec_for_CommonAuthenticationObjectAttributes = exports._root_component_type_list_2_spec_for_CommonAuthenticationObjectAttributes = exports._root_component_type_list_1_spec_for_CommonAuthenticationObjectAttributes = exports.CommonAuthenticationObjectAttributes = exports._encode_Identifier = exports._decode_Identifier = 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 Identifier_ta_1 = require("../PKCS-15/Identifier.ta");
var Identifier_ta_2 = require("../PKCS-15/Identifier.ta");
Object.defineProperty(exports, "_decode_Identifier", { enumerable: true, get: function () { return Identifier_ta_2._decode_Identifier; } });
Object.defineProperty(exports, "_encode_Identifier", { enumerable: true, get: function () { return Identifier_ta_2._encode_Identifier; } });
class CommonAuthenticationObjectAttributes {
constructor(authId, _unrecognizedExtensionsList = []) {
this.authId = authId;
this._unrecognizedExtensionsList = _unrecognizedExtensionsList;
}
static _from_object(_o) {
return new CommonAuthenticationObjectAttributes(_o.authId, _o._unrecognizedExtensionsList);
}
}
exports.CommonAuthenticationObjectAttributes = CommonAuthenticationObjectAttributes;
exports._root_component_type_list_1_spec_for_CommonAuthenticationObjectAttributes = [
new $.ComponentSpec("authId", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 4), undefined, undefined),
];
exports._root_component_type_list_2_spec_for_CommonAuthenticationObjectAttributes = [];
exports._extension_additions_list_spec_for_CommonAuthenticationObjectAttributes = [];
let _cached_decoder_for_CommonAuthenticationObjectAttributes = null;
function _decode_CommonAuthenticationObjectAttributes(el) {
if (!_cached_decoder_for_CommonAuthenticationObjectAttributes) {
_cached_decoder_for_CommonAuthenticationObjectAttributes = function (el) {
const sequence = el.sequence;
if (sequence.length < 1) {
throw new asn1_ts_1.ASN1ConstructionError("CommonAuthenticationObjectAttributes contained only " +
sequence.length.toString() +
" elements.");
}
sequence[0].name = "authId";
let authId;
authId = Identifier_ta_1._decode_Identifier(sequence[0]);
return new CommonAuthenticationObjectAttributes(authId, sequence.slice(1));
};
}
return _cached_decoder_for_CommonAuthenticationObjectAttributes(el);
}
exports._decode_CommonAuthenticationObjectAttributes = _decode_CommonAuthenticationObjectAttributes;
let _cached_encoder_for_CommonAuthenticationObjectAttributes = null;
function _encode_CommonAuthenticationObjectAttributes(value, elGetter) {
if (!_cached_encoder_for_CommonAuthenticationObjectAttributes) {
_cached_encoder_for_CommonAuthenticationObjectAttributes = function (value, elGetter) {
return $._encodeSequence([]
.concat([
Identifier_ta_1._encode_Identifier(value.authId, $.BER),
], value._unrecognizedExtensionsList
? value._unrecognizedExtensionsList
: [])
.filter((c) => !!c), $.BER);
};
}
return _cached_encoder_for_CommonAuthenticationObjectAttributes(value, elGetter);
}
exports._encode_CommonAuthenticationObjectAttributes = _encode_CommonAuthenticationObjectAttributes;
//# sourceMappingURL=CommonAuthenticationObjectAttributes.ta.js.map