diff --git a/README.md b/README.md index bdd0071..6a8ecfe 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ Data Source is a JS library meant to help developers access Movable Ink Data Sou - [Details on how Sorcerer determines priority](#details-on-how-sorcerer-determines-priority) - [Publishing package:](#publishing-package) - [Changelog](#changelog) + - [4.1.0](#410) - [3.2.3](#323) - [3.2.2](#322) - [3.2.1](#321) @@ -337,6 +338,10 @@ $ npm publish ## Changelog +### 4.1.0 + +- allows to pass sha512 algorithm for HMAC token + ### 3.2.3 - Fixes `x-mi-cbe` header hash calculation to use correct `x-cache-ignore-query-params` header diff --git a/docs/token-builder.md b/docs/token-builder.md index 4efdbe4..1dcea37 100644 --- a/docs/token-builder.md +++ b/docs/token-builder.md @@ -99,7 +99,7 @@ HMAC uses symmetric encryption which means the signature requires a shared secre **Params** - **options** (required) - **stringToSign** (optional) - any string that will be used when generating HMAC signature - - **algorithm** (required)- the hashing algorithm: `sha1` , `sha256`, `md5` + - **algorithm** (required)- the hashing algorithm: `sha1` , `sha256`, `sha512`, `md5` - **secretName** (required) - name of the data source secret (e.g. `watson`) - **encoding** (required) - option to encode the signature once it is generated: `hex`, `base64`, `base64url`, `base64percent` - `base64url` produces the same result as `base64` but in addition also replaces `+` with `-` , `/` with `_` , and removes the trailing padding character `=` diff --git a/package.json b/package.json index 342e548..3c988b2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@movable-internal/data-source.js", - "version": "4.0.0", + "version": "4.1.0", "main": "./dist/index.js", "module": "./dist/index.es.js", "license": "MIT", diff --git a/src/token-builder/types.js b/src/token-builder/types.js index e99e622..0022cfb 100644 --- a/src/token-builder/types.js +++ b/src/token-builder/types.js @@ -1,4 +1,4 @@ -const ALLOWED_ALGOS = new Set(['sha256', 'sha1', 'md5']); +const ALLOWED_ALGOS = new Set(['sha256', 'sha1', 'md5', 'sha512']); const ALLOWED_ENCODINGS = new Set(['hex', 'base64', 'base64url', 'base64percent']); export const CHAR_LIMIT = 100;