From 817d9558febde484f23f623bd66d8c861ebc8236 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Tue, 14 Feb 2017 19:01:30 -0500 Subject: Prototype key verification --- app/models/commit.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'app/models/commit.rb') diff --git a/app/models/commit.rb b/app/models/commit.rb index 1e19f00106a..b22aaa3c461 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -234,6 +234,18 @@ class Commit @statuses[ref] = pipelines.latest_status(ref) end + def signature + return @signature if defined?(@signature) + + sig, signed = @raw.extract_signature(project.repository.raw_repository) + if sig && signed + GPGME::Crypto.new.verify(sig, signed_text: signed) do |sign| + @signature = sign + end + end + @signature ||= nil + end + def revert_branch_name "revert-#{short_id}" end -- cgit v1.2.1