bilelmoussaoui / ashpd

A Rust wrapper around XDG portals DBus interfaces
https://bilelmoussaoui.github.io/ashpd/ashpd/
MIT License
242 stars 44 forks source link

Allow changing the HandleToken format #223

Closed DerpDays closed 4 months ago

DerpDays commented 4 months ago

It would be nice if there was a way to change the default format for HandleToken's in sessions from "ashpd_{token}" to something custom e.g. "myapp{token}", this way in portal logs it is more informative for the user that the request is coming specifically from an app.

This could be possibly be done by making all of the CreateSessionOptions structs public (and making the HandleToken module public and quite a lot other things public) and adding a corresponding new method to them, so then users can handle creating sessions on their own with format they want.

Another way would be to add an extra parameter to their corresponding create_session() which would be a breaking change.

And another way would be to add an extra method that overrides the format which would not be breaking whilst also not making lots of the api public

The first way would make it harder for future changes without them being breaking since a lot more of the library would be public, whilst the second option itself is a breaking change, whilst the third option would complicate things a bit more probably.

There is probably other options that I haven't thought of but these are the ways that came to the top of my head :sweat_smile:

bilelmoussaoui commented 4 months ago

Instead of providing ways to how you would achieve that, the question would be why you need that at all. It would make the usage of ashpd pretty annoying from API perspective and the HandleToken is just an internal part that you shouldn't worry about. The ashpd prefix is meaningless, it could be dropped but allows us to easily debug issues if they ever happen.

DerpDays commented 4 months ago

Yeah I agree it’s unnecessary and just over complicates stuff for basically no reason, should have thought this through more.