fix(ocpi-2.2.1): Fixed usage of tokens & review PlatformRepository #16
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Change notes
only for 2.2.1
Credentials logic
The credentials logic completely changed. Token B and Token C were replaced by Client Token and Server Token. The Token A usage stays the same.
The Credentials Token A is used by the sender to communicate with the receiver (only when initiating registration). After registration, it is invalidated.
Then, there are two tokens, and the token to use is specified by the registration process.
This is why we do not use OCPI's token B and token C naming. According to who you are in the registration process, you have to use a different token. Using "Client Token" and "Server Token" simplifies that process of picking the right token for the right operation.
Before these changes, the library would not work when used while being the receiver of the registration process.
PlatformRepository modifications
Unused methods are removed. Some were renamed and their signature updated to match the new credentials logic. The unregistration is now in one unique method, rather than 5 different methods.
Migration guide
It's a breaking change, it also breaks your
Platform
objects.You will have to update your
PlatformRepository
implementation to match the new interface. Everything is documented in the file. You have to re-register with your partners. Or you can mnually update yourPlatform
object to reflect the changes (clientToken / serverToken instead of tokenB / tokenC).Notes
This will allow us to bump the lib to 0.1.0 as it should now work properly, and it's now usable (not production ready yet obvisouly).