Skip to content
This repository was archived by the owner on Oct 25, 2018. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/gui/contacts/certify.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
gui_contacts_certify(){
local contact_id details level exp_time days output err fail_details
contact_id=$1
details=$(yad --title="EasyGnuPG | Certify" \
--text="Enter certification details:" \
Expand All @@ -15,7 +16,6 @@ gui_contacts_certify(){
level=$(echo $details | cut -d'|' -f1)
exp_time=$(echo $details | cut -d'|' -f2)
days=$(( ($(date -d "$exp_time" "+%s") - $(date "+%s") )/(60*60*24) ))
echo $level $days > /dev/tty
output=$(call cmd_contact_certify "$contact_id" -l "$level" -t "${days}d" 2>&1)
err=$?
is_true $DEBUG && echo "$output"
Expand Down
1 change: 1 addition & 0 deletions src/gui/contacts/delete.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
gui_contacts_delete(){
local contact_id output err
contact_id=$1
yesno "Delete Contact?" || return 1
output=$(call cmd_contact_delete $contact_id --force 2>&1)
Expand Down
3 changes: 2 additions & 1 deletion src/gui/contacts/details.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
gui_contacts_details(){
local contact_id=$1
local contact_id details_text
contact_id=$1
details_text="<big><tt> \
$(call cmd_contact_list "$contact_id" | pango_raw | sed 's/[^ ]*/\<b\>&\<\/b\>/') \
</tt></big>"
Expand Down
1 change: 1 addition & 0 deletions src/gui/contacts/export.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
gui_contacts_export(){
local contact_id file output err
contact_id = $1

# select a destination filename
Expand Down
1 change: 1 addition & 0 deletions src/gui/contacts/fetch.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
gui_contacts_fetch(){
local directory output err fail_details
# Fetch and fetch uri are will be here
# TODO add fetch-uri also here
directory=$(yad --title="EasyGnuPG | Fetch Contact" \
Expand Down
1 change: 1 addition & 0 deletions src/gui/contacts/import.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
gui_contacts_import(){
local file output err fail_details
# Fetch and fetch uri are will be here
# TODO add fetch-uri also here
file=$(yad --title="EasyGnuPG | Import Contacts" \
Expand Down
1 change: 1 addition & 0 deletions src/gui/contacts/list.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export tmpfile=$(mktemp)

on_select() {
local selected
selected=$1
echo $selected > $tmpfile
}
Expand Down
1 change: 1 addition & 0 deletions src/gui/contacts/receive.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
gui_contacts_receive(){
local receive details keyid keyserver output err fail_details
details=$(yad --title="EasyGnuPG | Receive Contact" \
--text="Enter the contact uri" \
--form \
Expand Down
1 change: 1 addition & 0 deletions src/gui/contacts/search.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
gui_contacts_search(){
local details name keyserver
details=$(yad --title="EasyGnuPG | Search Contact" \
--text="Enter the contact uri" \
--form \
Expand Down
1 change: 1 addition & 0 deletions src/gui/contacts/trust.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
gui_contacts_trust(){
local contact_id level output err fail_details
contact_id=$1
level=$(yad --title="EasyGnuPG | Trust" \
--text="Enter details:" \
Expand Down
44 changes: 44 additions & 0 deletions src/gui/key/backup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
gui_key_backup(){
local details qrencode output err
details=$(yad --title="EasyGnuPG | Key Backup" \
--text="KeyID $GPG_KEY" \
--form \
--field="QR ENCODE":CHK\
--button=gtk-yes \
--button=gtk-quit \
--borders=10) || return 1

qrencode=$(echo $details | cut -d'|' -f1)
is_true $qrencode && qrencode='--qrencode' || qrencode=''
output=$(call cmd_key_backup "$GPG_KEY" $qrencode 2>&1)
err=$?
is_true $DEBUG && echo "$output"

# TODO improve messages
if [[ $err == 0 ]]; then
# TODO: maybe we can also ask/show the backup file location
message info "$output"
else
fail_details=$(echo "$output" | grep '^gpg:' | uniq | pango_raw)
message error "Failed to backup key $GPG_KEY.\n <tt>$fail_details</tt>"
return 1
fi
}
#
# This file is part of EasyGnuPG. EasyGnuPG is a wrapper around GnuPG
# to simplify its operations. Copyright (C) 2018 Dashamir Hoxha,
# Divesh Uttamchandani
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/
#
36 changes: 36 additions & 0 deletions src/gui/key/delete.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
gui_key_delete(){
local output err
yesno "Are you sure you want to delete key?\n <tt>$GPG_KEY</tt>" || return 1
output=$(call cmd_key_delete 2>&1)
err=$?
is_true $DEBUG && echo "$output"

# TODO improve messages
# TODO Think something about force
if [[ $err == 0 ]]; then
message info "Key <tt>$GPG_KEY</tt> deleted!"
# GOTO no key found/switch context etc.
else
fail_details=$(echo "$output" | grep '^gpg:' | uniq | pango_raw)
message error "Failed to delete key <tt>$GPG_KEY</tt>.\n <tt>$fail_details</tt>"
return 1
fi
}
#
# This file is part of EasyGnuPG. EasyGnuPG is a wrapper around GnuPG
# to simplify its operations. Copyright (C) 2018 Dashamir Hoxha,
# Divesh Uttamchandani
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/
#
1 change: 1 addition & 0 deletions src/gui/key/fetch.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
gui_key_fetch() {
local homedir output err
homedir=$(yad --title="EasyGnuPG | Fetch" \
--text="Fetch a key from another directory" \
--form \
Expand Down
1 change: 1 addition & 0 deletions src/gui/key/gen.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
gui_key_gen(){
local key_details email name passphrase confirm output err
# TODO: Improve the no-passphrase with using checkbox
key_details="$(yad --title="EasyGnuPG | Generate Key" \
--text="Enter details for the key\nLeave passphrases fields blank for no passphrase" \
Expand Down
37 changes: 37 additions & 0 deletions src/gui/key/main.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
gui_key_main(){
# TODO: Think about the description if it is necessary
# also do we require any more details??
yad --text="$(key_info $GPG_KEY)" \
--selectable-labels \
--borders=10 \
--form \
--columns=4 \
--field="Delete":FBTN "bash -c 'gui key_delete'" \
--field="Backup":FBTN "bash -c 'gui key_backup '" \
--field="Pass":FBTN "bash -c 'gui key_pass '" \
--field="Renew":FBTN "bash -c 'gui key_renew '" \
--field="Revcert":FBTN "bash -c 'gui key_revcert '" \
--field="Revoke":FBTN "bash -c 'gui key_rev '" \
--field="Share":FBTN "bash -c 'gui key_share '" \
--field="Split":FBTN "bash -c 'gui key_split '" \
--button=gtk-quit
}

#
# This file is part of EasyGnuPG. EasyGnuPG is a wrappe`r around GnuPG
# to simplify its operations. Copyright (C) 2018 Dashamir Hoxha,
# Divesh Uttamchandani
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/
#
37 changes: 37 additions & 0 deletions src/gui/key/pass.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
gui_key_pass(){
local output err fail_details
# TODO: maybe we should give option for removing passphrase
# though it would require change in cmd_key_pass

# This is same as cli part. TODO: just change the pinentry to gui pinentry
output=$(call cmd_key_pass 2>&1)
err=$?
is_true $DEBUG && echo "$output"

# TODO improve messages
if [[ $err == 0 ]]; then
message info "Passphrase changed"
else
fail_details=$(echo "$output" | grep '^gpg:' | uniq | pango_raw)
message error "Failed to change passphrase for <tt>$GPG_KEY</tt>.\n <tt>$fail_details</tt>"
return 1
fi
}
#
# This file is part of EasyGnuPG. EasyGnuPG is a wrapper around GnuPG
# to simplify its operations. Copyright (C) 2018 Dashamir Hoxha,
# Divesh Uttamchandani
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/
#
1 change: 1 addition & 0 deletions src/gui/key/recover.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
gui_key_recover() {
local partials key1 key2 output err
partials=$(yad --title="EasyGnuPG | Recover" \
--text="Recover a key from partial files" \
--form \
Expand Down
44 changes: 44 additions & 0 deletions src/gui/key/renew.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
gui_key_renew(){
local details exp_time output err
details=$(yad --title="EasyGnuPG | Key Renew" \
--date-format="%Y-%m-%d" \
--text="Enter details:" \
--form \
--field="Expiry":DT\
--button=gtk-yes \
--button=gtk-quit \
--borders=10) || return 1

# TODO: Add option for no expiry; May be a checkbox
exp_time=$(echo $details | cut -d'|' -f1)
output=$(call cmd_key_renew "$exp_time" 2>&1)
err=$?
is_true $DEBUG && echo "$output"

# TODO improve messages
if [[ $err == 0 ]]; then
message info "Key $GPG_KEY renewed till $exp_time!"
else
fail_details=$(echo "$output" | grep '^gpg:' | uniq | pango_raw)
message error "Failed to renew key $GPG_KEY.\n <tt>$fail_details</tt>"
return 1
fi
}
#
# This file is part of EasyGnuPG. EasyGnuPG is a wrapper around GnuPG
# to simplify its operations. Copyright (C) 2018 Dashamir Hoxha,
# Divesh Uttamchandani
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/
#
1 change: 1 addition & 0 deletions src/gui/key/restore.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
gui_key_restore() {
local file output err
file=$(yad --title="EasyGnuPG | Restore" \
--text="Retore a key from backup file" \
--form \
Expand Down
45 changes: 45 additions & 0 deletions src/gui/key/rev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
gui_key_rev(){
local revcert output err
get_gpg_key
revcert=$(yad --title="EasyGnuPG | Revoke Key" \
--text="Select a revocation certificate" \
--form \
--field="select file":FL "$GNUPGHOME/openpgp-revocs.d/$FPR.rev" \
--button=gtk-yes:0 \
--button=gtk-quit:1 \
--borders=10 | cut -d'|' -f1) || return 1

output=$(call cmd_key_rev $revcert 2>&1)
err=$?
is_true $DEBUG && echo "$output"

# TODO improve messages
# TODO maybe add a confirmation message if required
if [[ $err == 0 ]]; then
message info "Key successfully revoked!"
# TODO open contact list of the fetched contacts(if possible)
# else open the complete contact list
else
fail_details=$(echo "$output" | grep '^gpg:' | uniq | pango_raw)
message error "Failed to revoke keys.\n <tt>$fail_details</tt>"
return 1
fi
}
#
# This file is part of EasyGnuPG. EasyGnuPG is a wrapper around GnuPG
# to simplify its operations. Copyright (C) 2018 Dashamir Hoxha,
# Divesh Uttamchandani
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/
#
41 changes: 41 additions & 0 deletions src/gui/key/revcert.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
gui_key_revcert(){
local description output err
description=$(yad --title="EasyGnuPG | Revcert" \
--text="Generate revcert for $GPG_KEY" \
--form \
--columns=2 \
--field="Description" \
--button=gtk-yes \
--button=gtk-quit \
--borders=10 | cut -d'|' -f1)
output=$(call cmd_key_revcert $description)

err=$?
is_true $DEBUG && echo "$output"

if [[ $err == 0 ]]; then
message info "Revocation certificate generated successfully"
else
fail_details=$(echo "$output" | grep '^gpg:' | uniq | pango_raw)
message error "Failed to generate revocation certificate for $GPG_KEY.\n <tt>$fail_details</tt>"
return 1
fi
}
#
# This file is part of EasyGnuPG. EasyGnuPG is a wrapper around GnuPG
# to simplify its operations. Copyright (C) 2018 Dashamir Hoxha,
# Divesh Uttamchandani
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/
#
Loading