summaryrefslogtreecommitdiffhomepage
path: root/packages/browser/src/helpers/toUint8Array.ts
blob: 1855dd73a5ab7b145df9941aa7a9fe08ba600292 (plain)
1
2
3
4
5
6
7
8
9
const utf8Encoder = new TextEncoder();

/**
 * A helper method to convert an arbitrary string sent from the server to a Uint8Array the
 * authenticator will expect.
 */
export default function toUint8Array(value: string): Uint8Array {
  return utf8Encoder.encode(value);
}