From 7a85d69970f7ef5302f91114f99ca23674156f7f Mon Sep 17 00:00:00 2001 From: Vincent Date: Tue, 26 May 2020 11:00:50 +1000 Subject: [PATCH 1/3] Mostly strictly types Signal Data --- js/modules/data.d.ts | 388 ++++++++++++++++++++++++++++++++++++++++++- ts/window.ts | 77 +++++++++ 2 files changed, 464 insertions(+), 1 deletion(-) create mode 100644 ts/window.ts diff --git a/js/modules/data.d.ts b/js/modules/data.d.ts index 29e42df98..e9543b99b 100644 --- a/js/modules/data.d.ts +++ b/js/modules/data.d.ts @@ -1,3 +1,389 @@ +import { ConversationType } from '../../ts/state/ducks/conversations'; +import { Mesasge } from '../../ts/types/Message'; + +type IdentityKey = { + id: string; + publicKey: ArrayBuffer; + firstUse: boolean; + verified: number; + nonblockingApproval: boolean; +} | null; + +type PreKey = { + id: string; + publicKey: string; + privateKey: string; + recipient: string; +} | null; + +type PairingAuthorisation = { + primaryDevicePubKey: string; + secondaryDevicePubKey: string; + requestSignature: string; + grantSignature: string | null; +} | null; + +type PairingAuthorisationInit = { + requestSignature: string; + grantSignature: string; +}; + +type GuardNode = { + ed25519PubKey: string; +}; + +type SwarmNode = { + address: string; + ip: string; + port: string; + pubkey_ed25519: string; + pubkey_x25519: string; +}; + +type StorageItem = { + id: string; + value: any; +}; + +type SessionDataInfo = { + id: string; + number: string; + deviceId: number; + record: string; +}; + +type ServerToken = { + serverUrl: string; + token: string; +}; + +// Basic export function searchMessages(query: string): Promise>; export function searchConversations(query: string): Promise>; -export function getPrimaryDeviceFor(pubKey: string): Promise; +export function shutdown(): Promise; +export function close(): Promise; +export function removeDB(): Promise; +export function removeIndexedDBFiles(): Promise; +export function getPasswordHash(): Promise; + +// Identity Keys +export function createOrUpdateIdentityKey(data: any): Promise; +export function getIdentityKeyById(id: string): Promise; +export function bulkAddIdentityKeys(array: Array): Promise; +export function removeIdentityKeyById(id: string): Promise; +export function removeAllIdentityKeys(): Promise; + +// Pre Keys +export function createOrUpdatePreKey(data: PreKey): Promise; +export function getPreKeyById(id: string): Promise; +export function getPreKeyByRecipient(recipient: string): Promise; +export function bulkAddPreKeys(data: Array): Promise; +export function removePreKeyById(id: string): Promise; +export function getAllPreKeys(): Promise>; + +// Signed Pre Keys +export function createOrUpdateSignedPreKey(data: PreKey): Promise; +export function getSignedPreKeyById(id: string): Promise; +export function getAllSignedPreKeys(recipient: string): Promise; +export function bulkAddSignedPreKeys(array: Array): Promise; +export function removeSignedPreKeyById(id: string): Promise; +export function removeAllSignedPreKeys(): Promise; + +// Contact Pre Key +export function createOrUpdateContactPreKey(data: PreKey): Promise; +export function getContactPreKeyById(id: string): Promise; +export function getContactPreKeyByIdentityKey(key: string): Promise; +export function getContactPreKeys( + keyId: string, + identityKeyString: string +): Promise>; +export function getAllContactPreKeys(): Promise>; +export function bulkAddContactPreKeys(array: Array): Promise; +export function removeContactPreKeyByIdentityKey(id: string): Promise; +export function removeAllContactPreKeys(): Promise; + +// Contact Signed Pre Key +export function createOrUpdateContactSignedPreKey(data: PreKey): Promise; +export function getContactSignedPreKeyByIdid(string): Promise; +export function getContactSignedPreKeyByIdentityKey( + key: string +): Promise; +export function getContactSignedPreKeys( + keyId: string, + identityKeyString: string +): Promise>; +export function bulkAddContactSignedPreKeys( + array: Array +): Promise; +export function removeContactSignedPreKeyByIdentityKey( + id: string +): Promise; +export function removeAllContactSignedPreKeys(): Promise; + +// Authorisations & Linking +export function createOrUpdatePairingAuthorisation( + data: PairingAuthorisationInit +): Promise; +export function removePairingAuthorisationForSecondaryPubKey( + pubKey: string +): Promise; +export function getGrantAuthorisationsForPrimaryPubKey( + pubKey: string +): Promise>; +export function getGrantAuthorisationForSecondaryPubKey( + pubKey: string +): Promise; +export function getAuthorisationForSecondaryPubKey( + pubKey: string +): PairingAuthorisation; +export function getSecondaryDevicesFor( + primaryDevicePubKey: string +): Array; +export function getPrimaryDeviceFor( + secondaryDevicePubKey: string +): string | null; +export function getPairedDevicesFor(pubKey: string): Array; + +// Guard Nodes +export function getGuardNodes(): Promise; +export function updateGuardNodes(nodes: Array): Promise; + +// Storage Items +export function createOrUpdateItem(data: StorageItem): Promise; +export function getItemById(id: string): Promise; +export function getAlItems(): Promise>; +export function bulkAddItems(array: Array): Promise; +export function removeItemById(id: string): Promise; +export function removeAllItems(): Promise; + +// Sessions +export function createOrUpdateSession(data: SessionDataInfo): Promise; +export function getAllSessions(): Promise>; +export function getSessionById(id: string): Promise; +export function getSessionsByNumber(number: string): Promise; +export function bulkAddSessions(array: Array): Promise; +export function removeSessionById(id: string): Promise; +export function removeSessionsByNumber(number: string): Promise; +export function removeAllSessions(): Promise; + +// Conversations +export function getConversationCount(): Promise; +export function saveConversation(data: ConversationType): Promise; +export function saveConversations(data: Array): Promise; +export function updateConversation(data: ConversationType): Promise; +export function removeConversation(id: string): Promise; + +export function getAllConversations({ + ConversationCollection, +}: { + ConversationCollection: any; +}): Promise>; + +export function getAllConversationIds(): Promise>; +export function getAllPrivateConversations(): Promise>; +export function getAllPublicConversations(): Promise>; +export function getPublicConversationsByServer( + server: string, + { ConversationCollection }: { ConversationCollection: any } +): Promise; +export function getPubkeysInPublicConversation( + id: string +): Promise>; +export function savePublicServerToken(data: ServerToken): Promise; +export function getPublicServerTokenByServerUrl( + serverUrl: string +): Promise; +export function getAllGroupsInvolvingId( + id: string, + { ConversationCollection }: { ConversationCollection: any } +): Promise>; + +// Returns conversation row +// TODO: Make strict return types for search +export function searchConversations(query: string): Promise; +export function searchMessages(query: string): Promise; +export function searchMessagesInConversation( + query: string, + conversationId: string, + { limit }?: { limit: any } +): Promise; +export function getMessageCount(): Promise; +export function saveMessage( + data: Mesasge, + { forceSave, Message }?: { forceSave: any; Message: any } +): Promise; +export function cleanSeenMessages(): Promise; +export function cleanLastHashes(): Promise; +export function saveSeenMessageHash(data: { + expiresAt: number; + hash: string; +}): Promise; + +// TODO: Strictly type the following +export function updateLastHash(data: any): Promise; +export function saveSeenMessageHashes(data: any): Promise; +export function saveLegacyMessage(data: any): Promise; +export function saveMessages( + arrayOfMessages: any, + { forceSave }?: any +): Promise; +export function removeMessage(id: string, { Message }?: any): Promise; +export function getUnreadByConversation( + conversationId: string, + { MessageCollection }?: any +): Promise; +export function removeAllMessagesInConversation( + conversationId: string, + { MessageCollection }?: any +): Promise; + +export function getMessageBySender( + { + source, + sourceDevice, + sent_at, + }: { source: any; sourceDevice: any; sent_at: any }, + { Message }: { Message: any } +): Promise; +export function getMessageIdsFromServerIds( + serverIds: any, + conversationId: any +): Promise; +export function getMessageById( + id: string, + { Message }: { Message: any } +): Promise; +export function getAllMessages({ + MessageCollection, +}: { + MessageCollection: any; +}): Promise; +export function getAllUnsentMessages({ + MessageCollection, +}: { + MessageCollection: any; +}): Promise; +export function getAllMessageIds(): Promise; +export function getMessagesBySentAt( + sentAt: any, + { MessageCollection }: { MessageCollection: any } +): Promise; +export function getExpiredMessages({ + MessageCollection, +}: { + MessageCollection: any; +}): Promise; +export function getOutgoingWithoutExpiresAt({ + MessageCollection, +}: any): Promise; +export function getNextExpiringMessage({ + MessageCollection, +}: { + MessageCollection: any; +}): Promise; +export function getNextExpiringMessage({ + MessageCollection, +}: { + MessageCollection: any; +}): Promise; +export function getMessagesByConversation( + conversationId: any, + { + limit, + receivedAt, + MessageCollection, + type, + }: { + limit?: number; + receivedAt?: number; + MessageCollection: any; + type?: string; + } +): Promise; +export function getSeenMessagesByHashList(hashes: any): Promise; +export function getLastHashBySnode(convoId: any, snode: any): Promise; + +// Unprocessed +export function getUnprocessedCount(): Promise; +export function getAllUnprocessed(): Promise; +export function getUnprocessedById(id: any): Promise; +export function saveUnprocessed( + data: any, + { + forceSave, + }?: { + forceSave: any; + } +): Promise; +export function saveUnprocesseds( + arrayOfUnprocessed: any, + { + forceSave, + }?: { + forceSave: any; + } +): Promise; +export function updateUnprocessedAttempts( + id: any, + attempts: any +): Promise; +export function updateUnprocessedWithData(id: any, data: any): Promise; +export function removeUnprocessed(id: any): Promise; +export function removeAllUnprocessed(): Promise; + +// Attachment Downloads +export function getNextAttachmentDownloadJobs(limit: any): Promise; +export function saveAttachmentDownloadJob(job: any): Promise; +export function setAttachmentDownloadJobPending( + id: any, + pending: any +): Promise; +export function resetAttachmentDownloadPending(): Promise; +export function removeAttachmentDownloadJob(id: any): Promise; +export function removeAllAttachmentDownloadJobs(): Promise; + +// Other +export function removeAll(): Promise; +export function removeAllConfiguration(): Promise; +export function removeAllConversations(): Promise; +export function removeAllPrivateConversations(): Promise; +export function removeOtherData(): Promise; +export function cleanupOrphanedAttachments(): Promise; + +// Getters +export function getMessagesNeedingUpgrade( + limit: any, + { + maxVersion, + }: { + maxVersion?: number; + } +): Promise; +export function getLegacyMessagesNeedingUpgrade( + limit: any, + { + maxVersion, + }: { + maxVersion?: number; + } +): Promise; +export function getMessagesWithVisualMediaAttachments( + conversationId: any, + { + limit, + }: { + limit: any; + } +): Promise; +export function getMessagesWithFileAttachments( + conversationId: any, + { + limit, + }: { + limit: any; + } +): Promise; + +// Sender Keys +export function getSenderKeys(groupId: any, senderIdentity: any): Promise; +export function createOrUpdateSenderKeys(data: any): Promise; diff --git a/ts/window.ts b/ts/window.ts new file mode 100644 index 000000000..2490690a4 --- /dev/null +++ b/ts/window.ts @@ -0,0 +1,77 @@ +declare global { + interface Window { + seedNodeList: any; + + WebAPI: any; + LokiSnodeAPI: any; + SenderKeyAPI: any; + LokiMessageAPI: any; + StubMessageAPI: any; + StubAppDotNetApi: any; + LokiPublicChatAPI: any; + LokiAppDotNetServerAPI: any; + LokiFileServerAPI: any; + LokiRssAPI: any; + } +} + +// window.WebAPI = initializeWebAPI(); +// const LokiSnodeAPI = require('./js/modules/loki_snode_api'); +// window.SenderKeyAPI = require('./js/modules/loki_sender_key_api'); +// window.lokiSnodeAPI +// window.LokiMessageAPI = require('./js/modules/loki_message_api'); +// window.StubMessageAPI = require('./integration_test/stubs/stub_message_api'); +// window.StubAppDotNetApi = require('./integration_test/stubs/stub_app_dot_net_api'); +// window.LokiPublicChatAPI = require('./js/modules/loki_public_chat_api'); +// window.LokiAppDotNetServerAPI = require('./js/modules/loki_app_dot_net_api'); +// window.LokiFileServerAPI = require('./js/modules/loki_file_server_api'); +// window.LokiRssAPI = require('./js/modules/loki_rss_api'); + +export const exporttts = { + // APIs + WebAPI: window.WebAPI, + + // Utilities + Events: () => window.Events, + Signal: () => window.Signal, + Whisper: () => window.Whisper, + ConversationController: () => window.ConversationController, + passwordUtil: () => window.passwordUtil, + + // Values + CONSTANTS: () => window.CONSTANTS, + versionInfo: () => window.versionInfo, + mnemonic: () => window.mnemonic, + lokiFeatureFlags: () => window.lokiFeatureFlags, + + // Getters + getAccountManager: () => window.getAccountManager, + getConversations: () => window.getConversations, + getFriendsFromContacts: () => window.getFriendsFromContacts, + getSettingValue: () => window.getSettingValue, + + // Setters + setPassword: () => window.setPassword, + setSettingValue: () => window.setSettingValue, + + // UI Events + pushToast: () => window.pushToast, + confirmationDialog: () => window.confirmationDialog, + + showQRDialog: () => window.showQRDialog, + showSeedDialog: () => window.showSeedDialog, + showPasswordDialog: () => window.showPasswordDialog, + showEditProfileDialog: () => window.showEditProfileDialog, + + toggleTheme: () => window.toggleTheme, + toggleMenuBar: () => window.toggleMenuBar, + toggleSpellCheck: () => window.toggleSpellCheck, + toggleLinkPreview: () => window.toggleLinkPreview, + toggleMediaPermissions: () => window.toggleMediaPermissions, + + // Actions + clearLocalData: () => window.clearLocalData, + deleteAccount: () => window.deleteAccount, + resetDatabase: () => window.resetDatabase, + attemptConnection: () => window.attemptConnection, +}; From 729fa594b84d864a8edbb56fb4a26dd9663037a0 Mon Sep 17 00:00:00 2001 From: Mikunj Date: Thu, 28 May 2020 12:14:49 +1000 Subject: [PATCH 2/3] Updated window exports --- js/modules/data.d.ts | 8 +- ts/global.d.ts | 1 + ts/window.ts | 193 ++++++++++++++++++++++++++----------------- 3 files changed, 123 insertions(+), 79 deletions(-) diff --git a/js/modules/data.d.ts b/js/modules/data.d.ts index e9543b99b..e154cbf3c 100644 --- a/js/modules/data.d.ts +++ b/js/modules/data.d.ts @@ -135,14 +135,14 @@ export function getGrantAuthorisationForSecondaryPubKey( ): Promise; export function getAuthorisationForSecondaryPubKey( pubKey: string -): PairingAuthorisation; +): Promise; export function getSecondaryDevicesFor( primaryDevicePubKey: string -): Array; +): Promise>; export function getPrimaryDeviceFor( secondaryDevicePubKey: string -): string | null; -export function getPairedDevicesFor(pubKey: string): Array; +): Promise; +export function getPairedDevicesFor(pubKey: string): Promise>; // Guard Nodes export function getGuardNodes(): Promise; diff --git a/ts/global.d.ts b/ts/global.d.ts index 34564325a..39e55c39f 100644 --- a/ts/global.d.ts +++ b/ts/global.d.ts @@ -1,3 +1,4 @@ +// TODO: Delete this and depend on window.ts instead interface Window { CONSTANTS: any; versionInfo: any; diff --git a/ts/window.ts b/ts/window.ts index 2490690a4..aeb19ec5d 100644 --- a/ts/window.ts +++ b/ts/window.ts @@ -1,77 +1,120 @@ -declare global { - interface Window { - seedNodeList: any; - - WebAPI: any; - LokiSnodeAPI: any; - SenderKeyAPI: any; - LokiMessageAPI: any; - StubMessageAPI: any; - StubAppDotNetApi: any; - LokiPublicChatAPI: any; - LokiAppDotNetServerAPI: any; - LokiFileServerAPI: any; - LokiRssAPI: any; - } +import { LocalizerType } from './types/Util'; + +interface Window { + seedNodeList: any; + + WebAPI: any; + LokiSnodeAPI: any; + SenderKeyAPI: any; + LokiMessageAPI: any; + StubMessageAPI: any; + StubAppDotNetApi: any; + LokiPublicChatAPI: any; + LokiAppDotNetServerAPI: any; + LokiFileServerAPI: any; + LokiRssAPI: any; + + CONSTANTS: any; + versionInfo: any; + + Events: any; + Lodash: any; + clearLocalData: any; + getAccountManager: any; + getConversations: any; + getFriendsFromContacts: any; + mnemonic: any; + clipboard: any; + attemptConnection: any; + + passwordUtil: any; + userConfig: any; + shortenPubkey: any; + + dcodeIO: any; + libsignal: any; + libloki: any; + displayNameRegex: any; + + Signal: any; + Whisper: any; + ConversationController: any; + + onLogin: any; + setPassword: any; + textsecure: any; + Session: any; + log: any; + i18n: LocalizerType; + friends: any; + generateID: any; + storage: any; + pushToast: any; + + confirmationDialog: any; + showQRDialog: any; + showSeedDialog: any; + showPasswordDialog: any; + showEditProfileDialog: any; + + deleteAccount: any; + + toggleTheme: any; + toggleMenuBar: any; + toggleSpellCheck: any; + toggleLinkPreview: any; + toggleMediaPermissions: any; + + getSettingValue: any; + setSettingValue: any; + lokiFeatureFlags: any; + + resetDatabase: any; } -// window.WebAPI = initializeWebAPI(); -// const LokiSnodeAPI = require('./js/modules/loki_snode_api'); -// window.SenderKeyAPI = require('./js/modules/loki_sender_key_api'); -// window.lokiSnodeAPI -// window.LokiMessageAPI = require('./js/modules/loki_message_api'); -// window.StubMessageAPI = require('./integration_test/stubs/stub_message_api'); -// window.StubAppDotNetApi = require('./integration_test/stubs/stub_app_dot_net_api'); -// window.LokiPublicChatAPI = require('./js/modules/loki_public_chat_api'); -// window.LokiAppDotNetServerAPI = require('./js/modules/loki_app_dot_net_api'); -// window.LokiFileServerAPI = require('./js/modules/loki_file_server_api'); -// window.LokiRssAPI = require('./js/modules/loki_rss_api'); - -export const exporttts = { - // APIs - WebAPI: window.WebAPI, - - // Utilities - Events: () => window.Events, - Signal: () => window.Signal, - Whisper: () => window.Whisper, - ConversationController: () => window.ConversationController, - passwordUtil: () => window.passwordUtil, - - // Values - CONSTANTS: () => window.CONSTANTS, - versionInfo: () => window.versionInfo, - mnemonic: () => window.mnemonic, - lokiFeatureFlags: () => window.lokiFeatureFlags, - - // Getters - getAccountManager: () => window.getAccountManager, - getConversations: () => window.getConversations, - getFriendsFromContacts: () => window.getFriendsFromContacts, - getSettingValue: () => window.getSettingValue, - - // Setters - setPassword: () => window.setPassword, - setSettingValue: () => window.setSettingValue, - - // UI Events - pushToast: () => window.pushToast, - confirmationDialog: () => window.confirmationDialog, - - showQRDialog: () => window.showQRDialog, - showSeedDialog: () => window.showSeedDialog, - showPasswordDialog: () => window.showPasswordDialog, - showEditProfileDialog: () => window.showEditProfileDialog, - - toggleTheme: () => window.toggleTheme, - toggleMenuBar: () => window.toggleMenuBar, - toggleSpellCheck: () => window.toggleSpellCheck, - toggleLinkPreview: () => window.toggleLinkPreview, - toggleMediaPermissions: () => window.toggleMediaPermissions, - - // Actions - clearLocalData: () => window.clearLocalData, - deleteAccount: () => window.deleteAccount, - resetDatabase: () => window.resetDatabase, - attemptConnection: () => window.attemptConnection, -}; +declare const window: Window; + +// Utilities +export const WebAPI = window.WebAPI; +export const Events = window.Events; +export const Signal = window.Signal; +export const Whisper = window.Whisper; +export const ConversationController = window.ConversationController; +export const passwordUtil = window.passwordUtil; + +// Values +export const CONSTANTS = window.CONSTANTS; +export const versionInfo = window.versionInfo; +export const mnemonic = window.mnemonic; +export const lokiFeatureFlags = window.lokiFeatureFlags; + +// Getters +export const getAccountManager = window.getAccountManager; +export const getConversations = window.getConversations; +export const getFriendsFromContacts = window.getFriendsFromContacts; +export const getSettingValue = window.getSettingValue; + +// Setters +export const setPassword = window.setPassword; +export const setSettingValue = window.setSettingValue; + +// UI Events +export const pushToast = window.pushToast; +export const confirmationDialog = window.confirmationDialog; + +export const showQRDialog = window.showQRDialog; +export const showSeedDialog = window.showSeedDialog; +export const showPasswordDialog = window.showPasswordDialog; +export const showEditProfileDialog = window.showEditProfileDialog; + +export const toggleTheme = window.toggleTheme; +export const toggleMenuBar = window.toggleMenuBar; +export const toggleSpellCheck = window.toggleSpellCheck; +export const toggleLinkPreview = window.toggleLinkPreview; +export const toggleMediaPermissions = window.toggleMediaPermissions; + +// Actions +export const clearLocalData = window.clearLocalData; +export const deleteAccount = window.deleteAccount; +export const resetDatabase = window.resetDatabase; +export const attemptConnection = window.attemptConnection; From 85d3c35c0cc39271fb043c08f4c60ba6303d1c06 Mon Sep 17 00:00:00 2001 From: Mikunj Date: Thu, 28 May 2020 12:46:42 +1000 Subject: [PATCH 3/3] Fix types --- js/modules/data.d.ts | 109 +++++++++++++++++++++++++++---------------- 1 file changed, 69 insertions(+), 40 deletions(-) diff --git a/js/modules/data.d.ts b/js/modules/data.d.ts index e154cbf3c..92441555f 100644 --- a/js/modules/data.d.ts +++ b/js/modules/data.d.ts @@ -7,25 +7,46 @@ type IdentityKey = { firstUse: boolean; verified: number; nonblockingApproval: boolean; -} | null; +}; type PreKey = { - id: string; - publicKey: string; - privateKey: string; + id: number; + publicKey: ArrayBuffer; + privateKey: ArrayBuffer; recipient: string; -} | null; +}; + +type SignedPreKey = { + id: number; + publicKey: ArrayBuffer; + privateKey: ArrayBuffer; + created_at: number; + confirmed: boolean; + signature: ArrayBuffer; +}; + +type ContactPreKey = { + id: number; + identityKeyString: string; + publicKey: ArrayBuffer; + keyId: number; +}; + +type ContactSignedPreKey = { + id: number; + identityKeyString: string; + publicKey: ArrayBuffer; + keyId: number; + signature: ArrayBuffer; + created_at: number; + confirmed: boolean; +}; type PairingAuthorisation = { primaryDevicePubKey: string; secondaryDevicePubKey: string; - requestSignature: string; - grantSignature: string | null; -} | null; - -type PairingAuthorisationInit = { - requestSignature: string; - grantSignature: string; + requestSignature: ArrayBuffer; + grantSignature: ArrayBuffer | null; }; type GuardNode = { @@ -67,53 +88,61 @@ export function removeIndexedDBFiles(): Promise; export function getPasswordHash(): Promise; // Identity Keys -export function createOrUpdateIdentityKey(data: any): Promise; -export function getIdentityKeyById(id: string): Promise; +export function createOrUpdateIdentityKey(data: IdentityKey): Promise; +export function getIdentityKeyById(id: string): Promise; export function bulkAddIdentityKeys(array: Array): Promise; export function removeIdentityKeyById(id: string): Promise; export function removeAllIdentityKeys(): Promise; // Pre Keys export function createOrUpdatePreKey(data: PreKey): Promise; -export function getPreKeyById(id: string): Promise; -export function getPreKeyByRecipient(recipient: string): Promise; +export function getPreKeyById(id: number): Promise; +export function getPreKeyByRecipient(recipient: string): Promise; export function bulkAddPreKeys(data: Array): Promise; -export function removePreKeyById(id: string): Promise; +export function removePreKeyById(id: number): Promise; export function getAllPreKeys(): Promise>; // Signed Pre Keys -export function createOrUpdateSignedPreKey(data: PreKey): Promise; -export function getSignedPreKeyById(id: string): Promise; -export function getAllSignedPreKeys(recipient: string): Promise; -export function bulkAddSignedPreKeys(array: Array): Promise; -export function removeSignedPreKeyById(id: string): Promise; +export function createOrUpdateSignedPreKey(data: SignedPreKey): Promise; +export function getSignedPreKeyById(id: number): Promise; +export function getAllSignedPreKeys(): Promise; +export function bulkAddSignedPreKeys(array: Array): Promise; +export function removeSignedPreKeyById(id: number): Promise; export function removeAllSignedPreKeys(): Promise; // Contact Pre Key -export function createOrUpdateContactPreKey(data: PreKey): Promise; -export function getContactPreKeyById(id: string): Promise; -export function getContactPreKeyByIdentityKey(key: string): Promise; +export function createOrUpdateContactPreKey(data: ContactPreKey): Promise; +export function getContactPreKeyById(id: number): Promise; +export function getContactPreKeyByIdentityKey( + key: string +): Promise; export function getContactPreKeys( - keyId: string, + keyId: number, identityKeyString: string -): Promise>; -export function getAllContactPreKeys(): Promise>; -export function bulkAddContactPreKeys(array: Array): Promise; -export function removeContactPreKeyByIdentityKey(id: string): Promise; +): Promise>; +export function getAllContactPreKeys(): Promise>; +export function bulkAddContactPreKeys( + array: Array +): Promise; +export function removeContactPreKeyByIdentityKey(id: number): Promise; export function removeAllContactPreKeys(): Promise; // Contact Signed Pre Key -export function createOrUpdateContactSignedPreKey(data: PreKey): Promise; -export function getContactSignedPreKeyByIdid(string): Promise; +export function createOrUpdateContactSignedPreKey( + data: ContactSignedPreKey +): Promise; +export function getContactSignedPreKeyById( + id: number +): Promise; export function getContactSignedPreKeyByIdentityKey( key: string -): Promise; +): Promise; export function getContactSignedPreKeys( - keyId: string, + keyId: number, identityKeyString: string -): Promise>; +): Promise>; export function bulkAddContactSignedPreKeys( - array: Array + array: Array ): Promise; export function removeContactSignedPreKeyByIdentityKey( id: string @@ -122,8 +151,8 @@ export function removeAllContactSignedPreKeys(): Promise; // Authorisations & Linking export function createOrUpdatePairingAuthorisation( - data: PairingAuthorisationInit -): Promise; + data: PairingAuthorisation +): Promise; export function removePairingAuthorisationForSecondaryPubKey( pubKey: string ): Promise; @@ -132,10 +161,10 @@ export function getGrantAuthorisationsForPrimaryPubKey( ): Promise>; export function getGrantAuthorisationForSecondaryPubKey( pubKey: string -): Promise; +): Promise; export function getAuthorisationForSecondaryPubKey( pubKey: string -): Promise; +): Promise; export function getSecondaryDevicesFor( primaryDevicePubKey: string ): Promise>;