Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexis Reigel <mail@koffeinfrei.org>2017-07-06 12:55:56 +0300
committerAlexis Reigel <mail@koffeinfrei.org>2017-07-27 16:43:37 +0300
commitdeb474b4137c8ab4ce16f4d46e011be593f0de60 (patch)
tree4fc2b109ae30520fc9ca642a315a326345262eb8 /lib/gitlab/gpg.rb
parentb66e3726dc377c2bb5c92983db4ec4c8d27237c4 (diff)
extract common method
Diffstat (limited to 'lib/gitlab/gpg.rb')
-rw-r--r--lib/gitlab/gpg.rb22
1 files changed, 9 insertions, 13 deletions
diff --git a/lib/gitlab/gpg.rb b/lib/gitlab/gpg.rb
index 258901bb238..582347019e5 100644
--- a/lib/gitlab/gpg.rb
+++ b/lib/gitlab/gpg.rb
@@ -8,10 +8,8 @@ module Gitlab
def add(key)
GPGME::Key.import(key)
end
- end
- def fingerprints_from_key(key)
- using_tmp_keychain do
+ def fingerprints_from_key(key)
import = GPGME::Key.import(key)
return [] if import.imported == 0
@@ -20,13 +18,15 @@ module Gitlab
end
end
- def primary_keyids_from_key(key)
+ def fingerprints_from_key(key)
using_tmp_keychain do
- import = GPGME::Key.import(key)
-
- return [] if import.imported == 0
+ CurrentKeyChain.fingerprints_from_key(key)
+ end
+ end
- fingerprints = import.imports.map(&:fingerprint)
+ def primary_keyids_from_key(key)
+ using_tmp_keychain do
+ fingerprints = CurrentKeyChain.fingerprints_from_key(key)
GPGME::Key.find(:public, fingerprints).map { |raw_key| raw_key.primary_subkey.keyid }
end
@@ -34,11 +34,7 @@ module Gitlab
def emails_from_key(key)
using_tmp_keychain do
- import = GPGME::Key.import(key)
-
- return [] if import.imported == 0
-
- fingerprints = import.imports.map(&:fingerprint)
+ fingerprints = CurrentKeyChain.fingerprints_from_key(key)
GPGME::Key.find(:public, fingerprints).flat_map { |raw_key| raw_key.uids.map(&:email) }
end