Encrypt outgoing emails when possible

This commit is contained in:
2024-09-25 23:43:11 +02:00
parent 3ee76e26ab
commit c4c2d16342
5 changed files with 197 additions and 5 deletions

View File

@@ -0,0 +1,19 @@
require 'gpgme'
module UserManager
class PgpEncrypt < UserManagerService
def initialize(user:, text:)
@user = user
@text = text
end
def call
crypto = GPGME::Crypto.new
crypto.encrypt(
@text,
recipients: @user.gnupg_key,
always_trust: true
)
end
end
end