Class: KStor::Crypto::ArmoredValue

Inherits:
Object
  • Object
show all
Defined in:
lib/kstor/crypto/keys.rb

Overview

Wrapper class for an ASCII-armored value.

Direct Known Subclasses

ArmoredHash, PrivateKey, PublicKey

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ ArmoredValue

Returns a new instance of ArmoredValue.



44
45
46
# File 'lib/kstor/crypto/keys.rb', line 44

def initialize(value)
  @value = value
end

Class Method Details

.from_binary(bin_str) ⇒ Object



57
58
59
# File 'lib/kstor/crypto/keys.rb', line 57

def self.from_binary(bin_str)
  new(ASCIIArmor.encode(bin_str))
end

Instance Method Details

#to_asciiObject Also known as: to_s



48
49
50
# File 'lib/kstor/crypto/keys.rb', line 48

def to_ascii
  @value
end

#to_binaryObject



53
54
55
# File 'lib/kstor/crypto/keys.rb', line 53

def to_binary
  ASCIIArmor.decode(@value)
end