Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

simple-hmac-auth

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-hmac-auth - npm Package Compare versions

Comparing version 3.3.0 to 3.3.1

5

package.json
{
"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"

33

README.md

@@ -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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc