@ -74,6 +74,7 @@ module.exports = {
removeAllContactSignedPreKeys ,
createOrUpdatePairingAuthorisation ,
removePairingAuthorisationForSecondaryPubKey ,
getAuthorisationForPubKey ,
getSecondaryDevicesFor ,
getPrimaryDeviceFor ,
@ -1412,6 +1413,15 @@ async function createOrUpdatePairingAuthorisation(data) {
) ;
}
async function removePairingAuthorisationForSecondaryPubKey ( pubKey ) {
await db . run (
` DELETE FROM ${ PAIRING _AUTHORISATIONS _TABLE } WHERE secondaryDevicePubKey = $ secondaryDevicePubKey; ` ,
{
$secondaryDevicePubKey : pubKey ,
}
) ;
}
async function getSecondaryDevicesFor ( primaryDevicePubKey ) {
const rows = await db . all (
` SELECT secondaryDevicePubKey FROM ${ PAIRING _AUTHORISATIONS _TABLE } WHERE primaryDevicePubKey = $ primaryDevicePubKey AND isGranted = 1 ORDER BY secondaryDevicePubKey ASC; ` ,