Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
Update go.mdx
Daniel5bec7d1cda92
diff --git a/docs/sdks/languages/go.mdx b/docs/sdks/languages/go.mdxindex 61fa6e8195..6233da8d07 100644--- a/docs/sdks/languages/go.mdx+++ b/docs/sdks/languages/go.mdx@@ -136,266 +136,274 @@ When using automatic token refreshing it's important to understand how your applThis is only necessary if you are creating multiple instances of the client, and those instances are deleted or otherwise removed throughout the application lifecycle.If you are only creating one instance of the client, and it will be used throughout the lifetime of your application, you don't need to worry about this.-# Authentication-The SDK supports a variety of authentication methods. The most common authentication method is Universal Auth, which uses a client ID and client secret to authenticate.--#### Universal Auth--**Using environment variables**--Call `.Auth().UniversalAuthLogin()` with empty arguments to use the following environment variables:--- `INFISICAL_UNIVERSAL_AUTH_CLIENT_ID` - Your machine identity client ID.-- `INFISICAL_UNIVERSAL_AUTH_CLIENT_SECRET` - Your machine identity client secret.--**Using the SDK directly**--```go-_, err := client.Auth().UniversalAuthLogin("CLIENT_ID", "CLIENT_SECRET")--if err != nil {- fmt.Println(err)- os.Exit(1)-}-```--#### GCP ID Token Auth--<Info>- Please note that this authentication method will only work if you're running- your application on Google Cloud Platform. Please [read- more](/documentation/platform/identities/gcp-auth) about this authentication- method.-</Info>--**Using environment variables**--Call `.Auth().GcpIdTokenAuthLogin()` with empty arguments to use the following environment variables:--- `INFISICAL_GCP_AUTH_IDENTITY_ID` - Your Infisical Machine Identity ID.--**Using the SDK directly**--```go-_, err := client.Auth().GcpIdTokenAuthLogin("YOUR_MACHINE_IDENTITY_ID")--if err != nil {- fmt.Println(err)- os.Exit(1)-}-```--#### GCP IAM Auth--**Using environment variables**--Call `.Auth().GcpIamAuthLogin()` with empty arguments to use the following environment variables:+## Authentication-- `INFISICAL_GCP_IAM_AUTH_IDENTITY_ID` - Your Infisical Machine Identity ID.-- `INFISICAL_GCP_IAM_SERVICE_ACCOUNT_KEY_FILE_PATH` - The path to your GCP service account key file.+### Authentication Methods-**Using the SDK directly**--```go-_, err = client.Auth().GcpIamAuthLogin("MACHINE_IDENTITY_ID", "SERVICE_ACCOUNT_KEY_FILE_PATH")--if err != nil {- fmt.Println(err)- os.Exit(1)-}-```--#### AWS IAM Auth--<Info>- Please note that this authentication method will only work if you're running- your application on AWS. Please [read- more](/documentation/platform/identities/aws-auth) about this authentication- method.-</Info>--**Using environment variables**--Call `.Auth().AwsIamAuthLogin()` with empty arguments to use the following environment variables:--- `INFISICAL_AWS_IAM_AUTH_IDENTITY_ID` - Your Infisical Machine Identity ID.--**Using the SDK directly**--```go-_, err = client.Auth().AwsIamAuthLogin("MACHINE_IDENTITY_ID")--if err != nil {- fmt.Println(err)- os.Exit(1)-}-```--#### Azure Auth--<Info>- Please note that this authentication method will only work if you're running- your application on Azure. Please [read- more](/documentation/platform/identities/azure-auth) about this authentication- method.-</Info>--**Using environment variables**--Call `.Auth().AzureAuthLogin()` with empty arguments to use the following environment variables:--- `INFISICAL_AZURE_AUTH_IDENTITY_ID` - Your Infisical Machine Identity ID.--**Using the SDK directly**--```go-_, err = client.Auth().AzureAuthLogin("MACHINE_IDENTITY_ID")--if err != nil {- fmt.Println(err)- os.Exit(1)-}-```--#### Kubernetes Auth--<Info>- Please note that this authentication method will only work if you're running- your application on Kubernetes. Please [read- more](/documentation/platform/identities/kubernetes-auth) about this- authentication method.-</Info>--**Using environment variables**--Call `.Auth().KubernetesAuthLogin()` with empty arguments to use the following environment variables:--- `INFISICAL_KUBERNETES_IDENTITY_ID` - Your Infisical Machine Identity ID.-- `INFISICAL_KUBERNETES_SERVICE_ACCOUNT_TOKEN_PATH_ENV_NAME` - The environment variable name that contains the path to the service account token. This is optional and will default to `/var/run/secrets/kubernetes.io/serviceaccount/token`.--**Using the SDK directly**--```go-// Service account token path will default to /var/run/secrets/kubernetes.io/serviceaccount/token if empty value is passed-_, err = client.Auth().KubernetesAuthLogin("MACHINE_IDENTITY_ID", "SERVICE_ACCOUNT_TOKEN_PATH")--if err != nil {- fmt.Println(err)- os.Exit(1)-}-```+The SDK supports a variety of authentication methods. The most common authentication method is Universal Auth, which uses a client ID and client secret to authenticate.-#### JWT Auth+<AccordionGroup>+ <Accordion title="Universal Auth">+ **Using environment variables**-<Info>- Please note that this authentication method requires a valid JWT token from- your JWT issuer. Please [read- more](/documentation/platform/identities/jwt-auth) about this authentication- method.-</Info>+ Call `.Auth().UniversalAuthLogin()` with empty arguments to use the following environment variables:-**Using the SDK**+ - `INFISICAL_UNIVERSAL_AUTH_CLIENT_ID` - Your machine identity client ID.+ - `INFISICAL_UNIVERSAL_AUTH_CLIENT_SECRET` - Your machine identity client secret.-```go-credential, err := client.Auth().JwtAuthLogin("MACHINE_IDENTITY_ID", "JWT_TOKEN")+ **Using the SDK directly**-if err != nil {- fmt.Println(err)- os.Exit(1)-}-```+ ```go+ _, err := client.Auth().UniversalAuthLogin("CLIENT_ID", "CLIENT_SECRET")-#### LDAP Auth+ if err != nil {+ fmt.Println(err)+ os.Exit(1)+ }+ ```+ </Accordion>-<Info>- Please note that this authentication method requires LDAP credentials. Please- [read more](/documentation/platform/identities/ldap-auth/general) about this- authentication method.-</Info>+ <Accordion title="GCP ID Token">+ <Info>+ Please note that this authentication method will only work if you're running+ your application on Google Cloud Platform. Please [read+ more](/documentation/platform/identities/gcp-auth) about this authentication+ method.+ </Info>-**Using environment variables**+ **Using environment variables**-You can set the `INFISICAL_LDAP_AUTH_IDENTITY_ID` environment variable and pass empty string for the identity ID:+ Call `.Auth().GcpIdTokenAuthLogin()` with empty arguments to use the following environment variables:-```go-credential, err := client.Auth().LdapAuthLogin("", "LDAP_USERNAME", "LDAP_PASSWORD")+ - `INFISICAL_GCP_AUTH_IDENTITY_ID` - Your Infisical Machine Identity ID.-if err != nil {- fmt.Println(err)- os.Exit(1)-}-```+ **Using the SDK directly**-**Using the SDK directly**+ ```go+ _, err := client.Auth().GcpIdTokenAuthLogin("YOUR_MACHINE_IDENTITY_ID")-```go-credential, err := client.Auth().LdapAuthLogin("MACHINE_IDENTITY_ID", "LDAP_USERNAME", "LDAP_PASSWORD")+ if err != nil {+ fmt.Println(err)+ os.Exit(1)+ }+ ```+ </Accordion>+ <Accordion title="GCP IAM Auth">+ **Using environment variables**-if err != nil {- fmt.Println(err)- os.Exit(1)-}-```+ Call `.Auth().GcpIamAuthLogin()` with empty arguments to use the following environment variables:-#### OCI Auth+ - `INFISICAL_GCP_IAM_AUTH_IDENTITY_ID` - Your Infisical Machine Identity ID.+ - `INFISICAL_GCP_IAM_SERVICE_ACCOUNT_KEY_FILE_PATH` - The path to your GCP service account key file.-<Info>- Please note that this authentication method will only work if you're running- your application on Oracle Cloud Infrastructure. Please [read- more](/documentation/platform/identities/oci-auth) about this authentication- method.-</Info>+ **Using the SDK directly**-**Using environment variables**+ ```go+ _, err = client.Auth().GcpIamAuthLogin("MACHINE_IDENTITY_ID", "SERVICE_ACCOUNT_KEY_FILE_PATH")-You can set the `INFISICAL_OCI_AUTH_IDENTITY_ID` environment variable and omit the `IdentityID` field:+ if err != nil {+ fmt.Println(err)+ os.Exit(1)+ }+ ```+ </Accordion>-```go-credential, err := client.Auth().OciAuthLogin(infisical.OciAuthLoginOptions{- UserID: "USER_OCID",- TenancyID: "TENANCY_OCID",- Fingerprint: "FINGERPRINT",- PrivateKey: "PRIVATE_KEY",- Region: "REGION",-})+ <Accordion title="AWS IAM Auth">+ <Info>+ Please note that this authentication method will only work if you're running+ your application on AWS. Please [read+ more](/documentation/platform/identities/aws-auth) about this authentication+ method.+ </Info>-if err != nil {- fmt.Println(err)- os.Exit(1)-}-```+ **Using environment variables**-**Using the SDK directly**+ Call `.Auth().AwsIamAuthLogin()` with empty arguments to use the following environment variables:-```go-credential, err := client.Auth().OciAuthLogin(infisical.OciAuthLoginOptions{- IdentityID: "MACHINE_IDENTITY_ID",- UserID: "USER_OCID",- TenancyID: "TENANCY_OCID",- Fingerprint: "FINGERPRINT",- PrivateKey: "PRIVATE_KEY",- Region: "REGION",- Passphrase: nil, // Optional: pointer to string if your private key has a passphrase-})+ - `INFISICAL_AWS_IAM_AUTH_IDENTITY_ID` - Your Infisical Machine Identity ID.-if err != nil {- fmt.Println(err)- os.Exit(1)-}-```+ **Using the SDK directly**-**OciAuthLoginOptions fields:**+ ```go+ _, err = client.Auth().AwsIamAuthLogin("MACHINE_IDENTITY_ID")-- `IdentityID` (string) - Your Infisical Machine Identity ID. Can be set via `INFISICAL_OCI_AUTH_IDENTITY_ID` environment variable.-- `UserID` (string) - Your OCI user OCID.-- `TenancyID` (string) - Your OCI tenancy OCID.-- `Fingerprint` (string) - Your OCI API key fingerprint.-- `PrivateKey` (string) - Your OCI private key (PEM format).-- `Region` (string) - Your OCI region (e.g., `us-ashburn-1`).-- `Passphrase` (\*string) - Optional: pointer to passphrase string if your private key is encrypted.+ if err != nil {+ fmt.Println(err)+ os.Exit(1)+ }+ ```+ </Accordion>+ <Accordion title="Azure Auth">+ <Info>+ Please note that this authentication method will only work if you're running+ your application on Azure. Please [read+ more](/documentation/platform/identities/azure-auth) about this authentication+ method.+ </Info>++ **Using environment variables**++ Call `.Auth().AzureAuthLogin()` with empty arguments to use the following environment variables:++ - `INFISICAL_AZURE_AUTH_IDENTITY_ID` - Your Infisical Machine Identity ID.++ **Using the SDK directly**++ ```go+ _, err = client.Auth().AzureAuthLogin("MACHINE_IDENTITY_ID")++ if err != nil {+ fmt.Println(err)+ os.Exit(1)+ }+ ```+ </Accordion>++ <Accordion title="Kubernetes Auth">+ <Info>+ Please note that this authentication method will only work if you're running+ your application on Kubernetes. Please [read+ more](/documentation/platform/identities/kubernetes-auth) about this+ authentication method.+ </Info>++ **Using environment variables**++ Call `.Auth().KubernetesAuthLogin()` with empty arguments to use the following environment variables:++ - `INFISICAL_KUBERNETES_IDENTITY_ID` - Your Infisical Machine Identity ID.+ - `INFISICAL_KUBERNETES_SERVICE_ACCOUNT_TOKEN_PATH_ENV_NAME` - The environment variable name that contains the path to the service account token. This is optional and will default to `/var/run/secrets/kubernetes.io/serviceaccount/token`.++ **Using the SDK directly**++ ```go+ // Service account token path will default to /var/run/secrets/kubernetes.io/serviceaccount/token if empty value is passed+ _, err = client.Auth().KubernetesAuthLogin("MACHINE_IDENTITY_ID", "SERVICE_ACCOUNT_TOKEN_PATH")++ if err != nil {+ fmt.Println(err)+ os.Exit(1)+ }+ ```+ </Accordion>+ <Accordion title="JWT Auth">+ <Info>+ Please note that this authentication method requires a valid JWT token from+ your JWT issuer. Please [read+ more](/documentation/platform/identities/jwt-auth) about this authentication+ method.+ </Info>++ **Using the SDK**++ ```go+ credential, err := client.Auth().JwtAuthLogin("MACHINE_IDENTITY_ID", "JWT_TOKEN")++ if err != nil {+ fmt.Println(err)+ os.Exit(1)+ }+ ```+ </Accordion>+ <Accordion title="LDAP Auth">+ <Info>+ Please note that this authentication method requires LDAP credentials. Please+ [read more](/documentation/platform/identities/ldap-auth/general) about this+ authentication method.+ </Info>++ **Using environment variables**++ You can set the `INFISICAL_LDAP_AUTH_IDENTITY_ID` environment variable and pass empty string for the identity ID:++ ```go+ credential, err := client.Auth().LdapAuthLogin("", "LDAP_USERNAME", "LDAP_PASSWORD")++ if err != nil {+ fmt.Println(err)+ os.Exit(1)+ }+ ```++ **Using the SDK directly**++ ```go+ credential, err := client.Auth().LdapAuthLogin("MACHINE_IDENTITY_ID", "LDAP_USERNAME", "LDAP_PASSWORD")++ if err != nil {+ fmt.Println(err)+ os.Exit(1)+ }+ ```+ </Accordion>++ <Accordion title="OCI Auth">+ <Info>+ Please note that this authentication method will only work if you're running+ your application on Oracle Cloud Infrastructure. Please [read+ more](/documentation/platform/identities/oci-auth) about this authentication+ method.+ </Info>++ **Using environment variables**++ You can set the `INFISICAL_OCI_AUTH_IDENTITY_ID` environment variable and omit the `IdentityID` field:++ ```go+ credential, err := client.Auth().OciAuthLogin(infisical.OciAuthLoginOptions{+ UserID: "USER_OCID",+ TenancyID: "TENANCY_OCID",+ Fingerprint: "FINGERPRINT",+ PrivateKey: "PRIVATE_KEY",+ Region: "REGION",+ })++ if err != nil {+ fmt.Println(err)+ os.Exit(1)+ }+ ```+++ **Using the SDK directly**++ ```go+ credential, err := client.Auth().OciAuthLogin(infisical.OciAuthLoginOptions{+ IdentityID: "MACHINE_IDENTITY_ID",+ UserID: "USER_OCID",+ TenancyID: "TENANCY_OCID",+ Fingerprint: "FINGERPRINT",+ PrivateKey: "PRIVATE_KEY",+ Region: "REGION",+ Passphrase: nil, // Optional: pointer to string if your private key has a passphrase+ })++ if err != nil {+ fmt.Println(err)+ os.Exit(1)+ }+ ```++ **OciAuthLoginOptions fields:**++ - `IdentityID` (string) - Your Infisical Machine Identity ID. Can be set via `INFISICAL_OCI_AUTH_IDENTITY_ID` environment variable.+ - `UserID` (string) - Your OCI user OCID.+ - `TenancyID` (string) - Your OCI tenancy OCID.+ - `Fingerprint` (string) - Your OCI API key fingerprint.+ - `PrivateKey` (string) - Your OCI private key (PEM format).+ - `Region` (string) - Your OCI region (e.g., `us-ashburn-1`).+ - `Passphrase` (\*string) - Optional: pointer to passphrase string if your private key is encrypted.+ </Accordion>+</AccordionGroup>++++### Sub-Organization Authentication-## Organization Authentication+<Note>+ This section is only relevant to you if your organization is utilizing [sub-organizations](/documentation/platform/sub-organizations) within Infisical.+</Note>All SDK authentication methods support logging into a sub-organization that your machine identity has access to. This is optional and only necessary when attempting to authenticate into a sub-organization using an identity created at the root organization.@@ -410,10 +418,10 @@ if err != nil {}```-<Note>+<Tip>If no organization slug is provided, the authentication session defaults tothe organization where the machine identity was originally created.-</Note>+</Tip>## Secrets@@ -942,7 +950,7 @@ dynamicSecret, err := client.DynamicSecrets().GetByName(infisical.GetDynamicSecr</Expandable></ParamField>-### Leases+## Dynamic Secret LeasesA lease represents a single set of generated credentials with its own TTL. Use leases to generate, inspect, renew, and revoke credentials from a dynamic secret. Access the leases interface with `client.DynamicSecrets().Leases()`.@@ -1072,7 +1080,7 @@ lease, err := client.DynamicSecrets().Leases().GetById(infisical.GetDynamicSecre</Expandable></ParamField>-#### Return+#### Return (map)<ParamField query="Return" type="(DynamicSecretLeaseWithDynamicSecret, error)">The lease, with the associated dynamic secret nested in its `DynamicSecret`@@ -1280,7 +1288,7 @@ deletedKey, err = client.Kms().Keys().Delete(infisical.KmsDeleteKeyOptions{</Expandable></ParamField>-#### Return (object)+#### Return<ParamField query="Return" type="object"><Expandable title="properties">