Skip to content

Commit 8b1f664

Browse files
Merge pull request #72 from movableink/mt/hmac-sha512
feat: add support for HMAC sha512
2 parents 0f5ee5b + 1524a0a commit 8b1f664

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Data Source is a JS library meant to help developers access Movable Ink Data Sou
1919
- [Details on how Sorcerer determines priority](#details-on-how-sorcerer-determines-priority)
2020
- [Publishing package:](#publishing-package)
2121
- [Changelog](#changelog)
22+
- [4.1.0](#410)
2223
- [3.2.3](#323)
2324
- [3.2.2](#322)
2425
- [3.2.1](#321)
@@ -337,6 +338,10 @@ $ npm publish
337338

338339
## Changelog
339340

341+
### 4.1.0
342+
343+
- allows to pass sha512 algorithm for HMAC token
344+
340345
### 3.2.3
341346

342347
- Fixes `x-mi-cbe` header hash calculation to use correct `x-cache-ignore-query-params` header

docs/token-builder.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ HMAC uses symmetric encryption which means the signature requires a shared secre
9999
**Params**
100100
- **options** (required)
101101
- **stringToSign** (optional) - any string that will be used when generating HMAC signature
102-
- **algorithm** (required)- the hashing algorithm: `sha1` , `sha256`, `md5`
102+
- **algorithm** (required)- the hashing algorithm: `sha1` , `sha256`, `sha512`, `md5`
103103
- **secretName** (required) - name of the data source secret (e.g. `watson`)
104104
- **encoding** (required) - option to encode the signature once it is generated: `hex`, `base64`, `base64url`, `base64percent`
105105
- `base64url` produces the same result as `base64` but in addition also replaces `+` with `-` , `/` with `_` , and removes the trailing padding character `=`

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@movable-internal/data-source.js",
3-
"version": "4.0.0",
3+
"version": "4.1.0",
44
"main": "./dist/index.js",
55
"module": "./dist/index.es.js",
66
"license": "MIT",

src/token-builder/types.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const ALLOWED_ALGOS = new Set(['sha256', 'sha1', 'md5']);
1+
const ALLOWED_ALGOS = new Set(['sha256', 'sha1', 'md5', 'sha512']);
22
const ALLOWED_ENCODINGS = new Set(['hex', 'base64', 'base64url', 'base64percent']);
33

44
export const CHAR_LIMIT = 100;

0 commit comments

Comments
 (0)