Skip to content

feat: add support for custom headers in addPassFromUrl#41

Open
mgcrea wants to merge 6 commits intodev-family:mainfrom
mgcrea:main
Open

feat: add support for custom headers in addPassFromUrl#41
mgcrea wants to merge 6 commits intodev-family:mainfrom
mgcrea:main

Conversation

@mgcrea
Copy link

@mgcrea mgcrea commented Jan 14, 2026

Hi thanks for the lib, I had trouble with authenticated URLs for the passes so I started to tweak the iOS code to support headers. Ended up reworking the API to get proper result codes and also implemented the addPassFromUrl on native Android to be ISO.

That's a lot of changes (breaking) and would need a new major. Feel free to merge or not, I'll maintain a fork meanwhile.

Thanks!

Updates addPassFromUrl to accept optional headers parameter for authenticated requests. Changes iOS implementation from direct Data(contentsOf:) to URLSession with proper header and error handling.
Set completion handler before calling showViewController so that
when containsPass() returns true, the completion callback is properly
invoked instead of being nil.
- Change completion handler to return error code and message
- Use Promise rejection instead of resolve(false) for failures
- Add specific error codes: INVALID_URL, NETWORK_ERROR, HTTP_ERROR,
  INVALID_DATA, INVALID_PASS, PASS_ALREADY_EXISTS, NO_VIEW_CONTROLLER,
  CONTROLLER_ERROR, USER_CANCELLED
- Export WalletErrorCode and WalletError types for TypeScript consumers
- Accept all 2xx HTTP status codes, not just 200
- Replace deprecated keyWindow with UIWindowScene API
- Remove redundant message property from WalletError type
- Fetch JWT from URL with optional custom headers support
- Pass fetched JWT to Google Wallet savePassesJwt API
- Add consistent error codes: INVALID_URL, NETWORK_ERROR, HTTP_ERROR,
  NO_ACTIVITY, API_ERROR, GENERAL_ERROR
- Remove Linking.openURL fallback, use native implementation
- Update WalletErrorCode type with Android-specific codes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant