Added support to lookup public keys online #89

This commit is contained in:
the-djmaze 2024-02-07 01:55:52 +01:00
parent bac6c2d332
commit 6c01db395d
4 changed files with 47 additions and 9 deletions

View file

@ -4,11 +4,16 @@ import { OpenPGPUserStore } from 'Stores/User/OpenPGP';
import { AbstractViewPopup } from 'Knoin/AbstractViews';
import Remote from 'Remote/User/Fetch';
import { i18n } from 'Common/Translator';
export class OpenPgpImportPopupView extends AbstractViewPopup {
constructor() {
super('OpenPgpImport');
addObservablesTo(this, {
search: '',
key: '',
keyError: false,
keyErrorMessage: '',
@ -25,6 +30,21 @@ export class OpenPgpImportPopupView extends AbstractViewPopup {
});
}
searchPGP() {
this.key(i18n('SUGGESTIONS/SEARCHING_DESC'));
Remote.request('SearchPGPKey',
(iError, oData) => {
if (iError) {
this.key(oData.ErrorMessage);
} else {
this.key(oData.Result);
}
}, {
query: this.search()
}
);
}
submitForm() {
let keyTrimmed = this.key().trim();