-
Notifications
You must be signed in to change notification settings - Fork 162
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
Separate crypto_utils generateRandom implementation for browser & Node #38
Conversation
@tikurahul would be great if you can let me know what you think once you get a chance. Cheers, |
It's very conventional to put jQuery is a special case. You could argue the library shouldn't even rely on it. That would be a separate issue in itself that should not be addressed here. Other libraries used like |
The current behaviour with latest TypeScript is that jQuery However, I'll revert |
This ensures we still have typing for xor jQuerySettings And removes any doubt about reopening openid#22
Done. |
@Meligy Thanks for the PRs. I am swamped with a few other things today. I will get back to as soon as I can. Thanks for your patience. |
@Meligy I'm also of the opinion that And you're right, jQuery seems to be the only one whose types are reexported. I didn't notice that 😅 |
jQuery request types are also used in I will review this PR today. I only have a few nit picks. I am excited about an official React Native sample. Maybe you can publish it for others and we can link it off the official repo? |
src/authorization_request_handler.ts
Outdated
@@ -79,11 +72,15 @@ export const BUILT_IN_PARAMETERS = ['redirect_uri', 'client_id', 'response_type' | |||
* using various methods (iframe / popup / different process etc.). | |||
*/ | |||
export abstract class AuthorizationRequestHandler { | |||
constructor(public utils: QueryStringUtils) {} | |||
constructor(public utils: QueryStringUtils, generateRandom?: RandomGenerator) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could rewrite this as:
constructor(public utils: QueryStringUtils, generateRandom: RandomGenerator = cryptoGenerateRandom) {
src/crypto_utils.ts
Outdated
|
||
export function generateRandom(sizeInBytes: number = DEFAULT_SIZE) { | ||
let buffer: Uint8Array = new Uint8Array(sizeInBytes); | ||
export const generateRandom: RandomGenerator = (sizeInBytes = DEFAULT_SIZE) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe call this method cryptoGenerateRandom
so we don't have to alias this.
@@ -8,6 +8,7 @@ | |||
], | |||
"rootDir": "src", | |||
"outDir": "built", | |||
"noImplicitAny": true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
I can't believe I did not have this until now :)
@tikurahul I did all the required refactoring now. Also applied default param refactoring to similar constructor params. |
…r args when possible, and use TS import style Remove 'app' from barrel
React Native sample might come, but I'm myself very new to React Native (I run an Angular meetup in Sydney, LOL!) and was only able to work this because I joined an already created project (standing on the shoulders of giants). Maybe in a week or 2 when I manage to feel more comfortable around this. |
Published v0.3.0 for the library. Thanks for the PR @Meligy. |
Also moves TypeScript dependencies to devDependencies
Fixes #35
Fixes #37
Fixes #39
Updates the library version to 0.3.0