-
Notifications
You must be signed in to change notification settings - Fork 2
feat!: http-auth-js library
#32
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
Conversation
Adds a crate that allows to run a local replica using a custom gateway. Prepares the work to customize the ic-gateway
peterpeterparker
left a comment
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.
Not really a review, more rubber stamp with few comments that cross my mind on a quick read.
| * Calculates the ingress expiry timestamp in nanoseconds. | ||
| */ | ||
| function calculateIngressExpiry(expirationTimeMs: number): bigint { | ||
| const expiryTimestampMs = Date.now() + expirationTimeMs; |
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.
in @dfinity/utils there is a nowInBigIntNanoSeconds which can be handy here to remain in nanos
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.
It would be nice to keep this package free of dependencies as much as possible. The current @icp-sdk/core package is there just for speed, but ideally we could move here all the utility functions here
| } | ||
|
|
||
| // Set all authentication headers | ||
| req.headers.set(SIGNATURE_HEADER_NAME, signatureHeaderValue); |
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.
nitpick: found this imperative approach difficult to decrypt, skipped it
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.
What do you mean? Do you have a suggestion on how to improve it?
| } | ||
|
|
||
| function getSignatureHeaderValue(signatureName: SignatureName, signature: ArrayBuffer): string { | ||
| return `${signatureName}=:${base64Encode(signature)}:`; |
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.
No separator constant for =: unlike other separators?
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 wanted to keep the function as the source of truth in this case for better clarity
Rework of the
http-auth-jslibrary to use the new HTTP protocol with BHTTP.Blocked by #31.