aboutsummaryrefslogtreecommitdiffstats
path: root/lang/js/src/gpgmejs.js
diff options
context:
space:
mode:
authorMaximilian Krambach <[email protected]>2018-05-08 16:33:41 +0000
committerMaximilian Krambach <[email protected]>2018-05-08 16:33:41 +0000
commitcca40627b0afa2efc85ef7f5f1a1060a221ff2a2 (patch)
treea77afbd90849bf2da0675e14c0cd41668b32ba56 /lang/js/src/gpgmejs.js
parentjs: fixing errors found by testing: encrypt/decrypt (diff)
downloadgpgme-cca40627b0afa2efc85ef7f5f1a1060a221ff2a2.tar.gz
gpgme-cca40627b0afa2efc85ef7f5f1a1060a221ff2a2.zip
js: more testing
-- * Tests: Under certain circumstances, some data change during encrypt-decrypt. Committing the current state so the problem can be discussed. * Fixes: - disconnecting the test ports after tests are complete - fixed passing of the error message from gpgme-json
Diffstat (limited to 'lang/js/src/gpgmejs.js')
-rw-r--r--lang/js/src/gpgmejs.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/lang/js/src/gpgmejs.js b/lang/js/src/gpgmejs.js
index 9475b2b0..c1a01377 100644
--- a/lang/js/src/gpgmejs.js
+++ b/lang/js/src/gpgmejs.js
@@ -170,18 +170,19 @@ function putData(message, data){
if (!data){
return gpgme_error('PARAM_WRONG');
} else if (data instanceof Uint8Array){
- let decoder = new TextDecoder('utf8');
message.setParameter('base64', true);
- message.setParameter ('data', decoder.decode(data));
+ message.setParameter ('data', btoa(data));
} else if (typeof(data) === 'string') {
message.setParameter('base64', false);
message.setParameter('data', data);
- } else if ( typeof(data) === 'object' && data.hasOwnProperty(getText)){
+ } else if ( typeof(data) === 'object' && data.hasOwnProperty('getText')){
let txt = data.getText();
if (txt instanceof Uint8Array){
- let decoder = new TextDecoder('utf8');
message.setParameter('base64', true);
- message.setParameter ('data', decoder.decode(txt));
+ message.setParameter ('data', btoa(txt));
+ }
+ else {
+ return gpgme_error('PARAM_WRONG');
}
} else {
return gpgme_error('PARAM_WRONG');