java.lang.Object
com.inductiveautomation.ignition.common.script.builtin.SecretsUtilities

public class SecretsUtilities extends Object
Class for secret utilities, providing methods to interact with secret providers and secrets.
  • Field Details

    • SecretException

      public static final Class<?> SecretException
    • SecretNotFoundException

      public static final Class<?> SecretNotFoundException
    • SecretProviderException

      public static final Class<?> SecretProviderException
    • SecretProviderNotFoundException

      public static final Class<?> SecretProviderNotFoundException
    • SystemEncryptionServiceException

      public static final Class<?> SystemEncryptionServiceException
  • Constructor Details

    • SecretsUtilities

      public SecretsUtilities(SecretsRpc rpc)
  • Method Details

    • getProviders

      public List<org.python.core.PyStringMap> getProviders()
      Returns a list of available secret providers.
      Returns:
      a list of dictionaries, each containing 'name', 'description', and 'type' of a secret provider.
    • getSecrets

      public List<org.python.core.PyStringMap> getSecrets(String providerName)
      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

      public PyPlaintext readSecretValue(String providerName, String secretName)
      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 PyPlaintext object containing the secret value.
    • encrypt

      public org.python.core.PyObject encrypt(String string)
      Encrypts a string using the system encryption service.
      Parameters:
      string - the string to encrypt.
      Returns:
      a JSON representation of the encrypted string.
    • encrypt

      public org.python.core.PyObject encrypt(String string, String charset)
      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

      public PyPlaintext 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.
      Parameters:
      json - the JSON representation of the encrypted data.
      Returns:
      a PyPlaintext object 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

      public PyPlaintext readConfiguredSecretValue(org.python.core.PyObject json)
      Reads the value of a secret given a SecretConfig.
      Parameters:
      json - the JSON representation of the SecretConfig.
      Returns:
      a PyPlaintext object containing the secret value.