@wildboar/pkcs
Version:
Public Key Cryptography Standard PDUs in TypeScript
43 lines (42 loc) • 1.7 kB
JavaScript
/* eslint-disable */
import { ASN1TagClass as _TagClass } from "@wildboar/asn1";
import * as $ from "@wildboar/asn1/functional";
import { _decode_FingerPrint, _encode_FingerPrint, } from "../PKCS-15/FingerPrint.ta.mjs";
import { _decode_IrisScan, _encode_IrisScan, } from "../PKCS-15/IrisScan.ta.mjs";
let _cached_decoder_for_BiometricType = null;
/**
* @summary Decodes an ASN.1 element into a(n) BiometricType
* @function
* @param {_Element} el The element being decoded.
* @returns {BiometricType} The decoded data structure.
*/
export function _decode_BiometricType(el) {
if (!_cached_decoder_for_BiometricType) {
_cached_decoder_for_BiometricType = $._decode_extensible_choice({
"UNIVERSAL 16": ["fingerPrint", _decode_FingerPrint],
"CONTEXT 0": [
"irisScan",
$._decode_implicit(() => _decode_IrisScan),
],
});
}
return _cached_decoder_for_BiometricType(el);
}
let _cached_encoder_for_BiometricType = null;
/**
* @summary Encodes a(n) BiometricType into an ASN.1 Element.
* @function
* @param value The element being encoded.
* @param elGetter A function that can be used to get new ASN.1 elements.
* @returns {_Element} The BiometricType, encoded as an ASN.1 Element.
*/
export function _encode_BiometricType(value, elGetter) {
if (!_cached_encoder_for_BiometricType) {
_cached_encoder_for_BiometricType = $._encode_choice({
fingerPrint: _encode_FingerPrint,
irisScan: $._encode_implicit(_TagClass.context, 0, () => _encode_IrisScan, $.BER),
}, $.BER);
}
return _cached_encoder_for_BiometricType(value, elGetter);
}
/* eslint-enable */