UNPKG

@wildboar/pki-stub

Version:
38 lines (37 loc) 1.44 kB
import * as $ from "@wildboar/asn1/functional"; let _cached_decoder_for_PrivateDomainName = null; /** * @summary Decodes an ASN.1 element into a(n) PrivateDomainName * @function * @param {_Element} el The element being decoded. * @returns {PrivateDomainName} The decoded data structure. */ export function _decode_PrivateDomainName(el) { if (!_cached_decoder_for_PrivateDomainName) { _cached_decoder_for_PrivateDomainName = $._decode_inextensible_choice({ "UNIVERSAL 18": ["numeric", $._decodeNumericString], "UNIVERSAL 19": ["printable", $._decodePrintableString], }); } return _cached_decoder_for_PrivateDomainName(el); } let _cached_encoder_for_PrivateDomainName = null; /** * @summary Encodes a(n) PrivateDomainName 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 PrivateDomainName, encoded as an ASN.1 Element. */ export function _encode_PrivateDomainName(value, elGetter) { if (!_cached_encoder_for_PrivateDomainName) { _cached_encoder_for_PrivateDomainName = $._encode_choice({ numeric: $._encodeNumericString, printable: $._encodePrintableString, }, $.BER); } return _cached_encoder_for_PrivateDomainName(value, elGetter); } /* eslint-enable */