1
0
mirror of synced 2024-12-01 01:37:18 +01:00

Fix decrypt operation

This commit is contained in:
Matt C 2018-01-12 11:45:16 +00:00
parent bfbefb7318
commit f07263ca2a
3 changed files with 10932 additions and 10943 deletions

23
package-lock.json generated
View File

@ -1069,7 +1069,6 @@
"version": "6.26.0", "version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-polyfill/-/babel-polyfill-6.26.0.tgz", "resolved": "https://registry.npmjs.org/babel-polyfill/-/babel-polyfill-6.26.0.tgz",
"integrity": "sha1-N5k3q8Z9eJWXCtxiHyhM2WbPIVM=", "integrity": "sha1-N5k3q8Z9eJWXCtxiHyhM2WbPIVM=",
"dev": true,
"requires": { "requires": {
"babel-runtime": "6.26.0", "babel-runtime": "6.26.0",
"core-js": "2.5.1", "core-js": "2.5.1",
@ -1212,7 +1211,6 @@
"version": "6.26.0", "version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz",
"integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=",
"dev": true,
"requires": { "requires": {
"core-js": "2.5.1", "core-js": "2.5.1",
"regenerator-runtime": "0.11.0" "regenerator-runtime": "0.11.0"
@ -1221,8 +1219,7 @@
"regenerator-runtime": { "regenerator-runtime": {
"version": "0.11.0", "version": "0.11.0",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.0.tgz", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.0.tgz",
"integrity": "sha512-/aA0kLeRb5N9K0d4fw7ooEbI+xDe+DKD499EQqygGqeS8N3xto15p09uY2xj7ixP81sNPXvRLnAQIqdVStgb1A==", "integrity": "sha512-/aA0kLeRb5N9K0d4fw7ooEbI+xDe+DKD499EQqygGqeS8N3xto15p09uY2xj7ixP81sNPXvRLnAQIqdVStgb1A=="
"dev": true
} }
} }
}, },
@ -1965,8 +1962,7 @@
"core-js": { "core-js": {
"version": "2.5.1", "version": "2.5.1",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.1.tgz", "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.1.tgz",
"integrity": "sha1-rmh03GaTd4m4B1T/VCjfZoGcpQs=", "integrity": "sha1-rmh03GaTd4m4B1T/VCjfZoGcpQs="
"dev": true
}, },
"core-util-is": { "core-util-is": {
"version": "1.0.2", "version": "1.0.2",
@ -6150,12 +6146,6 @@
"integrity": "sha1-edk9LTM2PW/dKXCzNdkUGtWR15s=", "integrity": "sha1-edk9LTM2PW/dKXCzNdkUGtWR15s=",
"dev": true "dev": true
}, },
"killable": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/killable/-/killable-1.0.0.tgz",
"integrity": "sha1-2ouEvUfeU5WHj5XWTQLyRJ/gXms=",
"dev": true
},
"keybase-ecurve": { "keybase-ecurve": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/keybase-ecurve/-/keybase-ecurve-1.0.0.tgz", "resolved": "https://registry.npmjs.org/keybase-ecurve/-/keybase-ecurve-1.0.0.tgz",
@ -6181,6 +6171,12 @@
} }
} }
}, },
"killable": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/killable/-/killable-1.0.0.tgz",
"integrity": "sha1-2ouEvUfeU5WHj5XWTQLyRJ/gXms=",
"dev": true
},
"kind-of": { "kind-of": {
"version": "3.2.2", "version": "3.2.2",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
@ -8722,8 +8718,7 @@
"regenerator-runtime": { "regenerator-runtime": {
"version": "0.10.5", "version": "0.10.5",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz",
"integrity": "sha1-M2w+/BIgrc7dosn6tntaeVWjNlg=", "integrity": "sha1-M2w+/BIgrc7dosn6tntaeVWjNlg="
"dev": true
}, },
"regenerator-transform": { "regenerator-transform": {
"version": "0.10.1", "version": "0.10.1",

View File

@ -32,10 +32,9 @@
"devDependencies": { "devDependencies": {
"babel-core": "^6.26.0", "babel-core": "^6.26.0",
"babel-loader": "^7.1.2", "babel-loader": "^7.1.2",
"babel-preset-env": "^1.6.1", "babel-preset-env": "^1.6.0",
"babel-plugin-transform-runtime": "^6.23.0", "babel-plugin-transform-runtime": "^6.23.0",
"babel-polyfill": "^6.26.0", "babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.6.0",
"babel-preset-es2015": "^6.24.1", "babel-preset-es2015": "^6.24.1",
"babel-preset-stage-0": "^6.24.1", "babel-preset-stage-0": "^6.24.1",
"css-loader": "^0.28.7", "css-loader": "^0.28.7",
@ -79,7 +78,6 @@
"bootstrap-switch": "^3.3.4", "bootstrap-switch": "^3.3.4",
"crypto-api": "^0.7.5", "crypto-api": "^0.7.5",
"crypto-js": "^3.1.9-1", "crypto-js": "^3.1.9-1",
"diff": "^3.4.0",
"diff": "^3.3.1", "diff": "^3.3.1",
"es6-promisify": "^5.0.0", "es6-promisify": "^5.0.0",
"escodegen": "^1.9.0", "escodegen": "^1.9.0",

View File

@ -145,7 +145,6 @@ const PGP = {
armored: plainPubKey, armored: plainPubKey,
}); });
} catch (err) { } catch (err) {
console.error(err);
throw `Could not import public key: ${err}`; throw `Could not import public key: ${err}`;
} }
@ -155,13 +154,10 @@ const PGP = {
encrypt_for: key, encrypt_for: key,
}); });
} catch (err) { } catch (err) {
console.error(err); throw `Couldn't encrypt message with provided public key: ${err}`;
throw `Could encrypt message to provided public key: ${err}`;
} }
console.log(encryptedMessage); return encryptedMessage.toString();
return encryptedMessage;
}, },
async runDecrypt(input, args) { async runDecrypt(input, args) {
@ -187,10 +183,10 @@ const PGP = {
keyfetch: keyring, keyfetch: keyring,
}); });
} catch (err) { } catch (err) {
throw `Could decrypt message to provided private key: ${err}`; throw `Couldn't decrypt message with provided private key: ${err}`;
} }
return plaintextMessage; return plaintextMessage.toString();
}, },
}; };