Amazon CloudFront Function is a new feature introduced by AWS.
CloudFront Function can be written using JavaScript only.
https://aws.amazon.com/blogs/aws/introducing-cloudfront-functions-run-your-code-at-the-edge-with-low-latency-at-any-scale/
Our website generates a timestamp and encode it using btoa() (Base64 encoding).
Then, website sends HTTP GET request which includes the encoded timestamp to CloudFront function.
var sending_time = new Date().getTime();
var enc_sending_time = btoa(sending_time);
function generate_http_request(enc_sending_time)
{
...
}
Once CloudFront function receives the HTTP request,
it should decode the timestamp using atob().
However, CloudFront Function does not support atob(). https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/functions-javascript-runtime-features.html
How can we do base64 encoding to an integer
and then do base64 decoding on CloudFront function side
without using btoa() and atob()? (JavaScript only)