Class: SshSig::KeyLoader::PubKey

Inherits:
Object
  • Object
show all
Defined in:
lib/ssh_sig/key_loader/pub_key.rb

Direct Known Subclasses

Http

Constant Summary collapse

SUPPORTED_KEY_ALGORITHMS =
%w[ssh-ed25519 ssh-rsa].freeze

Class Method Summary collapse

Class Method Details

.load(armored) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/ssh_sig/key_loader/pub_key.rb', line 9

def load(armored)
  keys = armored.split("\n")

  keys
    .filter { |key| supported_key_algorithm?(key) }
    .map { |key| load_data_public_key(key) }
rescue ::Net::SSH::Exception, ::ArgumentError
  raise ::SshSig::LoadError, 'Public key is not valid'
end