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.ts7
1 files changed, 7 insertions, 0 deletions
diff --git a/packages/browser/src/helpers/toUint8Array.ts b/packages/browser/src/helpers/toUint8Array.ts
new file mode 100644
index 0000000..a807a88
--- /dev/null
+++ b/packages/browser/src/helpers/toUint8Array.ts
@@ -0,0 +1,7 @@
+/**
+ * A helper method to convert a 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));
+}