1
0
mirror of synced 2024-11-13 18:00:52 +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",
"resolved": "https://registry.npmjs.org/babel-polyfill/-/babel-polyfill-6.26.0.tgz",
"integrity": "sha1-N5k3q8Z9eJWXCtxiHyhM2WbPIVM=",
"dev": true,
"requires": {
"babel-runtime": "6.26.0",
"core-js": "2.5.1",
@ -1212,7 +1211,6 @@
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz",
"integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=",
"dev": true,
"requires": {
"core-js": "2.5.1",
"regenerator-runtime": "0.11.0"
@ -1221,8 +1219,7 @@
"regenerator-runtime": {
"version": "0.11.0",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.0.tgz",
"integrity": "sha512-/aA0kLeRb5N9K0d4fw7ooEbI+xDe+DKD499EQqygGqeS8N3xto15p09uY2xj7ixP81sNPXvRLnAQIqdVStgb1A==",
"dev": true
"integrity": "sha512-/aA0kLeRb5N9K0d4fw7ooEbI+xDe+DKD499EQqygGqeS8N3xto15p09uY2xj7ixP81sNPXvRLnAQIqdVStgb1A=="
}
}
},
@ -1965,8 +1962,7 @@
"core-js": {
"version": "2.5.1",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.1.tgz",
"integrity": "sha1-rmh03GaTd4m4B1T/VCjfZoGcpQs=",
"dev": true
"integrity": "sha1-rmh03GaTd4m4B1T/VCjfZoGcpQs="
},
"core-util-is": {
"version": "1.0.2",
@ -6150,12 +6146,6 @@
"integrity": "sha1-edk9LTM2PW/dKXCzNdkUGtWR15s=",
"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": {
"version": "1.0.0",
"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": {
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
@ -8722,8 +8718,7 @@
"regenerator-runtime": {
"version": "0.10.5",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz",
"integrity": "sha1-M2w+/BIgrc7dosn6tntaeVWjNlg=",
"dev": true
"integrity": "sha1-M2w+/BIgrc7dosn6tntaeVWjNlg="
},
"regenerator-transform": {
"version": "0.10.1",

View File

@ -32,10 +32,9 @@
"devDependencies": {
"babel-core": "^6.26.0",
"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-polyfill": "^6.26.0",
"babel-preset-env": "^1.6.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"css-loader": "^0.28.7",
@ -79,7 +78,6 @@
"bootstrap-switch": "^3.3.4",
"crypto-api": "^0.7.5",
"crypto-js": "^3.1.9-1",
"diff": "^3.4.0",
"diff": "^3.3.1",
"es6-promisify": "^5.0.0",
"escodegen": "^1.9.0",

View File

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