mirror of
https://codeberg.org/timelimit/timelimit-server.git
synced 2025-10-03 09:49:32 +02:00
Fix using wrong sequence counter for key replies
This commit is contained in:
parent
8a5e46811e
commit
30a47a336c
1 changed files with 6 additions and 4 deletions
|
@ -18,7 +18,7 @@
|
|||
import { ReplyToKeyRequestAction } from '../../../../action'
|
||||
import { Cache } from '../cache'
|
||||
import { EventHandler } from '../../../../monitoring/eventhandler'
|
||||
import { SourceDeviceNotFoundException } from '../exception/illegal-state'
|
||||
import { IllegalStateException } from '../exception/illegal-state'
|
||||
|
||||
export async function dispatchReplyToKeyRequestAction ({ deviceId, action, cache, eventHandler }: {
|
||||
deviceId: string
|
||||
|
@ -65,14 +65,16 @@ export async function dispatchReplyToKeyRequestAction ({ deviceId, action, cache
|
|||
const deviceEntryUnsafe = await cache.database.device.findOne({
|
||||
where: {
|
||||
familyId: cache.familyId,
|
||||
deviceId
|
||||
deviceId: request.senderDeviceId
|
||||
},
|
||||
transaction: cache.transaction,
|
||||
attributes: ['nextKeyReplySequenceNumber']
|
||||
})
|
||||
|
||||
if (!deviceEntryUnsafe) {
|
||||
throw new SourceDeviceNotFoundException()
|
||||
throw new IllegalStateException({
|
||||
staticMessage: 'target device entry not found'
|
||||
})
|
||||
}
|
||||
|
||||
const deviceEntry = {
|
||||
|
@ -84,7 +86,7 @@ export async function dispatchReplyToKeyRequestAction ({ deviceId, action, cache
|
|||
}, {
|
||||
where: {
|
||||
familyId: cache.familyId,
|
||||
deviceId
|
||||
deviceId: request.senderDeviceId
|
||||
},
|
||||
transaction: cache.transaction
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue