Skip to content

Commit

Permalink
Merge pull request #4 from localnerve/rc-0.3.1
Browse files Browse the repository at this point in the history
Rc 0.3.1
  • Loading branch information
localnerve authored Sep 8, 2023
2 parents ec593cf + 45746e3 commit 022986f
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__tests__
test-package
__test_package__
.github
coverage
tmp
Expand Down
4 changes: 3 additions & 1 deletion test-package/functions.js → __test_package__/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ function testEncryptAndDigest(encryptAndDigest) {
hmacSecret,
encryptionKey
});
assert.ok(result);
assert.ok(result, "nothing returned from package");
assert.ok(result.digest.length > 0, 'no digest returned from package');
assert.ok(result.payload.length > 0, 'no payload returned from package');
}

module.exports = {
Expand Down
4 changes: 2 additions & 2 deletions test-package/index.js → __test_package__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ function pack () {
}

/**
* Run `npm i`
* Run `npm i --production=true`
* @returns Promise that resolves on success, rejects with msg on error
*/
function install () {
console.log('--- install ---');
return new Promise((resolve, reject) => {
const install = spawn('npm', ['i'], {
const install = spawn('npm', ['i', '--production=true'], {
cwd: `${localNodeModulesPath}/package`
});
install.on('close', installCode => {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion lib/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ export function encryptAndDigest (input, options) {
export function decryptAndTest (originalDigest, encryptedInput, options) {
const decrypted = symmetricDecrypt(encryptedInput, options);
const digest = generateHmac(decrypted, options);
const ok = originalDigest && digest && digest === originalDigest;
return {
ok: digest === originalDigest,
ok,
decrypted
};
}
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@localnerve/hmac-symmetric",
"version": "0.3.0",
"version": "0.3.1",
"description": "A library to generate hmac and symmetrically encrypted payloads",
"main": "index.js",
"type": "module",
Expand All @@ -18,7 +18,7 @@
"transpile": "babel lib -d cjs --out-file-extension .cjs",
"posttranspile": "node posttranspile.js",
"test": "cross-env HS_HMAC_SECRET=deadbeef HS_ENCRYPTION_KEY=56c6a9c6fb56a39e05fb993918ab01dda24439e2658dd7b06aa0f8fcc7fe0627 jest && npm run test-package",
"test-package": "node ./test-package/index.js"
"test-package": "node ./__test_package__/index.js"
},
"repository": {
"type": "git",
Expand All @@ -44,14 +44,14 @@
},
"homepage": "https://github.com/localnerve/hmac-symmetric#readme",
"devDependencies": {
"@babel/cli": "^7.22.10",
"@babel/preset-env": "^7.22.14",
"@babel/cli": "^7.22.15",
"@babel/preset-env": "^7.22.15",
"cross-env": "^7.0.3",
"rimraf": "^5.0.1",
"jest": "^29.6.4",
"eslint": "^8.48.0",
"tar": "^6.1.15",
"glob": "^10.3.3"
"tar": "^6.2.0",
"glob": "^10.3.4"
},
"engines": {
"node": ">= 16"
Expand Down
Binary file removed test-package/public/images/1997805.png
Binary file not shown.

0 comments on commit 022986f

Please sign in to comment.