@wildboar/pki-stub
Version:
X.510 PKI-Stub ASN.1 data structures in TypeScript
33 lines (32 loc) • 1.44 kB
JavaScript
import { _get_decoder_for_SIGNED, _get_encoder_for_SIGNED, } from "../PKI-Stub/SIGNED.ta.mjs";
import { _decode_TBSAttributeCertificate, _encode_TBSAttributeCertificate, } from "../PKI-Stub/TBSAttributeCertificate.ta.mjs";
let _cached_decoder_for_AttributeCertificate = null;
/**
* @summary Decodes an ASN.1 element into a(n) AttributeCertificate
* @function
* @param {_Element} el The element being decoded.
* @returns {AttributeCertificate} The decoded data structure.
*/
export function _decode_AttributeCertificate(el) {
if (!_cached_decoder_for_AttributeCertificate) {
_cached_decoder_for_AttributeCertificate =
_get_decoder_for_SIGNED(_decode_TBSAttributeCertificate);
}
return _cached_decoder_for_AttributeCertificate(el);
}
let _cached_encoder_for_AttributeCertificate = null;
/**
* @summary Encodes a(n) AttributeCertificate 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 AttributeCertificate, encoded as an ASN.1 Element.
*/
export function _encode_AttributeCertificate(value, elGetter) {
if (!_cached_encoder_for_AttributeCertificate) {
_cached_encoder_for_AttributeCertificate =
_get_encoder_for_SIGNED(_encode_TBSAttributeCertificate);
}
return _cached_encoder_for_AttributeCertificate(value, elGetter);
}
/* eslint-enable */