@wildboar/pkcs
Version:
Public Key Cryptography Standard PDUs in TypeScript
273 lines • 14.7 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports._encode_BiometricAttributes = exports._decode_BiometricAttributes = exports._extension_additions_list_spec_for_BiometricAttributes = exports._root_component_type_list_2_spec_for_BiometricAttributes = exports._root_component_type_list_1_spec_for_BiometricAttributes = exports.BiometricAttributes = exports._encode_Reference = exports._decode_Reference = exports._encode_Path = exports._decode_Path = exports.Path = exports._encode_BiometricType = exports._decode_BiometricType = exports._encode_BiometricFlags = exports._decode_BiometricFlags = exports.unblock_disabled = exports.local = exports.integrity_protected = exports.initialized = exports.disable_allowed = exports.confidentiality_protected = exports.change_disabled = exports.BiometricFlags_unblock_disabled = exports.BiometricFlags_local = exports.BiometricFlags_integrity_protected = exports.BiometricFlags_initialized = exports.BiometricFlags_disable_allowed = exports.BiometricFlags_confidentiality_protected = exports.BiometricFlags_change_disabled = void 0;
/* eslint-disable */
const asn1_ts_1 = require("asn1-ts");
const $ = require("asn1-ts/dist/node/functional");
const BiometricFlags_ta_1 = require("../PKCS-15/BiometricFlags.ta");
const BiometricType_ta_1 = require("../PKCS-15/BiometricType.ta");
const Path_ta_1 = require("../PKCS-15/Path.ta");
const Reference_ta_1 = require("../PKCS-15/Reference.ta");
var BiometricFlags_ta_2 = require("../PKCS-15/BiometricFlags.ta");
Object.defineProperty(exports, "BiometricFlags_change_disabled", { enumerable: true, get: function () { return BiometricFlags_ta_2.BiometricFlags_change_disabled; } }); /* IMPORTED_LONG_NAMED_BIT */
Object.defineProperty(exports, "BiometricFlags_confidentiality_protected", { enumerable: true, get: function () { return BiometricFlags_ta_2.BiometricFlags_confidentiality_protected; } }); /* IMPORTED_LONG_NAMED_BIT */
Object.defineProperty(exports, "BiometricFlags_disable_allowed", { enumerable: true, get: function () { return BiometricFlags_ta_2.BiometricFlags_disable_allowed; } }); /* IMPORTED_LONG_NAMED_BIT */
Object.defineProperty(exports, "BiometricFlags_initialized", { enumerable: true, get: function () { return BiometricFlags_ta_2.BiometricFlags_initialized; } }); /* IMPORTED_LONG_NAMED_BIT */
Object.defineProperty(exports, "BiometricFlags_integrity_protected", { enumerable: true, get: function () { return BiometricFlags_ta_2.BiometricFlags_integrity_protected; } }); /* IMPORTED_LONG_NAMED_BIT */
Object.defineProperty(exports, "BiometricFlags_local", { enumerable: true, get: function () { return BiometricFlags_ta_2.BiometricFlags_local; } }); /* IMPORTED_LONG_NAMED_BIT */
Object.defineProperty(exports, "BiometricFlags_unblock_disabled", { enumerable: true, get: function () { return BiometricFlags_ta_2.BiometricFlags_unblock_disabled; } }); /* IMPORTED_LONG_NAMED_BIT */
Object.defineProperty(exports, "change_disabled", { enumerable: true, get: function () { return BiometricFlags_ta_2.change_disabled; } }); /* IMPORTED_SHORT_NAMED_BIT */
Object.defineProperty(exports, "confidentiality_protected", { enumerable: true, get: function () { return BiometricFlags_ta_2.confidentiality_protected; } }); /* IMPORTED_SHORT_NAMED_BIT */
Object.defineProperty(exports, "disable_allowed", { enumerable: true, get: function () { return BiometricFlags_ta_2.disable_allowed; } }); /* IMPORTED_SHORT_NAMED_BIT */
Object.defineProperty(exports, "initialized", { enumerable: true, get: function () { return BiometricFlags_ta_2.initialized; } }); /* IMPORTED_SHORT_NAMED_BIT */
Object.defineProperty(exports, "integrity_protected", { enumerable: true, get: function () { return BiometricFlags_ta_2.integrity_protected; } }); /* IMPORTED_SHORT_NAMED_BIT */
Object.defineProperty(exports, "local", { enumerable: true, get: function () { return BiometricFlags_ta_2.local; } }); /* IMPORTED_SHORT_NAMED_BIT */
Object.defineProperty(exports, "unblock_disabled", { enumerable: true, get: function () { return BiometricFlags_ta_2.unblock_disabled; } }); /* IMPORTED_SHORT_NAMED_BIT */
Object.defineProperty(exports, "_decode_BiometricFlags", { enumerable: true, get: function () { return BiometricFlags_ta_2._decode_BiometricFlags; } });
Object.defineProperty(exports, "_encode_BiometricFlags", { enumerable: true, get: function () { return BiometricFlags_ta_2._encode_BiometricFlags; } });
var BiometricType_ta_2 = require("../PKCS-15/BiometricType.ta");
Object.defineProperty(exports, "_decode_BiometricType", { enumerable: true, get: function () { return BiometricType_ta_2._decode_BiometricType; } });
Object.defineProperty(exports, "_encode_BiometricType", { enumerable: true, get: function () { return BiometricType_ta_2._encode_BiometricType; } });
var Path_ta_2 = require("../PKCS-15/Path.ta");
Object.defineProperty(exports, "Path", { enumerable: true, get: function () { return Path_ta_2.Path; } });
Object.defineProperty(exports, "_decode_Path", { enumerable: true, get: function () { return Path_ta_2._decode_Path; } });
Object.defineProperty(exports, "_encode_Path", { enumerable: true, get: function () { return Path_ta_2._encode_Path; } });
var Reference_ta_2 = require("../PKCS-15/Reference.ta");
Object.defineProperty(exports, "_decode_Reference", { enumerable: true, get: function () { return Reference_ta_2._decode_Reference; } });
Object.defineProperty(exports, "_encode_Reference", { enumerable: true, get: function () { return Reference_ta_2._encode_Reference; } });
/* START_OF_SYMBOL_DEFINITION BiometricAttributes */
/**
* @summary BiometricAttributes
* @description
*
* ### ASN.1 Definition:
*
* ```asn1
* BiometricAttributes ::= SEQUENCE {
* bioFlags BiometricFlags,
* templateId OBJECT IDENTIFIER,
* bioType BiometricType,
* bioReference Reference DEFAULT 0,
* lastChange GeneralizedTime OPTIONAL,
* path Path OPTIONAL,
* ... -- For future extensions
* }
* ```
*
* @class
*/
class BiometricAttributes {
constructor(
/**
* @summary `bioFlags`.
* @public
* @readonly
*/
bioFlags,
/**
* @summary `templateId`.
* @public
* @readonly
*/
templateId,
/**
* @summary `bioType`.
* @public
* @readonly
*/
bioType,
/**
* @summary `bioReference`.
* @public
* @readonly
*/
bioReference,
/**
* @summary `lastChange`.
* @public
* @readonly
*/
lastChange,
/**
* @summary `path`.
* @public
* @readonly
*/
path,
/**
* @summary Extensions that are not recognized.
* @public
* @readonly
*/
_unrecognizedExtensionsList = []) {
this.bioFlags = bioFlags;
this.templateId = templateId;
this.bioType = bioType;
this.bioReference = bioReference;
this.lastChange = lastChange;
this.path = path;
this._unrecognizedExtensionsList = _unrecognizedExtensionsList;
}
/**
* @summary Restructures an object into a BiometricAttributes
* @description
*
* This takes an `object` and converts it to a `BiometricAttributes`.
*
* @public
* @static
* @method
* @param {Object} _o An object having all of the keys and values of a `BiometricAttributes`.
* @returns {BiometricAttributes}
*/
static _from_object(_o) {
return new BiometricAttributes(_o.bioFlags, _o.templateId, _o.bioType, _o.bioReference, _o.lastChange, _o.path, _o._unrecognizedExtensionsList);
}
/**
* @summary Getter that returns the default value for `bioReference`.
* @public
* @static
* @method
*/
static get _default_value_for_bioReference() {
return 0;
}
}
exports.BiometricAttributes = BiometricAttributes;
/* END_OF_SYMBOL_DEFINITION BiometricAttributes */
/* START_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_BiometricAttributes */
/**
* @summary The Leading Root Component Types of BiometricAttributes
* @description
*
* This is an array of `ComponentSpec`s that define how to decode the leading root component type list of a SET or SEQUENCE.
*
* @constant
*/
exports._root_component_type_list_1_spec_for_BiometricAttributes = [
new $.ComponentSpec("bioFlags", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 3), undefined, undefined),
new $.ComponentSpec("templateId", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 6), undefined, undefined),
new $.ComponentSpec("bioType", false, $.hasAnyTag, undefined, undefined),
new $.ComponentSpec("bioReference", true, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 2), undefined, undefined),
new $.ComponentSpec("lastChange", true, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 24), undefined, undefined),
new $.ComponentSpec("path", true, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 16), undefined, undefined),
];
/* END_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_BiometricAttributes */
/* START_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_BiometricAttributes */
/**
* @summary The Trailing Root Component Types of BiometricAttributes
* @description
*
* This is an array of `ComponentSpec`s that define how to decode the trailing root component type list of a SET or SEQUENCE.
*
* @constant
*/
exports._root_component_type_list_2_spec_for_BiometricAttributes = [];
/* END_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_BiometricAttributes */
/* START_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_BiometricAttributes */
/**
* @summary The Extension Addition Component Types of BiometricAttributes
* @description
*
* This is an array of `ComponentSpec`s that define how to decode the extension addition component type list of a SET or SEQUENCE.
*
* @constant
*/
exports._extension_additions_list_spec_for_BiometricAttributes = [];
/* END_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_BiometricAttributes */
/* START_OF_SYMBOL_DEFINITION _cached_decoder_for_BiometricAttributes */
let _cached_decoder_for_BiometricAttributes = null;
/* END_OF_SYMBOL_DEFINITION _cached_decoder_for_BiometricAttributes */
/* START_OF_SYMBOL_DEFINITION _decode_BiometricAttributes */
/**
* @summary Decodes an ASN.1 element into a(n) BiometricAttributes
* @function
* @param {_Element} el The element being decoded.
* @returns {BiometricAttributes} The decoded data structure.
*/
function _decode_BiometricAttributes(el) {
if (!_cached_decoder_for_BiometricAttributes) {
_cached_decoder_for_BiometricAttributes = function (el) {
/* START_OF_SEQUENCE_COMPONENT_DECLARATIONS */
let bioFlags;
let templateId;
let bioType;
let bioReference = BiometricAttributes._default_value_for_bioReference;
let lastChange;
let path;
let _unrecognizedExtensionsList = [];
/* END_OF_SEQUENCE_COMPONENT_DECLARATIONS */
/* START_OF_CALLBACKS_MAP */
const callbacks = {
bioFlags: (_el) => {
bioFlags = BiometricFlags_ta_1._decode_BiometricFlags(_el);
},
templateId: (_el) => {
templateId = $._decodeObjectIdentifier(_el);
},
bioType: (_el) => {
bioType = BiometricType_ta_1._decode_BiometricType(_el);
},
bioReference: (_el) => {
bioReference = Reference_ta_1._decode_Reference(_el);
},
lastChange: (_el) => {
lastChange = $._decodeGeneralizedTime(_el);
},
path: (_el) => {
path = Path_ta_1._decode_Path(_el);
},
};
/* END_OF_CALLBACKS_MAP */
$._parse_sequence(el, callbacks, exports._root_component_type_list_1_spec_for_BiometricAttributes, exports._extension_additions_list_spec_for_BiometricAttributes, exports._root_component_type_list_2_spec_for_BiometricAttributes, (ext) => {
_unrecognizedExtensionsList.push(ext);
});
return new BiometricAttributes(
/* SEQUENCE_CONSTRUCTOR_CALL */ bioFlags, templateId, bioType, bioReference, lastChange, path, _unrecognizedExtensionsList);
};
}
return _cached_decoder_for_BiometricAttributes(el);
}
exports._decode_BiometricAttributes = _decode_BiometricAttributes;
/* END_OF_SYMBOL_DEFINITION _decode_BiometricAttributes */
/* START_OF_SYMBOL_DEFINITION _cached_encoder_for_BiometricAttributes */
let _cached_encoder_for_BiometricAttributes = null;
/* END_OF_SYMBOL_DEFINITION _cached_encoder_for_BiometricAttributes */
/* START_OF_SYMBOL_DEFINITION _encode_BiometricAttributes */
/**
* @summary Encodes a(n) BiometricAttributes into an ASN.1 Element.
* @function
* @param {value} el The element being decoded.
* @param elGetter A function that can be used to get new ASN.1 elements.
* @returns {_Element} The BiometricAttributes, encoded as an ASN.1 Element.
*/
function _encode_BiometricAttributes(value, elGetter) {
if (!_cached_encoder_for_BiometricAttributes) {
_cached_encoder_for_BiometricAttributes = function (value, elGetter) {
return $._encodeSequence([]
.concat([
/* REQUIRED */ BiometricFlags_ta_1._encode_BiometricFlags(value.bioFlags, $.BER),
/* REQUIRED */ $._encodeObjectIdentifier(value.templateId, $.BER),
/* REQUIRED */ BiometricType_ta_1._encode_BiometricType(value.bioType, $.BER),
/* IF_DEFAULT */ value.bioReference === undefined ||
$.deepEq(value.bioReference, BiometricAttributes._default_value_for_bioReference)
? undefined
: Reference_ta_1._encode_Reference(value.bioReference, $.BER),
/* IF_ABSENT */ value.lastChange === undefined
? undefined
: $._encodeGeneralizedTime(value.lastChange, $.BER),
/* IF_ABSENT */ value.path === undefined
? undefined
: Path_ta_1._encode_Path(value.path, $.BER),
], value._unrecognizedExtensionsList
? value._unrecognizedExtensionsList
: [])
.filter((c) => !!c), $.BER);
};
}
return _cached_encoder_for_BiometricAttributes(value, elGetter);
}
exports._encode_BiometricAttributes = _encode_BiometricAttributes;
/* END_OF_SYMBOL_DEFINITION _encode_BiometricAttributes */
/* eslint-enable */
//# sourceMappingURL=BiometricAttributes.ta.js.map