Added button to import keys from server into OpenPGP.js #89

This commit is contained in:
the-djmaze 2024-02-07 02:29:22 +01:00
parent 6c01db395d
commit f8002151be
41 changed files with 76 additions and 1 deletions

View file

@ -15,7 +15,7 @@ import { showScreenPopup } from 'Knoin/Knoin';
import { OpenPgpImportPopupView } from 'View/Popup/OpenPgpImport';
import { OpenPgpGeneratePopupView } from 'View/Popup/OpenPgpGenerate';
//import Remote from 'Remote/User/Fetch';
import Remote from 'Remote/User/Fetch';
export class UserSettingsSecurity extends AbstractViewSettings {
constructor() {
@ -56,6 +56,16 @@ export class UserSettingsSecurity extends AbstractViewSettings {
showScreenPopup(OpenPgpGeneratePopupView);
}
importToOpenPGP() {
OpenPGPUserStore.isSupported() && Remote.request('GetPGPKeys',
(iError, oData) => {
if (!iError && oData.Result) {
oData.Result.forEach(key => OpenPGPUserStore.importKey(key));
}
}
);
}
onBuild() {
/**
* Create an iframe to display the Mailvelope keyring settings.

View file

@ -10,6 +10,32 @@ trait Pgp
* Also see trait Messages::DoMessagePgpVerify
*/
public function DoGetPGPKeys() : array
{
$result = [];
$keys = \SnappyMail\PGP\Backup::getKeys();
foreach ($keys['public'] as $key) {
$result[] = $key['value'];
}
foreach ($keys['private'] as $key) {
$result[] = $key['value'];
}
$GPG = $this->GnuPG();
if ($GPG) {
$keys = $GPG->keyInfo('');
foreach ($keys['public'] as $key) {
$key = $GPG->export($key['subkeys'][0]['fingerprint'] ?: $key['subkeys'][0]['keyid']);
if ($key) {
$result[] = $key;
}
}
}
return $this->DefaultResponse(\array_values(\array_unique($result)));
}
public function DoSearchPGPKey() : array
{
$result = \SnappyMail\PGP\Keyservers::get(

View file

@ -515,6 +515,7 @@
"SETTINGS_OPENPGP": {
"BUTTON_IMPORT_KEY": " إستيراد مفتاح",
"BUTTON_GENERATE_KEY_PAIR": " توليد مفتاح",
"IMPORT_FROM_SERVER": "Import from server",
"TITLE_PRIVATE": "خاص",
"TITLE_PUBLIC": "عام",
"GET_MAILVELOPE": "Get Mailvelope browser add-on."

View file

@ -515,6 +515,7 @@
"SETTINGS_OPENPGP": {
"BUTTON_IMPORT_KEY": "Внеси ключ",
"BUTTON_GENERATE_KEY_PAIR": "Генерирай ключ",
"IMPORT_FROM_SERVER": "Import from server",
"TITLE_PRIVATE": "Частен",
"TITLE_PUBLIC": "Публичен",
"GET_MAILVELOPE": "Get Mailvelope browser add-on."

View file

@ -515,6 +515,7 @@
"SETTINGS_OPENPGP": {
"BUTTON_IMPORT_KEY": "Importovat klíč",
"BUTTON_GENERATE_KEY_PAIR": "Generovat klíče",
"IMPORT_FROM_SERVER": "Import from server",
"TITLE_PRIVATE": "Soukromý",
"TITLE_PUBLIC": "Veřejný",
"GET_MAILVELOPE": "Get Mailvelope browser add-on."

View file

@ -515,6 +515,7 @@
"SETTINGS_OPENPGP": {
"BUTTON_IMPORT_KEY": "Importer nøgle",
"BUTTON_GENERATE_KEY_PAIR": "Generer nøgler",
"IMPORT_FROM_SERVER": "Import from server",
"TITLE_PRIVATE": "Privat",
"TITLE_PUBLIC": "Offentlig",
"GET_MAILVELOPE": "Get Mailvelope browser add-on."

View file

@ -515,6 +515,7 @@
"SETTINGS_OPENPGP": {
"BUTTON_IMPORT_KEY": "Schlüssel importieren",
"BUTTON_GENERATE_KEY_PAIR": "Schlüssel generieren",
"IMPORT_FROM_SERVER": "Import from server",
"TITLE_PRIVATE": "Privat",
"TITLE_PUBLIC": "Öffentlich",
"GET_MAILVELOPE": "Lade das Mailvelope Browser Addon herunter."

View file

@ -515,6 +515,7 @@
"SETTINGS_OPENPGP": {
"BUTTON_IMPORT_KEY": "Import Key",
"BUTTON_GENERATE_KEY_PAIR": "Generate Keys",
"IMPORT_FROM_SERVER": "Import from server",
"TITLE_PRIVATE": "Private",
"TITLE_PUBLIC": "Public",
"GET_MAILVELOPE": "Get Mailvelope browser add-on."

View file

@ -515,6 +515,7 @@
"SETTINGS_OPENPGP": {
"BUTTON_IMPORT_KEY": "Import Key",
"BUTTON_GENERATE_KEY_PAIR": "Generate Key Pair",
"IMPORT_FROM_SERVER": "Import from server",
"TITLE_PRIVATE": "Private",
"TITLE_PUBLIC": "Public",
"GET_MAILVELOPE": "Get Mailvelope browser add-on."

View file

@ -515,6 +515,7 @@
"SETTINGS_OPENPGP": {
"BUTTON_IMPORT_KEY": "Import Key",
"BUTTON_GENERATE_KEY_PAIR": "Generate Key Pair",
"IMPORT_FROM_SERVER": "Import from server",
"TITLE_PRIVATE": "Private",
"TITLE_PUBLIC": "Public",
"GET_MAILVELOPE": "Get Mailvelope browser add-on."

View file

@ -515,6 +515,7 @@
"SETTINGS_OPENPGP": {
"BUTTON_IMPORT_KEY": "Importar llave",
"BUTTON_GENERATE_KEY_PAIR": "Generar llaves",
"IMPORT_FROM_SERVER": "Import from server",
"TITLE_PRIVATE": "Privado",
"TITLE_PUBLIC": "Público",
"GET_MAILVELOPE": "Get Mailvelope browser add-on."

View file

@ -515,6 +515,7 @@
"SETTINGS_OPENPGP": {
"BUTTON_IMPORT_KEY": "Impordi võti",
"BUTTON_GENERATE_KEY_PAIR": "Genereeri võti",
"IMPORT_FROM_SERVER": "Import from server",
"TITLE_PRIVATE": "Privaatne",
"TITLE_PUBLIC": "Avalik",
"GET_MAILVELOPE": "Get Mailvelope browser add-on."

View file

@ -515,6 +515,7 @@
"SETTINGS_OPENPGP": {
"BUTTON_IMPORT_KEY": "Inportatu Gakoa",
"BUTTON_GENERATE_KEY_PAIR": "Sortu Gako Parea",
"IMPORT_FROM_SERVER": "Import from server",
"TITLE_PRIVATE": "Pribatua",
"TITLE_PUBLIC": "Publikoa",
"GET_MAILVELOPE": "Lortu Mailvelope nabigatzaileko gehigarria."

View file

@ -515,6 +515,7 @@
"SETTINGS_OPENPGP": {
"BUTTON_IMPORT_KEY": "وارد کردن کلید",
"BUTTON_GENERATE_KEY_PAIR": "تولید کلیدهای",
"IMPORT_FROM_SERVER": "Import from server",
"TITLE_PRIVATE": "خصوصی",
"TITLE_PUBLIC": "عمومی",
"GET_MAILVELOPE": "Get Mailvelope browser add-on."

View file

@ -515,6 +515,7 @@
"SETTINGS_OPENPGP": {
"BUTTON_IMPORT_KEY": "Tuo avain",
"BUTTON_GENERATE_KEY_PAIR": "Luo avain",
"IMPORT_FROM_SERVER": "Import from server",
"TITLE_PRIVATE": "Yksityinen",
"TITLE_PUBLIC": "Julkinen",
"GET_MAILVELOPE": "Get Mailvelope browser add-on."

View file

@ -515,6 +515,7 @@
"SETTINGS_OPENPGP": {
"BUTTON_IMPORT_KEY": "Importer la clé",
"BUTTON_GENERATE_KEY_PAIR": "Générer les clés",
"IMPORT_FROM_SERVER": "Import from server",
"TITLE_PRIVATE": "Privée",
"TITLE_PUBLIC": "Publique",
"GET_MAILVELOPE": "Obtenez le module complémentaire de navigateur Mailvelope"

View file

@ -515,6 +515,7 @@
"SETTINGS_OPENPGP": {
"BUTTON_IMPORT_KEY": "Kulcs importálás",
"BUTTON_GENERATE_KEY_PAIR": "Kulcs generálás",
"IMPORT_FROM_SERVER": "Import from server",
"TITLE_PRIVATE": "Privát",
"TITLE_PUBLIC": "Publikus",
"GET_MAILVELOPE": "Get Mailvelope browser add-on."

View file

@ -515,6 +515,7 @@
"SETTINGS_OPENPGP": {
"BUTTON_IMPORT_KEY": "Impor kunci",
"BUTTON_GENERATE_KEY_PAIR": "Buat kunci",
"IMPORT_FROM_SERVER": "Import from server",
"TITLE_PRIVATE": "Pribadi",
"TITLE_PUBLIC": "Publik",
"GET_MAILVELOPE": "Get Mailvelope browser add-on."

View file

@ -515,6 +515,7 @@
"SETTINGS_OPENPGP": {
"BUTTON_IMPORT_KEY": "Flytja inn lykil",
"BUTTON_GENERATE_KEY_PAIR": "Búa til lykla",
"IMPORT_FROM_SERVER": "Import from server",
"TITLE_PRIVATE": "Einkalykill",
"TITLE_PUBLIC": "Dreifilykill",
"GET_MAILVELOPE": "Get Mailvelope browser add-on."

View file

@ -515,6 +515,7 @@
"SETTINGS_OPENPGP": {
"BUTTON_IMPORT_KEY": "Importa chiave",
"BUTTON_GENERATE_KEY_PAIR": "Genera chiave",
"IMPORT_FROM_SERVER": "Import from server",
"TITLE_PRIVATE": "Privata",
"TITLE_PUBLIC": "Pubblica",
"GET_MAILVELOPE": "Installa l'estensione browser Mailvelope."

View file

@ -515,6 +515,7 @@
"SETTINGS_OPENPGP": {
"BUTTON_IMPORT_KEY": "キーをインポート",
"BUTTON_GENERATE_KEY_PAIR": "キーを生成",
"IMPORT_FROM_SERVER": "Import from server",
"TITLE_PRIVATE": "プライベート",
"TITLE_PUBLIC": "パブリック",
"GET_MAILVELOPE": "Mailvelopeのブラウザアドオンを入手する"

View file

@ -515,6 +515,7 @@
"SETTINGS_OPENPGP": {
"BUTTON_IMPORT_KEY": "키 가져오기",
"BUTTON_GENERATE_KEY_PAIR": "키 생성",
"IMPORT_FROM_SERVER": "Import from server",
"TITLE_PRIVATE": "비공개",
"TITLE_PUBLIC": "공개",
"GET_MAILVELOPE": "Get Mailvelope browser add-on."

View file

@ -515,6 +515,7 @@
"SETTINGS_OPENPGP": {
"BUTTON_IMPORT_KEY": "Importuoti raktą",
"BUTTON_GENERATE_KEY_PAIR": "Sukurti raktus",
"IMPORT_FROM_SERVER": "Import from server",
"TITLE_PRIVATE": "Privatus",
"TITLE_PUBLIC": "Viešas",
"GET_MAILVELOPE": "Get Mailvelope browser add-on."

View file

@ -515,6 +515,7 @@
"SETTINGS_OPENPGP": {
"BUTTON_IMPORT_KEY": "Import Key",
"BUTTON_GENERATE_KEY_PAIR": "Generate Keys",
"IMPORT_FROM_SERVER": "Import from server",
"TITLE_PRIVATE": "Private",
"TITLE_PUBLIC": "Public",
"GET_MAILVELOPE": "Get Mailvelope browser add-on."

View file

@ -515,6 +515,7 @@
"SETTINGS_OPENPGP": {
"BUTTON_IMPORT_KEY": "Importer nøkkel",
"BUTTON_GENERATE_KEY_PAIR": "Lag nøkler",
"IMPORT_FROM_SERVER": "Import from server",
"TITLE_PRIVATE": "Privat",
"TITLE_PUBLIC": "Offentlig",
"GET_MAILVELOPE": "Få nettlesertillegg Mailvelope."

View file

@ -515,6 +515,7 @@
"SETTINGS_OPENPGP": {
"BUTTON_IMPORT_KEY": "Importeer sleutel",
"BUTTON_GENERATE_KEY_PAIR": "Genereer sleutels",
"IMPORT_FROM_SERVER": "Import from server",
"TITLE_PRIVATE": "Privé sleutel",
"TITLE_PUBLIC": "Publieke sleutel",
"GET_MAILVELOPE": "Verkrijg Mailvelope browser add-on."

View file

@ -515,6 +515,7 @@
"SETTINGS_OPENPGP": {
"BUTTON_IMPORT_KEY": "Importuj klucz",
"BUTTON_GENERATE_KEY_PAIR": "Generuj klucz",
"IMPORT_FROM_SERVER": "Import from server",
"TITLE_PRIVATE": "Prywatny",
"TITLE_PUBLIC": "Publiczny",
"GET_MAILVELOPE": "Pobierz dodatek do przeglądarki Mailvelope."

View file

@ -515,6 +515,7 @@
"SETTINGS_OPENPGP": {
"BUTTON_IMPORT_KEY": "Importa chave",
"BUTTON_GENERATE_KEY_PAIR": "Gerar chave",
"IMPORT_FROM_SERVER": "Import from server",
"TITLE_PRIVATE": "Privado",
"TITLE_PUBLIC": "Público",
"GET_MAILVELOPE": "Get Mailvelope browser add-on."

View file

@ -515,6 +515,7 @@
"SETTINGS_OPENPGP": {
"BUTTON_IMPORT_KEY": "Importar chave",
"BUTTON_GENERATE_KEY_PAIR": "Gerar chaves",
"IMPORT_FROM_SERVER": "Import from server",
"TITLE_PRIVATE": "Privada",
"TITLE_PUBLIC": "Pública",
"GET_MAILVELOPE": "Obter extensão Mailvelope para o navegador."

View file

@ -515,6 +515,7 @@
"SETTINGS_OPENPGP": {
"BUTTON_IMPORT_KEY": "Importar chave",
"BUTTON_GENERATE_KEY_PAIR": "Gerar chaves",
"IMPORT_FROM_SERVER": "Import from server",
"TITLE_PRIVATE": "Privada",
"TITLE_PUBLIC": "Pública",
"GET_MAILVELOPE": "Obter extensão Mailvelope para o navegador."

View file

@ -515,6 +515,7 @@
"SETTINGS_OPENPGP": {
"BUTTON_IMPORT_KEY": "Import Key",
"BUTTON_GENERATE_KEY_PAIR": "Generate Keys",
"IMPORT_FROM_SERVER": "Import from server",
"TITLE_PRIVATE": "Private",
"TITLE_PUBLIC": "Public",
"GET_MAILVELOPE": "Get Mailvelope browser add-on."

View file

@ -515,6 +515,7 @@
"SETTINGS_OPENPGP": {
"BUTTON_IMPORT_KEY": "Импортировать ключ",
"BUTTON_GENERATE_KEY_PAIR": "Новый ключ",
"IMPORT_FROM_SERVER": "Import from server",
"TITLE_PRIVATE": "Приватный",
"TITLE_PUBLIC": "Публичный",
"GET_MAILVELOPE": "Получить дополнение для браузера Mailvelope."

View file

@ -515,6 +515,7 @@
"SETTINGS_OPENPGP": {
"BUTTON_IMPORT_KEY": "Import Key",
"BUTTON_GENERATE_KEY_PAIR": "Generate Keys",
"IMPORT_FROM_SERVER": "Import from server",
"TITLE_PRIVATE": "Private",
"TITLE_PUBLIC": "Public",
"GET_MAILVELOPE": "Get Mailvelope browser add-on."

View file

@ -515,6 +515,7 @@
"SETTINGS_OPENPGP": {
"BUTTON_IMPORT_KEY": "Uvozi ključ",
"BUTTON_GENERATE_KEY_PAIR": "Generiraj ključe",
"IMPORT_FROM_SERVER": "Import from server",
"TITLE_PRIVATE": "Zasebni",
"TITLE_PUBLIC": "Javni",
"GET_MAILVELOPE": "Get Mailvelope browser add-on."

View file

@ -515,6 +515,7 @@
"SETTINGS_OPENPGP": {
"BUTTON_IMPORT_KEY": "Importera nyckel",
"BUTTON_GENERATE_KEY_PAIR": "Skapa nycklar",
"IMPORT_FROM_SERVER": "Import from server",
"TITLE_PRIVATE": "Privat",
"TITLE_PUBLIC": "Publik",
"GET_MAILVELOPE": "Get Mailvelope browser add-on."

View file

@ -515,6 +515,7 @@
"SETTINGS_OPENPGP": {
"BUTTON_IMPORT_KEY": "Key İçe Aktar",
"BUTTON_GENERATE_KEY_PAIR": "Key Oluştur",
"IMPORT_FROM_SERVER": "Import from server",
"TITLE_PRIVATE": "Private",
"TITLE_PUBLIC": "Public",
"GET_MAILVELOPE": "Get Mailvelope browser add-on."

View file

@ -515,6 +515,7 @@
"SETTINGS_OPENPGP": {
"BUTTON_IMPORT_KEY": "Імпортувати ключ",
"BUTTON_GENERATE_KEY_PAIR": "Новий ключ",
"IMPORT_FROM_SERVER": "Import from server",
"TITLE_PRIVATE": "Приватний",
"TITLE_PUBLIC": "Публічний",
"GET_MAILVELOPE": "Get Mailvelope browser add-on."

View file

@ -515,6 +515,7 @@
"SETTINGS_OPENPGP": {
"BUTTON_IMPORT_KEY": "Nhập mật mã",
"BUTTON_GENERATE_KEY_PAIR": "Tạo một đôi mật mã",
"IMPORT_FROM_SERVER": "Import from server",
"TITLE_PRIVATE": "Mã lưu riêng",
"TITLE_PUBLIC": "Mã chia sẻ công cộng",
"GET_MAILVELOPE": "Tải về tiện ích trình duyệt cài thêm tên Mailvelope."

View file

@ -515,6 +515,7 @@
"SETTINGS_OPENPGP": {
"BUTTON_IMPORT_KEY": "导入 密钥",
"BUTTON_GENERATE_KEY_PAIR": "生成 密钥",
"IMPORT_FROM_SERVER": "Import from server",
"TITLE_PRIVATE": "私有",
"TITLE_PUBLIC": "公开",
"GET_MAILVELOPE": "获取 Mailvelope 浏览器扩展。"

View file

@ -515,6 +515,7 @@
"SETTINGS_OPENPGP": {
"BUTTON_IMPORT_KEY": "匯入金鑰",
"BUTTON_GENERATE_KEY_PAIR": "產生密鑰",
"IMPORT_FROM_SERVER": "Import from server",
"TITLE_PRIVATE": "私密",
"TITLE_PUBLIC": "公開",
"GET_MAILVELOPE": "取得 Mailvelope 瀏覽器擴充功能"

View file

@ -73,6 +73,7 @@
<!-- ko if: canOpenPGP -->
<details>
<summary class="legend">OpenPGP.js</summary>
<button data-bind="click: importToOpenPGP" data-i18n="SETTINGS_OPENPGP/IMPORT_FROM_SERVER"></button>
<table class="table table-hover list-table">
<tbody><tr><th colspan="4" data-i18n="SETTINGS_OPENPGP/TITLE_PRIVATE">Private keys</th></tr></tbody>
<tbody data-bind="foreach: openpgpkeysPrivate, i18nUpdate: openpgpkeysPrivate">