simple-hmac-auth
Advanced tools
Comparing version 3.3.0 to 3.3.1
{ | ||
"name": "simple-hmac-auth", | ||
"version": "3.3.0", | ||
"version": "3.3.1", | ||
"description": "Library designed to make building APIs that use HMAC signatures simple.", | ||
@@ -28,3 +28,3 @@ "keywords": [ | ||
"scripts": { | ||
"lint": "eslint .", | ||
"lint": "eslint . && editorconfig-checker", | ||
"test": "jest" | ||
@@ -34,2 +34,3 @@ }, | ||
"devDependencies": { | ||
"editorconfig-checker": "^3.0.4", | ||
"eslint": "^6.8.0", | ||
@@ -36,0 +37,0 @@ "jest": "^25.3.0" |
@@ -5,6 +5,5 @@ # simple-hmac-auth | ||
[![test](https://github.com/jessety/simple-hmac-auth/workflows/test/badge.svg)](https://github.com/jessety/simple-hmac-auth/actions?query=workflow%3Atest) | ||
[![lint](https://github.com/jessety/simple-hmac-auth/workflows/lint/badge.svg)](https://github.com/jessety/simple-hmac-auth/actions?query=workflow%3Alint) | ||
[![ci](https://github.com/jessety/simple-hmac-auth/workflows/ci/badge.svg)](https://github.com/jessety/simple-hmac-auth/actions) | ||
[![npm](https://img.shields.io/npm/v/simple-hmac-auth.svg)](https://www.npmjs.com/package/simple-hmac-auth) | ||
[![license](https://img.shields.io/github/license/jessety/simple-hmac-auth.svg)](https://github.com/jessety/simple-hmac-auth/blob/master/LICENSE) | ||
[![npm](https://img.shields.io/npm/v/simple-hmac-auth.svg)](https://www.npmjs.com/package/simple-hmac-auth) | ||
@@ -36,3 +35,3 @@ - [Specification](#specification) | ||
#### Headers | ||
### Headers | ||
@@ -59,3 +58,3 @@ Each request requires three headers: `date`, `authorization` and `signature`. If the HTTP request contains a body, the `content-length` and `content-type` headers are also required. | ||
#### Signature | ||
### Signature | ||
@@ -67,7 +66,7 @@ To calculate the signature, the client first needs to create a string representation of the request. When the server receives an authenticated request it computes the the signature and compares it with the signature provided by the client. Therefore, the client must create a string representation of the request in the exact same way as the server. This is called "canonicalization." | ||
```text | ||
HTTP Verb + \n | ||
URI + \n | ||
Canonical query string + \n | ||
Canonically formatted signed headers + \n | ||
Hashed body payload | ||
HTTP Verb + \n | ||
URI + \n | ||
Canonical query string + \n | ||
Canonically formatted signed headers + \n | ||
Hashed body payload | ||
``` | ||
@@ -135,2 +134,3 @@ | ||
First, instantiate the class. | ||
```javascript | ||
@@ -199,3 +199,3 @@ const SimpleHMACAuth = require('simple-hmac-auth'); | ||
try { | ||
try { | ||
@@ -273,9 +273,10 @@ await auth.authenticate(request, true); | ||
Promise | ||
```javascript | ||
client.request(options).then(results => { | ||
console.log(results); | ||
}).catch(error => { | ||
console.log('Error:', error); | ||
@@ -291,3 +292,3 @@ }); | ||
const results = await client.request(options); | ||
console.log(results); | ||
@@ -355,3 +356,3 @@ | ||
const results = await client.query({ test: true }); | ||
console.log(results); | ||
@@ -358,0 +359,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
382
41242
3