Add ability to pass a custom crypto instance
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 https://github.com/wi3land/ionic-appauth/issues/73
@wi3land Can you please review this? It seems to change a lot of code that's not related to the feature.
@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.
yo! any updates? so to make it clear, I'm just proposing to:
-
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. https://github.com/wi3land/ionic-appauth/pull/348/commits/61bab14f3f4491b79dbc27124fad348ddaac471b
-
allow the
AuthServiceto accept a custom crypto implementation so it's easier for us to test PKCE challenges in non-secure environments https://github.com/wi3land/ionic-appauth/pull/348/commits/3f544b652b9d13f82e15506ba2318eb145e3e0e1
Please add this!