@wildboar/pkcs
Version:
Public Key Cryptography Standard PDUs in TypeScript
91 lines • 7.25 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports._encode_AuthenticationType = exports._decode_AuthenticationType = exports._encode_PinAttributes = exports._decode_PinAttributes = exports.PinAttributes = exports._encode_ExternalAuthObjectAttributes = exports._decode_ExternalAuthObjectAttributes = exports._encode_BiometricAttributes = exports._decode_BiometricAttributes = exports.BiometricAttributes = exports._encode_AuthKeyAttributes = exports._decode_AuthKeyAttributes = exports.AuthKeyAttributes = exports._get_encoder_for_AuthenticationObject = exports._get_decoder_for_AuthenticationObject = void 0;
/* eslint-disable */
const asn1_ts_1 = require("asn1-ts");
const $ = require("asn1-ts/dist/node/functional");
const AuthenticationObject_ta_1 = require("../PKCS-15/AuthenticationObject.ta");
const AuthKeyAttributes_ta_1 = require("../PKCS-15/AuthKeyAttributes.ta");
const BiometricAttributes_ta_1 = require("../PKCS-15/BiometricAttributes.ta");
const ExternalAuthObjectAttributes_ta_1 = require("../PKCS-15/ExternalAuthObjectAttributes.ta");
const PinAttributes_ta_1 = require("../PKCS-15/PinAttributes.ta");
var AuthenticationObject_ta_2 = require("../PKCS-15/AuthenticationObject.ta");
Object.defineProperty(exports, "_get_decoder_for_AuthenticationObject", { enumerable: true, get: function () { return AuthenticationObject_ta_2._get_decoder_for_AuthenticationObject; } });
Object.defineProperty(exports, "_get_encoder_for_AuthenticationObject", { enumerable: true, get: function () { return AuthenticationObject_ta_2._get_encoder_for_AuthenticationObject; } });
var AuthKeyAttributes_ta_2 = require("../PKCS-15/AuthKeyAttributes.ta");
Object.defineProperty(exports, "AuthKeyAttributes", { enumerable: true, get: function () { return AuthKeyAttributes_ta_2.AuthKeyAttributes; } });
Object.defineProperty(exports, "_decode_AuthKeyAttributes", { enumerable: true, get: function () { return AuthKeyAttributes_ta_2._decode_AuthKeyAttributes; } });
Object.defineProperty(exports, "_encode_AuthKeyAttributes", { enumerable: true, get: function () { return AuthKeyAttributes_ta_2._encode_AuthKeyAttributes; } });
var BiometricAttributes_ta_2 = require("../PKCS-15/BiometricAttributes.ta");
Object.defineProperty(exports, "BiometricAttributes", { enumerable: true, get: function () { return BiometricAttributes_ta_2.BiometricAttributes; } });
Object.defineProperty(exports, "_decode_BiometricAttributes", { enumerable: true, get: function () { return BiometricAttributes_ta_2._decode_BiometricAttributes; } });
Object.defineProperty(exports, "_encode_BiometricAttributes", { enumerable: true, get: function () { return BiometricAttributes_ta_2._encode_BiometricAttributes; } });
var ExternalAuthObjectAttributes_ta_2 = require("../PKCS-15/ExternalAuthObjectAttributes.ta");
Object.defineProperty(exports, "_decode_ExternalAuthObjectAttributes", { enumerable: true, get: function () { return ExternalAuthObjectAttributes_ta_2._decode_ExternalAuthObjectAttributes; } });
Object.defineProperty(exports, "_encode_ExternalAuthObjectAttributes", { enumerable: true, get: function () { return ExternalAuthObjectAttributes_ta_2._encode_ExternalAuthObjectAttributes; } });
var PinAttributes_ta_2 = require("../PKCS-15/PinAttributes.ta");
Object.defineProperty(exports, "PinAttributes", { enumerable: true, get: function () { return PinAttributes_ta_2.PinAttributes; } });
Object.defineProperty(exports, "_decode_PinAttributes", { enumerable: true, get: function () { return PinAttributes_ta_2._decode_PinAttributes; } });
Object.defineProperty(exports, "_encode_PinAttributes", { enumerable: true, get: function () { return PinAttributes_ta_2._encode_PinAttributes; } });
/* END_OF_SYMBOL_DEFINITION AuthenticationType */
/* START_OF_SYMBOL_DEFINITION _cached_decoder_for_AuthenticationType */
let _cached_decoder_for_AuthenticationType = null;
/* END_OF_SYMBOL_DEFINITION _cached_decoder_for_AuthenticationType */
/* START_OF_SYMBOL_DEFINITION _decode_AuthenticationType */
/**
* @summary Decodes an ASN.1 element into a(n) AuthenticationType
* @function
* @param {_Element} el The element being decoded.
* @returns {AuthenticationType} The decoded data structure.
*/
function _decode_AuthenticationType(el) {
if (!_cached_decoder_for_AuthenticationType) {
_cached_decoder_for_AuthenticationType = $._decode_extensible_choice({
"UNIVERSAL 16": [
"pin",
AuthenticationObject_ta_1._get_decoder_for_AuthenticationObject(PinAttributes_ta_1._decode_PinAttributes),
],
"CONTEXT 0": [
"biometricTemplate",
$._decode_implicit(() => AuthenticationObject_ta_1._get_decoder_for_AuthenticationObject(BiometricAttributes_ta_1._decode_BiometricAttributes)),
],
"CONTEXT 1": [
"authKey",
$._decode_implicit(() => AuthenticationObject_ta_1._get_decoder_for_AuthenticationObject(AuthKeyAttributes_ta_1._decode_AuthKeyAttributes)),
],
"CONTEXT 2": [
"external",
$._decode_implicit(() => AuthenticationObject_ta_1._get_decoder_for_AuthenticationObject(ExternalAuthObjectAttributes_ta_1._decode_ExternalAuthObjectAttributes)),
],
});
}
return _cached_decoder_for_AuthenticationType(el);
}
exports._decode_AuthenticationType = _decode_AuthenticationType;
/* END_OF_SYMBOL_DEFINITION _decode_AuthenticationType */
/* START_OF_SYMBOL_DEFINITION _cached_encoder_for_AuthenticationType */
let _cached_encoder_for_AuthenticationType = null;
/* END_OF_SYMBOL_DEFINITION _cached_encoder_for_AuthenticationType */
/* START_OF_SYMBOL_DEFINITION _encode_AuthenticationType */
/**
* @summary Encodes a(n) AuthenticationType 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 AuthenticationType, encoded as an ASN.1 Element.
*/
function _encode_AuthenticationType(value, elGetter) {
if (!_cached_encoder_for_AuthenticationType) {
_cached_encoder_for_AuthenticationType = $._encode_choice({
pin: AuthenticationObject_ta_1._get_encoder_for_AuthenticationObject(PinAttributes_ta_1._encode_PinAttributes),
biometricTemplate: $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 0, () => AuthenticationObject_ta_1._get_encoder_for_AuthenticationObject(BiometricAttributes_ta_1._encode_BiometricAttributes), $.BER),
authKey: $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 1, () => AuthenticationObject_ta_1._get_encoder_for_AuthenticationObject(AuthKeyAttributes_ta_1._encode_AuthKeyAttributes), $.BER),
external: $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 2, () => AuthenticationObject_ta_1._get_encoder_for_AuthenticationObject(ExternalAuthObjectAttributes_ta_1._encode_ExternalAuthObjectAttributes), $.BER),
}, $.BER);
}
return _cached_encoder_for_AuthenticationType(value, elGetter);
}
exports._encode_AuthenticationType = _encode_AuthenticationType;
/* END_OF_SYMBOL_DEFINITION _encode_AuthenticationType */
/* eslint-enable */
//# sourceMappingURL=AuthenticationType.ta.js.map