diff options
Diffstat (limited to 'packages/server/src/helpers/decodeCbor.ts')
-rw-r--r-- | packages/server/src/helpers/decodeCbor.ts | 20 |
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; -} |