@wildboar/pki-stub
Version:
X.510 PKI-Stub ASN.1 data structures in TypeScript
39 lines (38 loc) • 1.69 kB
JavaScript
/* eslint-disable */
import { ASN1TagClass as _TagClass, } from "@wildboar/asn1";
import * as $ from "@wildboar/asn1/functional";
let _cached_decoder_for_AdministrationDomainName = null;
/**
* @summary Decodes an ASN.1 element into a(n) AdministrationDomainName
* @function
* @param {_Element} el The element being decoded.
* @returns {AdministrationDomainName} The decoded data structure.
*/
export function _decode_AdministrationDomainName(el) {
if (!_cached_decoder_for_AdministrationDomainName) {
_cached_decoder_for_AdministrationDomainName =
$._decode_explicit(() => $._decode_inextensible_choice({
"UNIVERSAL 18": ["numeric", $._decodeNumericString],
"UNIVERSAL 19": ["printable", $._decodePrintableString],
}));
}
return _cached_decoder_for_AdministrationDomainName(el);
}
let _cached_encoder_for_AdministrationDomainName = null;
/**
* @summary Encodes a(n) AdministrationDomainName 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 AdministrationDomainName, encoded as an ASN.1 Element.
*/
export function _encode_AdministrationDomainName(value, elGetter) {
if (!_cached_encoder_for_AdministrationDomainName) {
_cached_encoder_for_AdministrationDomainName = $._encode_explicit(_TagClass.application, 2, () => $._encode_choice({
numeric: $._encodeNumericString,
printable: $._encodePrintableString,
}, $.BER), $.BER);
}
return _cached_encoder_for_AdministrationDomainName(value, elGetter);
}
/* eslint-enable */