diff options
author | Matthew Miller <matthew@millerti.me> | 2020-05-20 23:37:52 -0700 |
---|---|---|
committer | Matthew Miller <matthew@millerti.me> | 2020-05-20 23:37:52 -0700 |
commit | acfc8822607a95e58fff085d3905ecb29346b270 (patch) | |
tree | 801a687af961d2732b0325d7e8566ffb49c1a116 /packages/browser/src/helpers/toUint8Array.ts | |
parent | c80d7f59b94119b87b5dbd16029ecd5b1cb55ea8 (diff) |
Add some browser helpers
Diffstat (limited to 'packages/browser/src/helpers/toUint8Array.ts')
-rw-r--r-- | packages/browser/src/helpers/toUint8Array.ts | 7 |
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)); +} |