summaryrefslogtreecommitdiffhomepage
path: root/packages/server/src/helpers/decodeCbor.ts
diff options
context:
space:
mode:
authorMatthew Miller <matthew@millerti.me>2022-11-11 15:31:54 -0800
committerMatthew Miller <matthew@millerti.me>2022-11-11 15:31:54 -0800
commitc92d508bdefb9c378d08c123b0141cc7cc7fdebc (patch)
treeb717c4367ffb125051373e0da4fc4c24cc84b103 /packages/server/src/helpers/decodeCbor.ts
parent80a2c94b798dfa80c03d518215b22dad42cada53 (diff)
Expand decodeCborFirst into cbor utils
Diffstat (limited to 'packages/server/src/helpers/decodeCbor.ts')
-rw-r--r--packages/server/src/helpers/decodeCbor.ts20
1 files changed, 0 insertions, 20 deletions
diff --git a/packages/server/src/helpers/decodeCbor.ts b/packages/server/src/helpers/decodeCbor.ts
deleted file mode 100644
index e2bae2c..0000000
--- a/packages/server/src/helpers/decodeCbor.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-/* eslint-disable @typescript-eslint/ban-ts-comment */
-import * as cborx from 'cbor-x';
-
-export function decodeCborFirst(input: Uint8Array): any {
- const decoded = cborx.decodeMultiple(input);
-
- if (decoded === undefined) {
- throw new Error('CBOR input data was empty');
- }
-
- /**
- * Typing on `decoded` is `void | []` which causes TypeScript to think that it's an empty array,
- * and thus you can't destructure it. I'm ignoring that because the code works fine in JS, and
- * so this should be a valid operation.
- */
- // @ts-ignore 2493
- const [first] = decoded;
-
- return first;
-}