feat: [EXT-2244] create signature#11
Merged
Manuel Spagnolo (shikaan) merged 28 commits intomasterfrom Nov 2, 2020
Merged
Conversation
…e rest This includes: * fix typings to always expect signed headers * streamline test mocks
de63e8d to
f6df31d
Compare
| export const sortHeaderKeys = (keyA: string, keyB: string) => (keyA > keyB ? 1 : -1) | ||
|
|
||
| const normalizeHeaderKey = (key: string) => key.toLowerCase().trim() | ||
| const normalizeHeaderValue = (value: string) => value.trim() |
Contributor
Author
There was a problem hiding this comment.
Removed the URI encoding because unnecessary according to the specification.
Plus, it's unstable (as in, you cannot compose encodings) which defeats the purpose of normalization.
John Whiles (Jwhiles)
approved these changes
Nov 2, 2020
|
🎉 This PR is included in version 1.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
| * Pass `rawTimeToLive = 0` to disable TTL checks. | ||
| * | ||
| * ~~~ | ||
| * const {isVerifiedRequest} = require('contentful-node-apps-toolkit') |
There was a problem hiding this comment.
Should be verifyRequest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
This method allows creating a hash of a Canonical Request (as in, an object representing only what concerns business logic), based on a secret and a timestamp.
In the inline documentation there's an example of how the method is expected to be used in a real world scenario, which should exemplify what are the secret and the timestamp for.
Edit
Given the confusion created by handling verification in another PR, I have done everything in here. Also added documentation for that (slightly less verbose than the one for create-signature because some ideas were overlapping).