Class: Pandoru::SecretStore::Adapters::SecretTool
- Inherits:
-
Base
- Object
- Base
- Pandoru::SecretStore::Adapters::SecretTool
show all
- Defined in:
- lib/pandoru/secret_store.rb
Overview
Linux libsecret via ‘secret-tool` (Secret Service: GNOME Keyring/KWallet).
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
#available? ⇒ Boolean
130
131
132
|
# File 'lib/pandoru/secret_store.rb', line 130
def available?
RUBY_PLATFORM.include?('linux') && which?('secret-tool')
end
|
#delete(service) ⇒ Object
145
146
147
148
|
# File 'lib/pandoru/secret_store.rb', line 145
def delete(service)
_out, ok = run(['secret-tool', 'clear', 'service', service])
ok
end
|
#name ⇒ Object
128
|
# File 'lib/pandoru/secret_store.rb', line 128
def name = 'libsecret (secret-tool)'
|
#read(service) ⇒ Object
134
135
136
137
|
# File 'lib/pandoru/secret_store.rb', line 134
def read(service)
out, ok = run(['secret-tool', 'lookup', 'service', service])
ok ? out.chomp : nil
end
|
#write(service, secret) ⇒ Object
139
140
141
142
143
|
# File 'lib/pandoru/secret_store.rb', line 139
def write(service, secret)
_out, ok = run(['secret-tool', 'store', '--label', service, 'service', service],
stdin_data: secret)
ok
end
|