mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-22 20:46:21 +00:00
feat: generar la llave privada #14169
This commit is contained in:
parent
c6c638fb60
commit
4de3352950
1 changed files with 11 additions and 0 deletions
|
@ -7,6 +7,17 @@ class Site
|
|||
|
||||
included do
|
||||
encrypts :private_key_pem
|
||||
|
||||
before_save :generate_private_key_pem!, unless: :private_key_pem?
|
||||
|
||||
private
|
||||
|
||||
# Genera la llave privada y la almacena
|
||||
#
|
||||
# @return [nil]
|
||||
def generate_private_key_pem!
|
||||
self.private_key_pem ||= DistributedPress::V1::Social::Client.new(public_key_url: nil, key_size: 2048).private_key.export
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue