Class: InstAccess::Config
- Inherits:
-
Object
- Object
- InstAccess::Config
- Defined in:
- lib/inst_access/config.rb
Instance Attribute Summary collapse
-
#signing_key ⇒ Object
readonly
Returns the value of attribute signing_key.
Instance Method Summary collapse
- #encryption_key ⇒ Object
-
#initialize(raw_signing_key, raw_encryption_key = nil) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(raw_signing_key, raw_encryption_key = nil) ⇒ Config
Returns a new instance of Config.
27 28 29 30 31 32 33 34 35 |
# File 'lib/inst_access/config.rb', line 27 def initialize(raw_signing_key, raw_encryption_key = nil) @signing_key = OpenSSL::PKey::RSA.new(raw_signing_key) if raw_encryption_key @encryption_key = OpenSSL::PKey::RSA.new(raw_encryption_key) raise ArgumentError, 'the encryption key should be a public RSA key' if @encryption_key.private? end rescue OpenSSL::PKey::RSAError => e raise ArgumentError, e end |
Instance Attribute Details
#signing_key ⇒ Object (readonly)
Returns the value of attribute signing_key.
25 26 27 |
# File 'lib/inst_access/config.rb', line 25 def signing_key @signing_key end |
Instance Method Details
#encryption_key ⇒ Object
37 38 39 |
# File 'lib/inst_access/config.rb', line 37 def encryption_key @encryption_key || raise(ConfigError, 'Encryption key is not configured') end |