diff --git a/js/modules/loki_file_server_api.d.ts b/js/modules/loki_file_server_api.d.ts index 64695d6de..08ea08a5a 100644 --- a/js/modules/loki_file_server_api.d.ts +++ b/js/modules/loki_file_server_api.d.ts @@ -1,11 +1,13 @@ +interface FileServerPairingAuthorisation { + primaryDevicePubKey: string; + secondaryDevicePubKey: string; + requestSignature: string; // base64 + grantSignature: string; // base64 +} + interface DeviceMappingAnnotation { isPrimary: string; - authorisations: Array<{ - primaryDevicePubKey: string; - secondaryDevicePubKey: string; - requestSignature: string; // base64 - grantSignature: string; // base64 - }>; + authorisations: Array; } interface LokiFileServerInstance { diff --git a/ts/session/index.ts b/ts/session/index.ts index 20dcfd2cb..b0c1d659b 100644 --- a/ts/session/index.ts +++ b/ts/session/index.ts @@ -6,4 +6,4 @@ import * as Types from './types'; // E.g // export const messageQueue = new MessageQueue() -export { Messages, Protocols }; +export { Messages, Protocols, Types }; diff --git a/ts/session/protocols/MultiDeviceProtocol.ts b/ts/session/protocols/MultiDeviceProtocol.ts index 46a310e2f..0c2aebfdd 100644 --- a/ts/session/protocols/MultiDeviceProtocol.ts +++ b/ts/session/protocols/MultiDeviceProtocol.ts @@ -14,7 +14,7 @@ import { UserUtil } from '../../util'; */ // tslint:disable-next-line: no-unnecessary-class export class MultiDeviceProtocol { - public static refreshDelay: number = 5 * 1000 * 1000; // 5 minutes + public static refreshDelay: number = 5 * 60 * 1000; // 5 minutes private static lastFetch: { [device: string]: number } = {}; /** diff --git a/ts/state/ducks/search.ts b/ts/state/ducks/search.ts index a3a21e79e..e6ba4e857 100644 --- a/ts/state/ducks/search.ts +++ b/ts/state/ducks/search.ts @@ -299,10 +299,21 @@ async function queryConversationsAndContacts( const conversation = searchResults[i]; const primaryDevice = resultPrimaryDevices[i]; - if (isSecondaryDevice && PubKey.isEqual(primaryDevice, ourPrimaryDevice)) { - conversations.push(ourNumber); + if (primaryDevice) { + if ( + isSecondaryDevice && + PubKey.isEqual(primaryDevice, ourPrimaryDevice) + ) { + conversations.push(ourNumber); + } else { + conversations.push(primaryDevice.key); + } + } else if (conversation.type === 'direct') { + contacts.push(conversation.id); + } else if (conversation.type !== 'group') { + contacts.push(conversation.id); } else { - conversations.push(primaryDevice.key); + conversations.push(conversation.id); } } // Inject synthetic Note to Self entry if query matches localized 'Note to Self'