return"",fmt.Errorf("failed to read Infisical token secret from secret named [%s] in namespace [%s]: with error [%w]",infisicalSecret.Spec.TokenSecretReference.SecretName,infisicalSecret.Spec.TokenSecretReference.SecretNamespace,err)
return"",fmt.Errorf("the Infisical token is not set in the Kubernetes secret. Please add the key [%s] with the corresponding token value",INFISICAL_TOKEN_SECRET_KEY_NAME)
// Fetches service account credentials from a Kubernetes secret specified in the infisicalSecret object, extracts the access key, public key, and private key from the secret, and returns them as a ServiceAccountCredentials object.
// If any keys are missing or an error occurs, returns an empty object or an error object, respectively.
// Fetches plaintext secrets from an API endpoint using a service account.
// The function fetches the service account details and keys, decrypts the workspace key, fetches the encrypted secrets for the specified project and environment, and decrypts the secrets using the decrypted workspace key.
// Returns the plaintext secrets, encrypted secrets response, and any errors that occurred during the process.
returnnil,api.GetEncryptedSecretsV2Response{},fmt.Errorf("GetPlainTextSecretsViaServiceAccount: unable to get service account key details. [err=%v]",err)
returnnil,api.GetEncryptedSecretsV2Response{},fmt.Errorf("unable to find key for [projectId=%s] [err=%v]. Ensure that the given service account has access to given projectId",projectId,err)
returnnil,api.GetEncryptedSecretsV2Response{},fmt.Errorf("GetPlainTextSecretsViaServiceAccount: unable to decode EncryptedKey secrets because [err=%v]",err)
returnnil,api.GetEncryptedSecretsV2Response{},fmt.Errorf("GetPlainTextSecretsViaServiceAccount: unable to decode PublicKey secrets because [err=%v]",err)
returnnil,api.GetEncryptedSecretsV2Response{},fmt.Errorf("GetPlainTextSecretsViaServiceAccount: unable to decode PrivateKey secrets because [err=%v]",err)
returnnil,api.GetEncryptedSecretsV2Response{},fmt.Errorf("GetPlainTextSecretsViaServiceAccount: unable to get plain text secrets because [err=%v]",err)