alexander-albers / tripkit

Swift library for querying data from public transport providers.
MIT License
81 stars 8 forks source link

VRS: cannot find certificate #77

Open alexander-albers opened 1 year ago

alexander-albers commented 1 year ago

When importing TripKit using SPM, the certificate for the VRS provider (vrs-client-certificate.pfx) cannot be found.

cseh17 commented 1 year ago

In order to fix this bug it is enough to change the Bundle.module to Bundle.main in VrsProvider.swift line 31.

This will allow all Users that use VRS to be able to integrate the package directly from SPM. Currently a workaround is needed for VRS users.

alexander-albers commented 1 year ago

Hi @cseh17, sorry for the long delay. I am struggling to reproduce the issue on my side: I have set up a clean macOS command line app within Xcode and imported the TripKit library using Xcode SwiftPM. From there, I have no problems making requests using

VrsProvider(certAuthorization: ["certName": "vrs-client-certificate.pfx", "password": "..."])

Could you please try the same or send me a sample project?

cseh17 commented 1 year ago

I have tried it again and it seems to work now. I think you can close the issue.

Question: when can we expect a new version with the changes?

alexander-albers commented 1 year ago

Sorry, I have somewhat neglected to update the version in the past months. It used to match the versions of ÖPNV Navigator, but I don't think this is a great way moving forward.

cseh17 commented 6 months ago

I'd like to reopen this issue as I have new information to share. Upon doing some further testing, I have discovered the following: As you mentioned earlier, you performed some tests and were unable to replicate the issue. This is accurate because if you follow the example provided, you'll successfully load the certificate contained within the framework itself.

However, in my scenario, if your certificate is situated outside the framework and elsewhere within the project structure, Bundle.module will only search within the framework structure. Oppositely, Bundle.main appears to search throughout the entire project structure, including within the framework (although I'm not 100% about the framework part).

alexander-albers commented 5 months ago

Thank you, I will recheck this later.

cseh17 commented 1 month ago

Any update on this issue?