Skip to content

Commit

Permalink
verificationhelper: set the expiration time correctly
Browse files Browse the repository at this point in the history
Signed-off-by: Sumner Evans <[email protected]>
  • Loading branch information
sumnerevans committed Nov 22, 2024
1 parent 8943bb2 commit 93ab2c4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions crypto/verificationhelper/verificationhelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,9 @@ func (vh *VerificationHelper) Init(ctx context.Context) error {
// We have to create a fake transaction so that the call to
// cancelVerificationTxn works.
txn = VerificationTransaction{
RoomID: evt.RoomID,
TheirUserID: evt.Sender,
ExpirationTime: jsontime.UnixMilli{Time: time.Now().Add(time.Minute * 10)},
RoomID: evt.RoomID,
TheirUserID: evt.Sender,
}
if transactionable, ok := evt.Content.Parsed.(event.VerificationTransactionable); ok {
txn.TransactionID = transactionable.GetTransactionID()
Expand Down Expand Up @@ -320,6 +321,7 @@ func (vh *VerificationHelper) StartVerification(ctx context.Context, to id.UserI
vh.activeTransactionsLock.Lock()
defer vh.activeTransactionsLock.Unlock()
return txnID, vh.store.SaveVerificationTransaction(ctx, VerificationTransaction{
ExpirationTime: jsontime.UnixMilli{Time: time.Now().Add(time.Minute * 10)},
VerificationState: VerificationStateRequested,
TransactionID: txnID,
TheirUserID: to,
Expand Down Expand Up @@ -360,6 +362,7 @@ func (vh *VerificationHelper) StartInRoomVerification(ctx context.Context, roomI
vh.activeTransactionsLock.Lock()
defer vh.activeTransactionsLock.Unlock()
return txnID, vh.store.SaveVerificationTransaction(ctx, VerificationTransaction{
ExpirationTime: jsontime.UnixMilli{Time: time.Now().Add(time.Minute * 10)},
RoomID: roomID,
VerificationState: VerificationStateRequested,
TransactionID: txnID,
Expand Down

0 comments on commit 93ab2c4

Please sign in to comment.