js: return base64 after encrypt with armor=false

--

* src/gpgmejs.js/encrypt: the encrypted data were converted back to a
  (incorrect) string, whereas they should be data with no encoding
  specified. Returning base64 data is the expected way.
* DemoExtension: caught yet another usage of old syntax.
This commit is contained in:
Maximilian Krambach 2018-08-29 17:45:55 +02:00
parent 18ea838671
commit 61ac70cfb5
2 changed files with 7 additions and 3 deletions

View File

@ -29,7 +29,7 @@ document.addEventListener('DOMContentLoaded', function () {
function (){
let data = document.getElementById('inputtext').value;
let keyId = document.getElementById('pubkey').value;
gpgmejs.encrypt({ data: data, privateKeys: keyId }).then(
gpgmejs.encrypt({ data: data, publicKeys: keyId, armor:false }).then(
function (answer){
if (answer.data){
document.getElementById(

View File

@ -154,8 +154,12 @@ export class GpgME {
if (msg instanceof Error){
return Promise.reject(msg);
}
msg.setParameter('armor', armor);
if (armor === false){
msg.setParameter('armor', false);
msg.expected = 'base64';
} else if (armor === true) {
msg.setParameter('armor', true);
}
if (base64 === true) {
msg.setParameter('base64', true);
}