Class: Keepasshttp::KeyStore::SshAgent

Inherits:
Plain
  • Object
show all
Defined in:
lib/keepasshttp/key_store.rb

Overview

Use your running ssh-agent session to encrypt your session key

Constant Summary

Constants inherited from Plain

Plain::PATH

Class Method Summary collapse

Class Method Details

.available?Boolean

Returns:

  • (Boolean)


48
49
50
51
52
53
54
55
# File 'lib/keepasshttp/key_store.rb', line 48

def available?
  require 'net/ssh'

  super
rescue LoadError
  raise LoadError, 'To use key_store: :SshAgent you have to install ' \
                   "the 'net-ssh' gem"
end

.loadObject



64
65
66
67
68
# File 'lib/keepasshttp/key_store.rb', line 64

def load
  params = super
  params[:key] = decrypt(params[:key], iv: params.delete(:iv))
  params
end

.save(params = {}) ⇒ Object



57
58
59
60
61
62
# File 'lib/keepasshttp/key_store.rb', line 57

def save(params = {})
  enc, iv = encrypt(params.delete(:key))
  params[:key] = enc
  params[:iv] = iv
  super(params)
end