diff options
Diffstat (limited to 'vendor/gems/certificate_authority/lib/certificate_authority/serial_number.rb')
-rw-r--r-- | vendor/gems/certificate_authority/lib/certificate_authority/serial_number.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/vendor/gems/certificate_authority/lib/certificate_authority/serial_number.rb b/vendor/gems/certificate_authority/lib/certificate_authority/serial_number.rb new file mode 100644 index 0000000..143c144 --- /dev/null +++ b/vendor/gems/certificate_authority/lib/certificate_authority/serial_number.rb @@ -0,0 +1,14 @@ +module CertificateAuthority + class SerialNumber + include ActiveModel::Validations + include Revocable + + attr_accessor :number + + validates :number, :presence => true, :numericality => {:greater_than => 0} + + def initialize + self.number = SecureRandom.random_number(2**128-1) + end + end +end |