Thalhammer / jwt-cpp

A header only library for creating and validating json web tokens in c++
https://thalhammer.github.io/jwt-cpp/
MIT License
886 stars 241 forks source link

Make jwt::decoded_jwt moveable #225

Closed Ka0o0 closed 2 years ago

Ka0o0 commented 2 years ago

This removes the const specifier from the token member class so that objects of type jwt::decoded_token can be moved. IMO it is safe to do so as the variable is only exposed via get_token which returns a const reference to it.

I'm unsure though in regards to whether or not to make it private. Currently is protected, making it private would then make it a breaking change.

This resolves #224 then.

Thalhammer commented 2 years ago

While I am in no way against making it private (you are not really supposed to use it and modifying it wasnt possible anyway) I don't really see a benefit in doing so 🤔

The change itself looks good to merge.

Ka0o0 commented 2 years ago

Hi Dominik, thank you for the quick response. Yes true. I was just considering this because the member was const but I also think it's fine to keep it protected as also the other fields are protected. Then I guess this PR is ready for merge.

Thalhammer commented 2 years ago

Thanks for finding and fixing this. Great work. We might reconsider making this stuff private for the next major breaking release, but I'd like to avoid breaking changes (regardless how minor they are) unless we have to or there are already breaks anyway.