Sha256: d4ad0adb8074c401f8e49e7a125a0753966db9019c9be01b3d0a9a192a8c4f16
Contents?: true
Size: 488 Bytes
Versions: 43
Compression:
Stored size: 488 Bytes
Contents
require 'openssl' # Store OStatus private and public key class ActorKey < ActiveRecord::Base KEY_SIZE = 1024 belongs_to :actor validates_presence_of :key_der before_validation :generate_key, on: :create def key @key ||= OpenSSL::PKey::RSA.new(key_der) end def key= new_key @key = new_key self.key_der = new_key.to_der end private def generate_key return if key_der.present? self.key = OpenSSL::PKey::RSA.generate(KEY_SIZE) end end
Version data entries
43 entries across 43 versions & 2 rubygems