emacs-collab/lib/emacscollab/sshkey.rb

36 lines
582 B
Ruby
Raw Normal View History

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