Method: Reedb::Vault.close_vault
- Defined in:
- lib/reedb.rb
.close_vault(uuid, token) ⇒ Object
Closes a vault to end the file transaction between you and the vault. The encryption key will be unloaded and scrubbed from memory which means you will have to unlock a vault again (which usually means more user interaction).
829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 |
# File 'lib/reedb.rb', line 829 def close_vault(uuid, token) token.delete!("\n") raise VaultNotAvailableError.new, 'The vault you have requested data from is not currently active on this system.' unless @@active_vaults[uuid] raise UnknownTokenError.new, 'The token you provided is unknown to this system. Access denied!' unless @@tokens[token] raise UnautherisedTokenError.new, 'The token you provided currently has no access to the desired vault. Access denied!' unless @@tokens[token].include?(uuid) DaemonLogger.write("Closing vault with #{uuid}.", 'debug') # Remove the vault from the debouncer @@debouncer.remove_vault(uuid) # Close the vault @@active_vaults[uuid].close # Delete the vault from the active_vault record with UUID @@active_vaults.delete(uuid) # TODO: Alert other applications # TODO: Don't delete the token if it is being used to access # other vaults on the system! @@tokens.delete(token) # Removes token from config @@config[:vaults][uuid][:tokens].delete(token) write_config end |