Skip to content

Commit

Permalink
bridgev2/matrix: allow key sharing for bridge admins
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Sep 13, 2024
1 parent 96e68fb commit e12ecbe
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions bridgev2/matrix/crypto.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,12 @@ func (helper *CryptoHelper) allowKeyShare(ctx context.Context, device *id.Device
zerolog.Ctx(ctx).Err(err).Msg("Failed to get user to handle key request")
return &crypto.KeyShareRejectNoResponse
} else if user == nil {
// TODO
zerolog.Ctx(ctx).Debug().Msg("Couldn't find user to handle key request")
return &crypto.KeyShareRejectNoResponse
} else if true {
// TODO admin check and is in room check
return &crypto.KeyShareRejection{Code: event.RoomKeyWithheldUnauthorized, Reason: "Key sharing is not yet implemented in bridgev2"}
} else if !user.Permissions.Admin {
zerolog.Ctx(ctx).Debug().Msg("Rejecting key request: user is not admin")
// TODO is in room check?
return &crypto.KeyShareRejection{Code: event.RoomKeyWithheldUnauthorized, Reason: "Key sharing for non-admins is not yet implemented"}
}
zerolog.Ctx(ctx).Debug().Msg("Accepting key request")
return nil
Expand Down

0 comments on commit e12ecbe

Please sign in to comment.