I need to create a base64 encoded timestamp, and chatgpt made the following:
function base64EncodedTimestamp() {
// Get the current Unix timestamp (epoch) in seconds
const unixTimestamp = Math.floor(Date.now() / 1000);
// Convert the Unix timestamp to a Base64-encoded string
const base64EncodedString = btoa(String.fromCharCode(...new Uint8Array(new ArrayBuffer(4)).fill(unixTimestamp >> 0).reverse()));
return base64EncodedString;
}
Will this work with homeyscript?
How can I set a local variable in the flow with either return value or set from the script?
I was at work, so not yet. I will, though I admit to probably have been a bit too quick to ask once I finally cracked the dynamic api key and was hoping to get a quick answer to if this would even work with homeyscript…
…and no, btoa isn’t a function. So I need to find a way to base64 encode something in homeyscript. Will now begin to tear the script apart to see if there are more things missing.