Class: Ironclad::Cache::Keyctl
- Inherits:
-
Object
- Object
- Ironclad::Cache::Keyctl
- Defined in:
- lib/ironclad/cache/keyctl.rb
Overview
Linux kernel keyring via ‘keyctl`, stored in the user keyring (@u): it persists across this user’s sessions and clears on reboot, at which point a miss simply re-seeds from the source.
Instance Method Summary collapse
Instance Method Details
#read(name) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/ironclad/cache/keyctl.rb', line 11 def read(name) id, status = Open3.capture2('keyctl', 'search', '@u', 'user', name) return unless status.success? out, status = Open3.capture2('keyctl', 'pipe', id.chomp) status.success? ? out : nil end |
#write(name, key) ⇒ Object
19 20 21 |
# File 'lib/ironclad/cache/keyctl.rb', line 19 def write(name, key) Open3.capture2('keyctl', 'padd', 'user', name, '@u', stdin_data: key) end |