diff --git a/libloki/crypto.d.ts b/libloki/crypto.d.ts new file mode 100644 index 000000000..b7bfcb63b --- /dev/null +++ b/libloki/crypto.d.ts @@ -0,0 +1,27 @@ +import { PairingAuthorisation } from "../js/modules/data"; + +declare enum PairingTypeEnum { + REQUEST = 1, + GRANT +} + +export interface CryptoInterface { + DHDecrypt: any, + DHEncrypt: any, + DecryptGCM: any, // AES-GCM + EncryptGCM: any, // AES-GCM + FallBackDecryptionError: any, + FallBackSessionCipher: any, + LokiSessionCipher: any, + PairingType: PairingTypeEnum, + _decodeSnodeAddressToPubKey: any, + decryptForPubkey: any, + decryptToken: any, + encryptForPubkey: any, + generateEphemeralKeyPair: any, + generateSignatureForPairing: any, + sha512: any, + validateAuthorisation: any, + verifyAuthorisation(authorisation: PairingAuthorisation): Promise; + verifyPairingSignature: any, +} diff --git a/libloki/index.d.ts b/libloki/index.d.ts new file mode 100644 index 000000000..885a1b80d --- /dev/null +++ b/libloki/index.d.ts @@ -0,0 +1,8 @@ +import { CryptoInterface } from "./crypto"; + +export interface Libloki { + api: any; + crypto: CryptoInterface; + storage: any; + serviceNodes: any; +} diff --git a/ts/window.d.ts b/ts/window.d.ts index ca938e632..be0f5e570 100644 --- a/ts/window.d.ts +++ b/ts/window.d.ts @@ -3,6 +3,7 @@ import LokiMessageAPI from '../../js/modules/loki_message_api'; import LokiPublicChatFactoryAPI from '../../js/modules/loki_public_chat_api'; import { LibsignalProtocol } from '../../libtextsecure/libsignal-protocol'; import { SignalInterface } from '../../js/modules/signal'; +import { Libloki } from '../libloki'; /* We declare window stuff here instead of global.d.ts because we are importing other declarations. @@ -42,7 +43,7 @@ declare global { getFriendsFromContacts: any; getSettingValue: any; i18n: LocalizerType; - libloki: any; + libloki: Libloki; libsignal: LibsignalProtocol; log: any; lokiFeatureFlags: any;