mirror of
https://github.com/oxen-io/session-desktop.git
synced 2023-12-14 02:12:57 +01:00
Merge fixes
This commit is contained in:
parent
27f4378de8
commit
c027490d2f
3
js/modules/loki_file_server_api.d.ts
vendored
3
js/modules/loki_file_server_api.d.ts
vendored
|
@ -1,5 +1,5 @@
|
|||
interface DeviceMappingAnnotation {
|
||||
isPrimary: boolean;
|
||||
isPrimary: string;
|
||||
authorisations: Array<{
|
||||
primaryDevicePubKey: string;
|
||||
secondaryDevicePubKey: string;
|
||||
|
@ -10,4 +10,5 @@ interface DeviceMappingAnnotation {
|
|||
|
||||
interface LokiFileServerInstance {
|
||||
getUserDeviceMapping(pubKey: string): Promise<DeviceMappingAnnotation>;
|
||||
clearOurDeviceMappingAnnotations(): Promise<void>;
|
||||
}
|
||||
|
|
|
@ -267,7 +267,12 @@ async function handleSecondaryDeviceFriendRequest(pubKey: string) {
|
|||
if (!c || !(await c.isFriendWithAnyDevice())) {
|
||||
return false;
|
||||
}
|
||||
await MultiDeviceProtocol.savePairingAuthorisation(authorisation);
|
||||
await MultiDeviceProtocol.savePairingAuthorisation({
|
||||
primaryDevicePubKey: authorisation.primaryDevicePubKey,
|
||||
secondaryDevicePubKey: authorisation.secondaryDevicePubKey,
|
||||
requestSignature: Buffer.from(authorisation.requestSignature).buffer,
|
||||
grantSignature: Buffer.from(authorisation.grantSignature).buffer,
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ import {
|
|||
} from '../../../js/modules/data';
|
||||
import { PrimaryPubKey, PubKey, SecondaryPubKey } from '../types';
|
||||
import { UserUtil } from '../../util';
|
||||
import { lokiFileServerAPI } from '../../window';
|
||||
|
||||
/*
|
||||
The reason we're exporing a class here instead of just exporting the functions directly is for the sake of testing.
|
||||
|
@ -75,11 +74,13 @@ export class MultiDeviceProtocol {
|
|||
public static async fetchPairingAuthorisations(
|
||||
device: PubKey
|
||||
): Promise<Array<PairingAuthorisation>> {
|
||||
if (!lokiFileServerAPI) {
|
||||
if (!window.lokiFileServerAPI) {
|
||||
throw new Error('lokiFileServerAPI is not initialised.');
|
||||
}
|
||||
|
||||
const mapping = await lokiFileServerAPI.getUserDeviceMapping(device.key);
|
||||
const mapping = await window.lokiFileServerAPI.getUserDeviceMapping(
|
||||
device.key
|
||||
);
|
||||
// TODO: Filter out invalid authorisations
|
||||
|
||||
return mapping.authorisations.map(
|
||||
|
|
Loading…
Reference in a new issue