Skip to content

Commit

Permalink
Updating README and cleaning to release 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dassiorleando committed May 9, 2020
1 parent 1eb5042 commit 530e33d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ node_js:
install:
- npm install
script:
- npm run test
- npm run test
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ const paykickstartIPNValidator = require('paykickstart-ipn-validator');

paykickstartIPNValidator(ipn, secret);
// => true or false

paykickstartIPNValidator(ipn); // Assuming the secret is defined by the env var
// => true or false
```

**Note:** The secret is optional, its default value is the env var *PAYKICKSTART_SECRET_KEY*. Good so that you keep your precious secretKey out of your your repo.
Expand Down
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ const crypto = require('crypto');
* @param secretKey Secret key defined into your campaign (INTEGRATIONS section), by default it's the env var PAYKICKSTART_SECRET_KEY
*/
module.exports = function (ipn, secretKey = process.env.PAYKICKSTART_SECRET_KEY) {
if (typeof ipn !== 'object' || !secretKey) {
throw new Error('IPN data and secretKey are required!');
}
if (typeof ipn !== 'object' || !secretKey) {
throw new Error('IPN data and secretKey are required!');
}

const ipnHash = ipn.hash; // Hash received
const ipnHash = ipn.hash; // Hash received

// Sorting the keys alphabetically
// Sorting the keys alphabetically then picking the good values
const sortedData = [];
Object.keys(ipn).sort().forEach(function(key) {
// Trim and ommit falsies values
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": "paykickstart-ipn-validator",
"version": "0.9.0",
"version": "1.0.0",
"description": "A zero-dependency package that verifies incoming IPN notifications from PayKickStart.",
"license": "MIT",
"repository": "dassiorleando/paykickstart-ipn-validator",
Expand Down

0 comments on commit 530e33d

Please sign in to comment.