Package dev.enola.common.secret
Class InMemorySecretManager
java.lang.Object
dev.enola.common.secret.InMemorySecretManager
- All Implemented Interfaces:
SecretManager
- Direct Known Subclasses:
YamlSecretManager
-
Constructor Summary
ConstructorsConstructorDescriptionInMemorySecretManager(String key, String value) InMemorySecretManager(Map<String, String> secrets) -
Method Summary
Modifier and TypeMethodDescriptionvoidDeletes a secret from the manager.getAll()getOptional(String name) Retrieves a secret by its key, with optionality.voidStores 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
-
InMemorySecretManager
-
InMemorySecretManager
-
InMemorySecretManager
public InMemorySecretManager()
-
-
Method Details
-
getAll
-
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:
name- 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:
name- 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.- Throws:
IOException- If an error occurs while deleting the secret.
-