@wildboar/pki-stub
Version:
X.510 PKI-Stub ASN.1 data structures in TypeScript
24 lines (23 loc) • 810 B
JavaScript
import * as $ from "@wildboar/asn1/functional";
/**
* @summary Decodes an ASN.1 element into a(n) Time
* @function
* @param {_Element} el The element being decoded.
* @returns {Time} The decoded data structure.
*/
export const _decode_Time = $._decode_inextensible_choice({
"UNIVERSAL 23": ["utcTime", $._decodeUTCTime],
"UNIVERSAL 24": ["generalizedTime", $._decodeGeneralizedTime],
});
/**
* @summary Encodes a(n) Time 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 Time, encoded as an ASN.1 Element.
*/
export const _encode_Time = $._encode_choice({
utcTime: $._encodeUTCTime,
generalizedTime: $._encodeGeneralizedTime,
}, $.DER);
/* eslint-enable */