Class: SignedConfig::Reader
- Inherits:
-
Object
- Object
- SignedConfig::Reader
- Defined in:
- lib/signed_config/reader.rb
Instance Method Summary collapse
- #config ⇒ Object
-
#initialize(public_key, signed_config) ⇒ Reader
constructor
A new instance of Reader.
- #ruby_method ⇒ Object
Constructor Details
#initialize(public_key, signed_config) ⇒ Reader
Returns a new instance of Reader.
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/signed_config/reader.rb', line 4 def initialize(public_key, signed_config) yml = signed_config.split("\n")[1..-2].join("\n") hash = YAML.load(yml) signature = hash[:signature] @config_string = hash[:config] return if ruby_method unless Crypto.verify(public_key, signature, @config_string) raise SignatureDoesNotMatch end end |
Instance Method Details
#config ⇒ Object
17 18 19 |
# File 'lib/signed_config/reader.rb', line 17 def config YAML.load(@config_string) end |
#ruby_method ⇒ Object
21 22 23 |
# File 'lib/signed_config/reader.rb', line 21 def ruby_method false end |