Skip to content
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

feat: add support for HMAC sha512 #72

Merged
merged 4 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/token-builder.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `=`
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/token-builder/types.js
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Loading