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 ofSimpleCollection, with the prompting capability removed.
-
-
Constructor Summary
Constructors Constructor Description SimpleCollection()The default collection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clears the private key of the transport encryption and the passphrase of the collection.voidclose()StringcreateItem(String label, CharSequence password)Creates an item with the provided properties in this collection.StringcreateItem(String label, CharSequence password, Map<String,String> attributes)Creates an item with the provided properties in this collection.voiddeleteItem(String objectPath)Delete an item from this collection.List<String>getItems(Map<String,String> attributes)Get the object paths of items with given attributes.char[]getSecret(String objectPath)Get the secret of the item.voidupdateItem(String objectPath, String label, CharSequence password, Map<String,String> attributes)Updates an item with the provided properties.
-
-
-
Constructor Detail
-
SimpleCollection
public SimpleCollection() throws IOExceptionThe default collection.- Throws:
IOException- if dbus collection can not be accessed.
-
-
Method Detail
-
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:
closein interfaceAutoCloseable- 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 itempassword- The password of the new itemattributes- 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 itempassword- 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 itemlabel- The displayable label of the new itempassword- The password of the new itemattributes- 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.
-
-