summaryrefslogtreecommitdiffhomepage
path: root/packages/browser/src/helpers/toUint8Array.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/browser/src/helpers/toUint8Array.ts')
-rw-r--r--packages/browser/src/helpers/toUint8Array.ts4
1 files changed, 3 insertions, 1 deletions
diff --git a/packages/browser/src/helpers/toUint8Array.ts b/packages/browser/src/helpers/toUint8Array.ts
index ed4aa5d..1855dd7 100644
--- a/packages/browser/src/helpers/toUint8Array.ts
+++ b/packages/browser/src/helpers/toUint8Array.ts
@@ -1,7 +1,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 Uint8Array.from(value, c => c.charCodeAt(0));
+ return utf8Encoder.encode(value);
}