Class SecretsUtilities
java.lang.Object
com.inductiveautomation.ignition.common.script.builtin.SecretsUtilities
Class for secret utilities, providing methods to interact with secret providers and secrets.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.python.core.PyObjectcreateEmbeddedSecretConfig(org.python.core.PyObject json) Create a new embedded SecretConfig instance given the JSON representation of the encrypted data.org.python.core.PyObjectcreateReferencedSecretConfig(String providerName, String secretName) Create a new referenced SecretConfig instance given the name of the secret provider and the name of the secret stored in the provider.decrypt(org.python.core.PyObject json) Decrypts a JSON representation of an encrypted string or byte array back to its original form using the system encryption service.org.python.core.PyObjectencrypt(byte[] bytes) Encrypts a byte array using the system encryption service.org.python.core.PyObjectEncrypts a string using the system encryption service.org.python.core.PyObjectEncrypts a string using the specified charset with the system encryption service.List<org.python.core.PyStringMap>Returns a list of available secret providers.List<org.python.core.PyStringMap>getSecrets(String providerName) Retrieves a list of secrets from the specified provider.readConfiguredSecretValue(org.python.core.PyObject json) Reads the value of a secret given aSecretConfig.readSecretValue(String providerName, String secretName) Reads the value of a secret from the specified provider.
-
Field Details
-
SecretException
-
SecretNotFoundException
-
SecretProviderException
-
SecretProviderNotFoundException
-
SystemEncryptionServiceException
-
-
Constructor Details
-
SecretsUtilities
-
-
Method Details
-
getProviders
Returns a list of available secret providers.- Returns:
- a list of dictionaries, each containing 'name', 'description', and 'type' of a secret provider.
-
getSecrets
Retrieves a list of secrets from the specified provider.- Parameters:
providerName- the name of the secret provider.- Returns:
- a list of dictionaries, each containing 'name' of a secret.
-
readSecretValue
Reads the value of a secret from the specified provider.- Parameters:
providerName- the name of the secret provider.secretName- the name of the secret to read.- Returns:
- a
PyPlaintextobject containing the secret value.
-
encrypt
Encrypts a string using the system encryption service.- Parameters:
string- the string to encrypt.- Returns:
- a JSON representation of the encrypted string.
-
encrypt
Encrypts a string using the specified charset with the system encryption service.- Parameters:
string- the string to encrypt.charset- the charset to use for encoding the string.- Returns:
- a JSON representation of the encrypted string.
-
encrypt
public org.python.core.PyObject encrypt(byte[] bytes) Encrypts a byte array using the system encryption service.- Parameters:
bytes- the byte array to encrypt.- Returns:
- a JSON representation of the encrypted byte array.
-
decrypt
Decrypts a JSON representation of an encrypted string or byte array back to its original form using the system encryption service.- Parameters:
json- the JSON representation of the encrypted data.- Returns:
- a
PyPlaintextobject containing the decrypted value.
-
createEmbeddedSecretConfig
public org.python.core.PyObject createEmbeddedSecretConfig(org.python.core.PyObject json) Create a new embedded SecretConfig instance given the JSON representation of the encrypted data.- Parameters:
json- the JSON representation of the encrypted data.- Returns:
- a JSON representation of a new embedded SecretConfig instance.
-
createReferencedSecretConfig
public org.python.core.PyObject createReferencedSecretConfig(String providerName, String secretName) Create a new referenced SecretConfig instance given the name of the secret provider and the name of the secret stored in the provider.- Parameters:
providerName- the name of the provider.secretName- the name of the secret.- Returns:
- a JSON representation of a new referenced SecretConfig instance.
-
readConfiguredSecretValue
Reads the value of a secret given aSecretConfig.- Parameters:
json- the JSON representation of the SecretConfig.- Returns:
- a
PyPlaintextobject containing the secret value.
-