Class: Arrolio::Renderer::SignatureConfig
- Inherits:
-
Object
- Object
- Arrolio::Renderer::SignatureConfig
- Defined in:
- lib/arrolio/renderer/signature_config.rb
Overview
Configuration for PDF digital signatures. Carries the keystore path, password, and certification level. The renderer applies the signature as a post-processing step using an external signing tool (or a future Pdfrb signing API).
Certification levels (PDF 1.7 ยง12.8.2.2):
:no_changes โ no changes permitted after signing.
:form_fill โ form filling and signing permitted.
:annotate โ annotations + form fill + signing permitted.
Constant Summary collapse
- CERT_LEVELS =
{ no_changes: 1, form_fill: 2, annotate: 3 }.freeze
Instance Attribute Summary collapse
-
#cert_level ⇒ Object
readonly
Returns the value of attribute cert_level.
-
#keystore_password ⇒ Object
readonly
Returns the value of attribute keystore_password.
-
#keystore_path ⇒ Object
readonly
Returns the value of attribute keystore_path.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#reason ⇒ Object
readonly
Returns the value of attribute reason.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #cert_level_code ⇒ Object
- #hash ⇒ Object
-
#initialize(keystore_path:, keystore_password:, cert_level: :form_fill, reason: nil, location: nil, name: nil) ⇒ SignatureConfig
constructor
A new instance of SignatureConfig.
- #valid? ⇒ Boolean
Constructor Details
#initialize(keystore_path:, keystore_password:, cert_level: :form_fill, reason: nil, location: nil, name: nil) ⇒ SignatureConfig
Returns a new instance of SignatureConfig.
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/arrolio/renderer/signature_config.rb', line 24 def initialize(keystore_path:, keystore_password:, cert_level: :form_fill, reason: nil, location: nil, name: nil) @keystore_path = keystore_path.to_s @keystore_password = keystore_password.to_s @cert_level = cert_level.to_sym @reason = reason&.to_s @location = location&.to_s @name = name&.to_s freeze end |
Instance Attribute Details
#cert_level ⇒ Object (readonly)
Returns the value of attribute cert_level.
21 22 23 |
# File 'lib/arrolio/renderer/signature_config.rb', line 21 def cert_level @cert_level end |
#keystore_password ⇒ Object (readonly)
Returns the value of attribute keystore_password.
21 22 23 |
# File 'lib/arrolio/renderer/signature_config.rb', line 21 def keystore_password @keystore_password end |
#keystore_path ⇒ Object (readonly)
Returns the value of attribute keystore_path.
21 22 23 |
# File 'lib/arrolio/renderer/signature_config.rb', line 21 def keystore_path @keystore_path end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
21 22 23 |
# File 'lib/arrolio/renderer/signature_config.rb', line 21 def location @location end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
21 22 23 |
# File 'lib/arrolio/renderer/signature_config.rb', line 21 def name @name end |
#reason ⇒ Object (readonly)
Returns the value of attribute reason.
21 22 23 |
# File 'lib/arrolio/renderer/signature_config.rb', line 21 def reason @reason end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
44 45 46 47 48 49 50 51 |
# File 'lib/arrolio/renderer/signature_config.rb', line 44 def ==(other) other.is_a?(self.class) && keystore_path == other.keystore_path && cert_level == other.cert_level && reason == other.reason && location == other.location && name == other.name end |
#cert_level_code ⇒ Object
36 37 38 |
# File 'lib/arrolio/renderer/signature_config.rb', line 36 def cert_level_code CERT_LEVELS.fetch(@cert_level, 2) end |
#hash ⇒ Object
54 55 56 |
# File 'lib/arrolio/renderer/signature_config.rb', line 54 def hash [self.class, keystore_path, cert_level, reason, location, name].hash end |
#valid? ⇒ Boolean
40 41 42 |
# File 'lib/arrolio/renderer/signature_config.rb', line 40 def valid? !@keystore_path.empty? && !@keystore_password.empty? end |