Skip to content

chore: add explicit template extensions#4

Open
jonathansamines wants to merge 3 commits intoauthenio:masterfrom
jonathansamines-forks:chore/explicit-template-extension
Open

chore: add explicit template extensions#4
jonathansamines wants to merge 3 commits intoauthenio:masterfrom
jonathansamines-forks:chore/explicit-template-extension

Conversation

@jonathansamines
Copy link
Copy Markdown

Description

I am trying to use this library in the context of expo server routes, which seems to use Metro's module resolution, which does introduce special asset extensions which change the way modules are loaded for certain extensions (including xml).

All of that is to say, that when someone tries to load this library in expo, you get this error:

Metro error: Unable to resolve module ./templates/encrypted-key.tpl.xml from /Users/jonathansamines/dev/my-app/node_modules/@authenio/xml-encryption/lib/utils.js:

None of these files exist:
  * encrypted-key.tpl.xml
  * node_modules/@authenio/xml-encryption/lib/templates/encrypted-key.tpl.xml
  3 |
  4 | var templates = {
> 5 |   'encrypted-key': require('./templates/encrypted-key.tpl.xml'),
    |                             ^
  6 |   'keyinfo': require('./templates/keyinfo.tpl.xml'),
  7 | };
  8 |

I realize this library was probably not designed for environments such as expo, but I am pulling this library transitively in a way that it gets loaded but not used, so at least being able to load it would be nice.

@jonathansamines
Copy link
Copy Markdown
Author

Hey @tngan any chance you can take a look at this PR? I faced this issue with samlify being transitively loaded via @better-auth/sso in my expo app.

I realize this issue is a bit niche, but I think the solution is quite generic and would generally work everywhere. Alternatively, I have also made a similar fix to the upstream repo here, so that can also be an option if samlify decides to switch back to the original xml-encryption library

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