aboutsummaryrefslogtreecommitdiffstats
path: root/lang/js/DemoExtension/maindemo.js
diff options
context:
space:
mode:
Diffstat (limited to 'lang/js/DemoExtension/maindemo.js')
-rw-r--r--lang/js/DemoExtension/maindemo.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/lang/js/DemoExtension/maindemo.js b/lang/js/DemoExtension/maindemo.js
index d0127c73..4cae934e 100644
--- a/lang/js/DemoExtension/maindemo.js
+++ b/lang/js/DemoExtension/maindemo.js
@@ -98,5 +98,22 @@ document.addEventListener('DOMContentLoaded', function() {
alert( errormsg.message);
});
});
+ document.getElementById('searchkey').addEventListener('click',
+ function(){
+ let data = document.getElementById('inputtext').value;
+ gpgmejs.Keyring.getKeys(data, true, true).then(function(keys){
+ if (keys.length === 1){
+ document.getElementById(
+ 'pubkey').value = keys[0].fingerprint;
+ } else if (keys.length > 1) {
+ alert('The pattern was not unambigious enough for a Key. '
+ + keys.length + ' Keys were found');
+ } else {
+ alert('No keys found');
+ }
+ }, function(errormsg){
+ alert( errormsg.message);
+ });
+ });
});
});