Base64-encode a string, wherever the code is running.
Node and a browser disagree on how to do this, and the browser's btoa only accepts latin1, so a
non-latin path or a payload with an accent throws. Encoding to UTF-8 bytes first makes both agree
on the same output, which matters because the two halves of a hydrated render can happen on
different sides of that divide and have to produce the same key.
Base64-encode a string, wherever the code is running.
Node and a browser disagree on how to do this, and the browser's
btoaonly accepts latin1, so a non-latin path or a payload with an accent throws. Encoding to UTF-8 bytes first makes both agree on the same output, which matters because the two halves of a hydrated render can happen on different sides of that divide and have to produce the same key.