emacs-collab/lib/emacscollab/sshkey.rb
2017-06-04 20:42:43 +02:00

36 lines
582 B
Ruby

module EmacsCollab
class SSHKey
attr_accessor :cipher, :pubkey, :comment
def initialize(cipher,pubkey,comment="")
@cipher = cipher
@pubkey = pubkey
@comment = comment
end
def ==(o)
o.class == self.class && o.attrs == attrs
end
def pretty
"#{@cipher} #{@comment}"
end
def to_s
"ssh-#{@cipher} #{@pubkey} #{@comment}"
end
def attrs
[@cipher, @pubkey, @comment]
end
end
class InvalidSSHPubKey < StandardError
end
class DuplicateSSHPubKey < StandardError
end
end