Package dev.enola.common.secret.gnome
Class GnomeSecretManager
java.lang.Object
dev.enola.common.secret.gnome.GnomeSecretManager
- All Implemented Interfaces:
SecretManager,Closeable,AutoCloseable
GnomeSecretManager is a
SecretManager implementation that uses the GNOME keyring via
D-Bus. (An alternative would be to "shell out" and execute the external "secret-tool" command.)-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidDeletes a secret from the manager.getOptional(String key) Retrieves a secret by its key, with optionality.static voidvoidStores a secret value associated with a unique key.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.enola.common.secret.SecretManager
get
-
Constructor Details
-
GnomeSecretManager
- Throws:
IOException
-
-
Method Details
-
store
Description copied from interface:SecretManagerStores a secret value associated with a unique key. The sensitive value is provided as a char array. Implementations will zero out the inputvaluearray immediately after calling this method for security. If a secret with the same key already exists, its value is overwritten.- Specified by:
storein interfaceSecretManager- Parameters:
key- The unique key (name) for the secret.value- The sensitive secret value as a character array.- Throws:
IOException- If an error occurs while storing the secret.
-
getOptional
Description copied from interface:SecretManagerRetrieves a secret by its key, with optionality.- Specified by:
getOptionalin interfaceSecretManager- Parameters:
key- The unique key (name) of the secret to retrieve.- Returns:
- An
Optionalcontaining theSecret, if found.
-
delete
Description copied from interface:SecretManagerDeletes a secret from the manager.- Specified by:
deletein interfaceSecretManager- Parameters:
key- The unique key (name) of the secret to delete.
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
main
- Throws:
IOException
-