Class: Leeloo::GpgPrivateLocalFileSystemKeystore
Instance Attribute Summary
#path
Attributes inherited from Keystore
#name
Instance Method Summary
collapse
#==, #find_secrets, #secrets
Methods inherited from Keystore
#==, #secrets, #sync
Constructor Details
Returns a new instance of GpgPrivateLocalFileSystemKeystore.
99
100
101
102
103
104
105
106
|
# File 'lib/leeloo/keystore.rb', line 99
def initialize name, path
super name, path
FileUtils.mkdir_p "#{@path}/keys"
@recipients = []
Dir.glob("#{path}/keys/*") { |key| @recipients << File.basename(key) }
@recipients.each { |key| GPGME::Key.import(File.open("#{path}/keys/#{key}")) }
end
|
Instance Method Details
#init ⇒ Object
108
109
110
111
|
# File 'lib/leeloo/keystore.rb', line 108
def init
super
GPGME::Key.find(:public, nil, ).each { |key| key.export(:output => File.open("#{path}/keys/#{key.uids.first.email}", "w+")) }
end
|
#secret_from_name(name) ⇒ Object
118
119
120
|
# File 'lib/leeloo/keystore.rb', line 118
def secret_from_name name
secret_of "#{path}/secrets/#{name}.gpg"
end
|
#secret_of(path) ⇒ Object
113
114
115
116
|
# File 'lib/leeloo/keystore.rb', line 113
def secret_of path
name = path.gsub("#{@path}/secrets/", "").gsub(".gpg", "")
GpgLocalFileSystemSecret.new path, name, @recipients
end
|