-
Notifications
You must be signed in to change notification settings - Fork 618
V4 Signer #36
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
Merged
Merged
V4 Signer #36
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
4afce59
Add a VM- and WebWorker-safe way to check if an object is an ArrayBuffer
jeskew ccb9177
Document expectations on headers and querystring params
jeskew dfa77ea
WIP commit
jeskew 9d21a7f
WIP commit
jeskew a646f70
Add a node stream collector
jeskew 7301285
Add a hex encoding package
jeskew 20142ba
Add tests for getCanonicalQuery
jeskew a7041ae
Add tests for getPayloadHash
jeskew 03e6496
Remove dependency on and use of stream collectors. Streams should be …
jeskew c82cf03
Add tests to fully cover SignatureV4::signRequest
jeskew 20e894a
Remove unused packages
jeskew ea9a309
Update RequestSigner interface to take keywords args instead of posit…
jeskew fcfc2a2
Add presigner and functional and unit tests
jeskew f9ed580
Cover the last uncovered line of code
jeskew f91b4bb
Allow the set of unsignable headers to be customized
jeskew File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*.js | ||
*.js.map | ||
*.d.ts |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import {isArrayBuffer} from "../"; | ||
|
||
describe('isArrayBuffer', () => { | ||
const arrayBufferConstructor = ArrayBuffer; | ||
|
||
afterEach(() => { | ||
(ArrayBuffer as any) = arrayBufferConstructor; | ||
}); | ||
|
||
it('should return true for ArrayBuffer objects', () => { | ||
expect(isArrayBuffer(new ArrayBuffer(0))).toBe(true); | ||
}); | ||
|
||
it('should return false for ArrayBufferView objects', () => { | ||
const view = new Uint8Array(0); | ||
|
||
expect(isArrayBuffer(view)).toBe(false); | ||
expect(isArrayBuffer(view.buffer)).toBe(true); | ||
}); | ||
|
||
it('should return false for scalar values', () => { | ||
for (let scalar of ['string', 123.234, true, null, void 0]) { | ||
expect(isArrayBuffer(scalar)).toBe(false); | ||
} | ||
}); | ||
|
||
it( | ||
'should return true for ArrayBuffers created with a different instance of the ArrayBuffer constructor', | ||
() => { | ||
const buffer = new ArrayBuffer(0); | ||
(ArrayBuffer as any) = () => buffer; | ||
|
||
expect(buffer).not.toBeInstanceOf(ArrayBuffer); | ||
expect(isArrayBuffer(buffer)).toBe(true); | ||
} | ||
); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export function isArrayBuffer(arg: any): arg is ArrayBuffer { | ||
return typeof ArrayBuffer === 'function' | ||
&& ( | ||
arg instanceof ArrayBuffer || | ||
Object.prototype.toString.call(arg) === '[object ArrayBuffer]' | ||
); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "@aws/is-array-buffer", | ||
"private": true, | ||
"version": "0.0.1", | ||
"description": "Provides a function for detecting if an argument is an ArrayBuffer", | ||
"scripts": { | ||
"pretest": "tsc", | ||
"test": "jest" | ||
}, | ||
"author": "[email protected]", | ||
"license": "UNLICENSED", | ||
"main": "index.js", | ||
"devDependencies": { | ||
"@types/jest": "^20.0.2", | ||
"@types/node": "^7.0.12", | ||
"jest": "^20.0.4", | ||
"typescript": "^2.3" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es5", | ||
"module": "commonjs", | ||
"declaration": true, | ||
"strict": true, | ||
"sourceMap": true | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/node_modules/ | ||
*.js | ||
*.js.map | ||
*.d.ts |
Oops, something went wrong.
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.
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.
Nice test! Take that, frames!
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.
Turns out to be surprisingly relevant to running Jest, too.