aboutsummaryrefslogtreecommitdiffstats
path: root/lang/js/src/gpgmejs.js
diff options
context:
space:
mode:
authorMaximilian Krambach <[email protected]>2018-06-08 15:54:58 +0000
committerMaximilian Krambach <[email protected]>2018-06-08 15:54:58 +0000
commitc072675f3f2d734297a348c6de810148fb1424a2 (patch)
tree9e0ddfd642f26b6adfd793a7db9241c404bb891d /lang/js/src/gpgmejs.js
parentjs: change Keyinfo timestamps into javascript date (diff)
downloadgpgme-c072675f3f2d734297a348c6de810148fb1424a2.tar.gz
gpgme-c072675f3f2d734297a348c6de810148fb1424a2.zip
js: change chunksize handling and decoding
-- * the nativeApp now sends all data in one base64-encoded string, which needs reassembly, but in a much easier way now. * there are some new performance problems now, especially with decrypting data
Diffstat (limited to 'lang/js/src/gpgmejs.js')
-rw-r--r--lang/js/src/gpgmejs.js22
1 files changed, 9 insertions, 13 deletions
diff --git a/lang/js/src/gpgmejs.js b/lang/js/src/gpgmejs.js
index cbad9021..09bca7f9 100644
--- a/lang/js/src/gpgmejs.js
+++ b/lang/js/src/gpgmejs.js
@@ -57,8 +57,8 @@ export class GpgME {
* Keys used to encrypt the message
* @param {GPGME_Key|String|Array<String>|Array<GPGME_Key>} secretKeys
* (optional) Keys used to sign the message
- * @param {Boolean} base64 (optional) The data is already considered to be
- * in base64 encoding
+ * @param {Boolean} base64 (optional) The data will be interpreted as
+ * base64 encoded data
* @param {Boolean} armor (optional) Request the output as armored block
* @param {Boolean} wildcard (optional) If true, recipient information will
* not be added to the message
@@ -109,24 +109,20 @@ export class GpgME {
* Decrypt a Message
* @param {String|Object} data text/data to be decrypted. Accepts Strings
* and Objects with a getText method
- * @param {Boolean} base64 (optional) Response is expected to be base64
- * encoded
* @returns {Promise<Object>} decrypted message:
- data: The decrypted data. This may be base64 encoded.
+ data: The decrypted data.
base64: Boolean indicating whether data is base64 encoded.
mime: A Boolean indicating whether the data is a MIME object.
signatures: Array of signature Objects TODO not yet implemented.
- // should be an object that can tell if all signatures are valid .
+ // should be an object that can tell if all signatures are valid.
* @async
*/
- decrypt(data, base64=false){
+ decrypt(data){
if (data === undefined){
return Promise.reject(gpgme_error('MSG_EMPTY'));
}
let msg = createMessage('decrypt');
- if (base64 === true){
- msg.expected = 'base64';
- }
+
if (msg instanceof Error){
return Promise.reject(msg);
}
@@ -165,10 +161,10 @@ export class GpgME {
}
msg.setParameter('mode', mode);
putData(msg, data);
- if (mode === 'detached') {
- msg.expected = 'base64';
- }
return new Promise(function(resolve,reject) {
+ if (mode ==='detached'){
+ msg.expect= 'base64';
+ }
msg.post().then( function(message) {
if (mode === 'clearsign'){
resolve({