UNPKG

@wildboar/pkcs

Version:
29 lines (28 loc) 1.04 kB
import * as $ from "@wildboar/asn1/functional"; import { _decode_Path, _encode_Path } from "../PKCS-15/Path.ta.mjs"; import { _decode_URL, _encode_URL } from "../PKCS-15/URL.ta.mjs"; /** * @summary Returns a function that will decode an ASN.1 element into a(n) ReferencedValue * @function * @param {_Element} el The element being decoded. * @returns A function that will decode an ASN.1 element. */ export function _get_decoder_for_ReferencedValue(_decode_Type) { return $._decode_inextensible_choice({ "UNIVERSAL 16": ["path", _decode_Path], "UNIVERSAL 19": ["url", _decode_URL], "CONTEXT 3": ["url", _decode_URL], }); } /** * @summary Returns a function that will encode a(n) ReferencedValue into an ASN.1 Element. * @function * @returns A function that will encode a(n) ReferencedValue as an ASN.1 element. */ export function _get_encoder_for_ReferencedValue(_encode_Type) { return $._encode_choice({ path: _encode_Path, url: _encode_URL, }, $.BER); } /* eslint-enable */