From 3ee76e26abdb3253353a9f4886178ae0c09a9b40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Tue, 8 Oct 2024 11:34:18 +0200 Subject: [PATCH] Re-import user's pubkey on access Sometimes, the pubkey might not be imported in the local keychain (anymore), but at this point in the code it had been successfully imported at least once before. So we just (re-)import every time for it to never fail. --- app/models/user.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index 67c6fcd..284f350 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -174,7 +174,8 @@ class User < ApplicationRecord def gnupg_key return nil unless pgp_pubkey.present? - @gnupg_key ||= GPGME::Key.get(pgp_fpr) + GPGME::Key.import(pgp_pubkey) + GPGME::Key.get(pgp_fpr) end def pgp_pubkey_contains_user_address?