Skip to content

Commit

Permalink
removes toUpperCase from signature calculation (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterSlave authored Jan 20, 2021
1 parent 386e558 commit 98cf8cb
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 1 addition & 1 deletion src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function generateRandomString(length = 6): string {
export function calculateSignature({apiKey, secretKey, url, body, randomStr}: { apiKey: string; secretKey: string; url: string; randomStr: string; body?: string }): string {
const hashStr: string = [url, apiKey, secretKey, randomStr, body].filter(s => !!s).join('');
const hash = crypto.SHA256(hashStr);
return crypto.enc.Base64.stringify(hash).toUpperCase();
return crypto.enc.Base64.stringify(hash);
}

/**
Expand Down
1 change: 0 additions & 1 deletion test/lib/HttpClient.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const MockAdapter = require('axios-mock-adapter');

const {HttpClient} = require('../../dist/lib/HttpClient');
const CraftgateError = require('../../dist').CraftgateError;
const {calculateSignature} = require('../../dist/lib/utils');

test('HttpClient should translate API errors to CraftgateError errors when status code is 200', async t => {
const client = new HttpClient({
Expand Down

0 comments on commit 98cf8cb

Please sign in to comment.