From 7d73a5ca7f7d55947d220206c361c248c457a2da Mon Sep 17 00:00:00 2001 From: Jeremy Kahn Date: Fri, 17 Feb 2023 09:43:55 -0600 Subject: [PATCH] refactor: declare used wormhole-crypto types --- src/react-app-env.d.ts | 15 +++++++++++++++ src/services/FileTransfer/FileTransfer.ts | 1 - 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/react-app-env.d.ts b/src/react-app-env.d.ts index 6431bc5..12c6ef2 100644 --- a/src/react-app-env.d.ts +++ b/src/react-app-env.d.ts @@ -1 +1,16 @@ /// + +// TODO: Type the rest of the API and contribute it to the wormhole-crypto project +declare module 'wormhole-crypto' { + export class Keychain { + constructor(key: Uint8Array, salt: Uint8Array) + + encryptStream(ReadableStream): Promise + + decryptStream(ReadableStream): Promise + } + + export const plaintextSize = number => number + + export const encryptedSize = number => number +} diff --git a/src/services/FileTransfer/FileTransfer.ts b/src/services/FileTransfer/FileTransfer.ts index e0407fc..687233b 100644 --- a/src/services/FileTransfer/FileTransfer.ts +++ b/src/services/FileTransfer/FileTransfer.ts @@ -1,6 +1,5 @@ import WebTorrent, { Torrent, TorrentFile } from 'webtorrent' import streamSaver from 'streamsaver' -// @ts-ignore import { Keychain, plaintextSize, encryptedSize } from 'wormhole-crypto' // @ts-ignore import idbChunkStore from 'idb-chunk-store'