// https://developer.mozilla.org/en-US/docs/Glossary/Base64#the_unicode_problem.
export function fromBase64(string: String) {
  const binString = atob(string);
  const bytes = Uint8Array.from(binString, (m) => m.codePointAt(0))
  return new TextDecoder().decode(bytes);
}

export function toBase64(string: String) {
  const bytes = new TextEncoder().encode(string)
  const binString = String.fromCodePoint(...bytes);
  return btoa(binString);
}
