diff options
author | Matthew Miller <matthew@millerti.me> | 2021-04-15 21:34:26 -0700 |
---|---|---|
committer | Matthew Miller <matthew@millerti.me> | 2021-04-15 21:34:26 -0700 |
commit | c8c492572a0f72c6d9b8795a4e37621b5f49d2b9 (patch) | |
tree | 204dddd53d07a64ea3f21ee855876dc9af4267be /packages/browser/src/helpers/stringToArrayBuffer.ts | |
parent | cb445cd8404af140120260ca77294a70d7202a71 (diff) |
Rename toUint8Array to stringToArrayBuffer
Diffstat (limited to 'packages/browser/src/helpers/stringToArrayBuffer.ts')
-rw-r--r-- | packages/browser/src/helpers/stringToArrayBuffer.ts | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/packages/browser/src/helpers/stringToArrayBuffer.ts b/packages/browser/src/helpers/stringToArrayBuffer.ts new file mode 100644 index 0000000..e3edd41 --- /dev/null +++ b/packages/browser/src/helpers/stringToArrayBuffer.ts @@ -0,0 +1,7 @@ +/** + * A helper method to convert an arbitrary string sent from the server to a Uint8Array the + * authenticator will expect. + */ +export default function stringToArrayBuffer(value: string): ArrayBuffer { + return new TextEncoder().encode(value); +} |