Class SimpleCollection

java.lang.Object
com.github.javakeyring.internal.freedesktop.SimpleCollection
All Implemented Interfaces:
AutoCloseable

public final class SimpleCollection extends Object implements AutoCloseable
A clone of SimpleCollection, with the prompting capability removed.
  • Constructor Details

    • SimpleCollection

      public SimpleCollection() throws IOException
      The default collection.
      Throws:
      IOException - if dbus collection can not be accessed.
  • Method Details

    • clear

      public void clear()
      Clears the private key of the transport encryption and the passphrase of the collection.
    • close

      public void close() throws Exception
      Specified by:
      close in interface AutoCloseable
      Throws:
      Exception
    • createItem

      public String createItem(String label, CharSequence password, Map<String,String> attributes) throws IllegalArgumentException
      Creates an item with the provided properties in this collection.
      Parameters:
      label - The displayable label of the new item
      password - The password of the new item
      attributes - The attributes of the new item
      Returns:
      DBus object path
      Throws:
      IllegalArgumentException - if inputs are null
    • createItem

      public String createItem(String label, CharSequence password) throws IllegalArgumentException
      Creates an item with the provided properties in this collection.
      Parameters:
      label - The displayable label of the new item
      password - The password of the new item
      Returns:
      DBus object path
      Throws:
      IllegalArgumentException - if inputs are null
    • updateItem

      public void updateItem(String objectPath, String label, CharSequence password, Map<String,String> attributes) throws IllegalArgumentException
      Updates an item with the provided properties.
      Parameters:
      objectPath - The DBus object path of the item
      label - The displayable label of the new item
      password - The password of the new item
      attributes - The attributes of the new item
      Throws:
      IllegalArgumentException - if inputs are null
    • getItems

      public List<String> getItems(Map<String,String> attributes)
      Get the object paths of items with given attributes.
      Parameters:
      attributes - The attributes of the secret
      Returns:
      object paths
    • getSecret

      public char[] getSecret(String objectPath)
      Get the secret of the item.
      Parameters:
      objectPath - The DBus object path of the item
      Returns:
      plain chars
    • deleteItem

      public void deleteItem(String objectPath) throws AccessControlException
      Delete an item from this collection.
      Parameters:
      objectPath - The DBus object path of the item
      Throws:
      AccessControlException - if user is prompted and refuses.