Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to pass a custom crypto instance #348

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

stewones
Copy link

@stewones stewones commented May 8, 2024

This is useful for testing PKCE in local environments.

example:

    class CustomCrypto {
      generateRandom(size: number): string {
        // implement with your own crypto method. eg: using the sha256 lib
        return 'random_' + size;
      }
      deriveChallenge(code: string) {
        // implement with your own crypto method. eg: using the sha256 lib
        return Promise.resolve('challenge_' + code);
      }
    }

  const authService = new AuthService(browser, storage, requestor, new CustomCrypto());

also added a test for this new behavior, check the auth-service.spec.ts

fixes #73

stewones added 2 commits May 6, 2024 13:13
…blish a patch in their own git, they can comment out a line in .gitignore
@mraible
Copy link
Collaborator

mraible commented May 29, 2024

@wi3land Can you please review this? It seems to change a lot of code that's not related to the feature.

@stewones
Copy link
Author

@wi3land Can you please review this? It seems to change a lot of code that's not related to the feature.

I'm proposing to ignore build files from git.

@stewones
Copy link
Author

stewones commented Jun 12, 2024

yo! any updates?
so to make it clear, I'm just proposing to:

  1. remove the final build files from git. this is a terrible idea, but I understand if the author disagrees and I can happily revert to its original setup. just let me know.
    61bab14

  2. allow the AuthService to accept a custom crypto implementation so it's easier for us to test PKCE challenges in non-secure environments
    3f544b6

@jsonhero
Copy link

Please add this!

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.

Unable to generate PKCE challenge. Not using PKCE
3 participants