aboutsummaryrefslogtreecommitdiffstats
path: root/lang/js/testapplication.js
blob: d01aca998e8662675ebc4bbd361525f2ce30ea05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/**
* Testing nativeMessaging. This is a temporary plugin using the gpgmejs
  implemetation as contained in src/
*/
function buttonclicked(event){
    let data = document.getElementById("text0").value;
    let keyId = document.getElementById("key").value;
    let enc = Gpgmejs.encrypt(data, [keyId]).then(function(answer){
        console.log(answer);
        console.log(answer.type);
        console.log(answer.data);
        alert(answer.data);
    }, function(errormsg){
        alert('Error: '+ errormsg);
    });
};

document.addEventListener('DOMContentLoaded', function() {
    document.getElementById("button0").addEventListener("click",
    buttonclicked);
  });