Our proposed solution to sharing encrypted room history on invite involves uploading all of the room keys to an encrypted media blob and sharing those keys with another user via to-device messages.
#4505 tracks creation of an API to upload the keys and share the details via to-device messages. This issue tracks the simple(?) task of hooking that new API into matrix_sdk::room::Room::invite_user_by_id().
Part of element-hq/element-meta#2685.