diff --git a/cli/helpers.js b/cli/helpers.js index 22148d9..d283a29 100644 --- a/cli/helpers.js +++ b/cli/helpers.js @@ -359,9 +359,8 @@ function parseCommandLineArguments() { default: false, }) .option("remember", { - type: "number", describe: - 'Expiration in days of the "Remember me" checkbox that will save the (salted + hashed) password ' + + 'Integer: expiration in days of the "Remember me" checkbox that will save the (salted + hashed) password ' + 'in localStorage when entered by the user. Set to "false" to hide the box. Default: "0", no expiration.', default: 0, }) diff --git a/cli/index.js b/cli/index.js index d3f8d26..afb96e0 100755 --- a/cli/index.js +++ b/cli/index.js @@ -193,10 +193,13 @@ async function encodeAndGenerateFile( // encrypt input const encryptedMsg = await encodeWithHashedPassword(contents, hashedPassword); + let rememberDurationInDays = parseInt(namedArgs.remember); + rememberDurationInDays = isNaN(rememberDurationInDays) ? 0 : rememberDurationInDays; + const staticryptConfig = { staticryptEncryptedMsgUniqueVariableName: encryptedMsg, isRememberEnabled, - rememberDurationInDays: namedArgs.remember, + rememberDurationInDays, staticryptSaltUniqueVariableName: salt, }; const templateData = { diff --git a/example/encrypted/example.html b/example/encrypted/example.html index 22c018e..ae97cea 100644 --- a/example/encrypted/example.html +++ b/example/encrypted/example.html @@ -768,7 +768,7 @@ exports.init = init; })()); const templateError = "Bad password!", isRememberEnabled = true, - staticryptConfig = {"staticryptEncryptedMsgUniqueVariableName":"85cf880a1573985224adbac66ceeba6c026484ad101ffabc6bc0d874a1e4eb75ddee7d265055e80d8e87369a694f873ff044933e1b5d33c46a636e2fdc4f2d108f0dd36252aba4c2e0f71a8e9ed2027839a6ea46a3e3a5f8e0d205046966c3bd1eac8b78e5ba3a5d9015eea2e0d83629d19c47e0b2311966aa7d3ac2fb8b592276484fea27cd90e5e85e65c11abd483a3d938b738efb02d290e94c9d249844f157667be667ed018f0d0e7702f141ef713c8cc2b472e25922d70cb75955a4182b","isRememberEnabled":true,"rememberDurationInDays":0,"staticryptSaltUniqueVariableName":"b93bbaf35459951c47721d1f3eaeb5b9"}; + staticryptConfig = {"staticryptEncryptedMsgUniqueVariableName":"2271533ff6ba1c6223131c45fe772d77252bb175b03931aaabb9a4be7450f21edd6e55ab868304a493ffb7b5cb4d42ea21c0572063343d472699afd770cb115b6934a767bb7167c6c2737ca06671349e8ebf30bdd24f21f864c522197de1f223399a46c83694428ec32733f9c908697f240c597bea92679e607fe7c1021b2b5795eaf87dc65d981585d6b280ed953a3d744614230c709e09be866f6dfbecc169a31425efed49fc9dd6372b6a3148d9a9612dd3e9a44be08199c89a948a8609b7","isRememberEnabled":true,"rememberDurationInDays":0,"staticryptSaltUniqueVariableName":"b93bbaf35459951c47721d1f3eaeb5b9"}; // you can edit these values to customize some of the behavior of StatiCrypt const templateConfig = { diff --git a/package-lock.json b/package-lock.json index 8600eeb..2fdcd2e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "staticrypt", - "version": "3.3.0", + "version": "3.3.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "staticrypt", - "version": "3.3.0", + "version": "3.3.1", "license": "MIT", "dependencies": { "dotenv": "^16.0.3", diff --git a/package.json b/package.json index 5bbfcf8..47191ca 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "staticrypt", - "version": "3.3.0", + "version": "3.3.1", "description": "Based on the [crypto-js](https://github.com/brix/crypto-js) library, StatiCrypt uses AES-256 to encrypt your input with your long password and put it in a HTML file with a password prompt that can decrypted in-browser (client side).", "main": "index.js", "files": [