From 40d16fa9964879ab65692ba90957233d875c1d03 Mon Sep 17 00:00:00 2001
From: Daniel Hougaard <62331820+DanielHougaard@users.noreply.github.com>
Date: Sat, 23 Dec 2023 15:10:30 +0400
Subject: [PATCH 01/13] Updated Node.js docs
---
docs/sdks/languages/node.mdx | 302 +++++++++++++++++++++++------------
1 file changed, 199 insertions(+), 103 deletions(-)
diff --git a/docs/sdks/languages/node.mdx b/docs/sdks/languages/node.mdx
index d28357c4e..9c3c427c4 100644
--- a/docs/sdks/languages/node.mdx
+++ b/docs/sdks/languages/node.mdx
@@ -9,39 +9,52 @@ If you're working with Node.js, the official [infisical-node](https://github.com
```js
import express from "express";
-import InfisicalClient from "infisical-node";
+
+import { InfisicalClient, LogLevel } from "@infisical/sdk";
+
const app = express();
+
const PORT = 3000;
const client = new InfisicalClient({
- token: "YOUR_INFISICAL_TOKEN"
+ clientId: "YOUR_CLIENT_ID",
+ clientSecret: "YOUR_CLIENT_SECRET",
+ logLevel: LogLevel.Error
});
app.get("/", async (req, res) => {
- // access value
- const name = await client.getSecret("NAME");
- res.send(`Hello! My name is: ${name.secretValue}`);
+ // access value
+
+ const name = await client.getSecret({
+ environment: "dev",
+ projectId: "656dba7f979ebd6652586669",
+ path: "/",
+ type: "shared",
+ secretName: "NAME"
+ });
+
+ res.send(`Hello! My name is: ${name.secretValue}`);
});
app.listen(PORT, async () => {
- console.log(`App listening on port ${PORT}`);
+ // initialize client
+
+ console.log(`App listening on port ${port}`);
});
```
This example demonstrates how to use the Infisical Node SDK with an Express application. The application retrieves a secret named "NAME" and responds to requests with a greeting that includes the secret value.
- We do not recommend hardcoding your [Infisical
- Token](/documentation/platform/token). Setting it as an environment
- variable would be best.
+ We do not recommend hardcoding your [Machine Identity Tokens](/platform/identities/overview). Setting it as an environment variable would be best.
## Installation
-Run `npm` to add `infisical-node` to your project.
+Run `npm` to add `@infisical/sdk` to your project.
```console
-$ npm install infisical-node --save
+$ npm install @infisical/sdk
```
## Configuration
@@ -51,22 +64,27 @@ Import the SDK and create a client instance with your [Infisical Token](/documen
```js
- import InfisicalClient from "infisical-node";
-
+ import { InfisicalClient, LogLevel } from "@infisical/sdk";
+
const client = new InfisicalClient({
- token: "your_infisical_token"
+ clientId: "YOUR_CLIENT_ID",
+ clientSecret: "YOUR_CLIENT_SECRET",
+ logLevel: LogLevel.Error
});
```
```js
- const InfisicalClient = require("infisical-node");
-
+ const { InfisicalClient, LogLevel } = require("@infisical/sdk");
+
const client = new InfisicalClient({
- token: "your_infisical_token"
+ clientId: "YOUR_CLIENT_ID",
+ clientSecret: "YOUR_CLIENT_SECRET",
+ logLevel: LogLevel.Error
});
````
+
@@ -74,134 +92,212 @@ Import the SDK and create a client instance with your [Infisical Token](/documen
### Parameters
-
-
- An [Infisical Token](/documentation/platform/token) scoped to a project
- and environment
-
-
- Your self-hosted absolute site URL including the protocol (e.g.
- `https://app.infisical.com`)
-
-
- Time-to-live (in seconds) for refreshing cached secrets. Default: `300`.
-
-
- Whether or not debug mode is on
-
-
+
+
+ Your machine identity client ID.
+
+
+ Your machine identity client secret.
+
+
+
+ An access token obtained from the machine identity login endpoint.
+
+
+
+ Your self-hosted absolute site URL including the protocol (e.g. `https://app.infisical.com`)
+
+
+ The level of logs you wish to log The logs are derived from Rust, as we have written our base SDK in Rust.
+
+
+
-
-## Caching
-
-The SDK caches every secret and updates it periodically based on the provided `cacheTTL`. For example, if `cacheTTL` of `300` is provided, then a secret will be refetched 5 minutes after the first fetch; if the fetch fails, the cached secret is returned.
-
-
- For optimal performance, we recommend creating a single instance of the Infisical client and exporting it to be used across your entire app to take advantage of caching benefits.
-
-
## Working with Secrets
-### client.getAllSecrets()
+### client.listSecrets(options)
```js
-const secrets = await client.getAllSecrets();
+const secrets = await client.listSecrets({
+ environment: "dev",
+ projectId: "PROJECT_ID",
+ path: "/foo/bar/",
+ includeImports: false
+});
```
Retrieve all secrets within the Infisical project and environment that client is connected to
-### client.getSecret(secretName, options)
+### Parameters
+
+
+
+
+ The slug name (dev, prod, etc) of the environment from where secrets should be fetched from.
+
+
+ The project ID where the secret lives in.
+
+
+
+ The path from where secrets should be fetched from.
+
+
+
+ Whether or not to include imported secrets from the current path. Read about [secret import](/platform/secret-reference)
+
+
+
+
+
+### client.getSecret(options)
```js
-const secret = await client.getSecret("API_KEY");
-const value = secret.secretValue; // get its value
+const secret = await client.getSecret({
+ environment: "dev",
+ projectId: "PROJECT_ID",
+ secretName: "API_KEY",
+ path: "/",
+ type: "shared"
+});
```
Retrieve a secret from Infisical.
-By default, `getSecret()` fetches and returns a personal secret. If not found, it returns a shared secret, or tries to retrieve the value from `process.env`. If a secret is fetched, `getSecret()` caches it to reduce excessive calls and re-fetches periodically based on the `cacheTTL` option (default is `300` seconds) when initializing the client — for more information, see the caching section.
+By default, `getSecret()` fetches and returns a shared secret.
### Parameters
-
- The key of the secret to retrieve
-
-
-
-
- The type of the secret. Valid options are "shared" or "personal"
-
-
+
+
+
+ The key of the secret to retrieve.
+
+
+ The project ID where the secret lives in.
+
+
+ The slug name (dev, prod, etc) of the environment from where secrets should be fetched from.
+
+
+ The path from where secret should be fetched from.
+
+
+ The type of the secret. Valid options are "shared" or "personal". If not specified, the default value is "shared".
+
+
-### client.createSecret(secretName, secretValue, options)
+### client.createSecret(options)
```js
-const newApiKey = await client.createSecret("API_KEY", "FOO");
+const newApiKey = await client.createSecret({
+ projectId: "PROJECT_ID",
+ environment: "dev",
+ secretName: "API_KEY",
+ secretValue: "SECRET VALUE",
+ path: "/",
+ type: "shared"
+});
```
Create a new secret in Infisical.
-
- The key of the secret to create
-
-
- The value of the secret to create
-
-
-
-
- The type of the secret. Valid options are "shared" or "personal". A personal secret can only be created if a shared secret with the same name exists.
-
-
+
+
+
+ The key of the secret to create.
+
+
+ The value of the secret.
+
+
+ The project ID where the secret lives in.
+
+
+ The slug name (dev, prod, etc) of the environment from where secrets should be fetched from.
+
+
+ The path from where secret should be created.
+
+
+ The type of the secret. Valid options are "shared" or "personal". If not specified, the default value is "shared".
+
+
-### client.updateSecret(secretName, secretValue, options)
+### client.updateSecret(options)
```js
-const updatedApiKey = await client.updateSecret("API_KEY", "BAR");
+const updatedApiKey = await client.updateSecret({
+ secretName: "API_KEY",
+ secretValue: "NEW SECRET VALUE",
+ projectId: "PROJECT_ID",
+ environment: "dev",
+ path: "/",
+ type: "shared"
+});
```
Update an existing secret in Infisical.
### Parameters
-
- The key of the secret to update
-
-
- The new value of the secret
-
-
-
-
- The type of the secret. Valid options are "shared" or "personal"
-
-
+
+
+
+ The key of the secret to update.
+
+
+ The new value of the secret.
+
+
+ The project ID where the secret lives in.
+
+
+ The slug name (dev, prod, etc) of the environment from where secrets should be fetched from.
+
+
+ The path from where secret should be updated.
+
+
+ The type of the secret. Valid options are "shared" or "personal". If not specified, the default value is "shared".
+
+
-### client.deleteSecret(secretName, options)
+### client.deleteSecret(options)
```js
-const deletedSecret = await client.deleteSecret("API_KEY");
+const deletedSecret = await client.deleteSecret({
+ secretName: "API_KEY",
+
+ environment: "dev",
+ projectId: "PROJECT_ID",
+ path: "/",
+
+ type: "shared"
+});
```
Delete a secret in Infisical.
-
- The key of the secret to delete
+
+
+
+ The key of the secret to update.
+
+
+ The project ID where the secret lives in.
+
+
+ The slug name (dev, prod, etc) of the environment from where secrets should be fetched from.
+
+
+ The path from where secret should be deleted.
+
+
+ The type of the secret. Valid options are "shared" or "personal". If not specified, the default value is "shared".
+
+
-
-
-
- The type of the secret. Valid options are "shared" or "personal". Note that deleting a shared secret also deletes all associated personal secrets.
-
-
-
-
-
From 0a2b078bdc69da03f9cce33093026044051cbbdb Mon Sep 17 00:00:00 2001
From: Daniel Hougaard <62331820+DanielHougaard@users.noreply.github.com>
Date: Sat, 23 Dec 2023 15:12:39 +0400
Subject: [PATCH 02/13] Update node.mdx
---
docs/sdks/languages/node.mdx | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/docs/sdks/languages/node.mdx b/docs/sdks/languages/node.mdx
index 9c3c427c4..0a645da1d 100644
--- a/docs/sdks/languages/node.mdx
+++ b/docs/sdks/languages/node.mdx
@@ -3,7 +3,7 @@ title: "Node"
icon: "node"
---
-If you're working with Node.js, the official [infisical-node](https://github.com/Infisical/infisical-node) package is the easiest way to fetch and work with secrets for your application.
+If you're working with Node.js, the official [infisical-node](https://github.com/Infisical/sdk/tree/main/languages/node) package is the easiest way to fetch and work with secrets for your application.
## Basic Usage
@@ -86,7 +86,6 @@ Import the SDK and create a client instance with your [Infisical Token](/documen
````
-
### Parameters
From b83964051cbefd3f4dfe9e35275df0e7e64405d8 Mon Sep 17 00:00:00 2001
From: Daniel Hougaard <62331820+DanielHougaard@users.noreply.github.com>
Date: Sat, 23 Dec 2023 15:29:08 +0400
Subject: [PATCH 03/13] Added required to required fields
---
docs/sdks/languages/node.mdx | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/docs/sdks/languages/node.mdx b/docs/sdks/languages/node.mdx
index 0a645da1d..82a1175eb 100644
--- a/docs/sdks/languages/node.mdx
+++ b/docs/sdks/languages/node.mdx
@@ -169,13 +169,13 @@ By default, `getSecret()` fetches and returns a shared secret.
-
+
The key of the secret to retrieve.
-
+
The project ID where the secret lives in.
-
+
The slug name (dev, prod, etc) of the environment from where secrets should be fetched from.
@@ -204,16 +204,16 @@ Create a new secret in Infisical.
-
+
The key of the secret to create.
-
+
The value of the secret.
-
+
The project ID where the secret lives in.
-
+
The slug name (dev, prod, etc) of the environment from where secrets should be fetched from.
@@ -244,16 +244,16 @@ Update an existing secret in Infisical.
-
+
The key of the secret to update.
-
+
The new value of the secret.
-
+
The project ID where the secret lives in.
-
+
The slug name (dev, prod, etc) of the environment from where secrets should be fetched from.
@@ -286,10 +286,10 @@ Delete a secret in Infisical.
The key of the secret to update.
-
+
The project ID where the secret lives in.
-
+
The slug name (dev, prod, etc) of the environment from where secrets should be fetched from.
From 8ccaa7f29ba1fced0809214c090a18f20a1460bc Mon Sep 17 00:00:00 2001
From: Daniel Hougaard <62331820+DanielHougaard@users.noreply.github.com>
Date: Sat, 23 Dec 2023 15:29:17 +0400
Subject: [PATCH 04/13] Updated python docs
---
docs/sdks/languages/python.mdx | 232 +++++++++++++++++++++++----------
1 file changed, 164 insertions(+), 68 deletions(-)
diff --git a/docs/sdks/languages/python.mdx b/docs/sdks/languages/python.mdx
index caf916451..fbab3e2f8 100644
--- a/docs/sdks/languages/python.mdx
+++ b/docs/sdks/languages/python.mdx
@@ -3,31 +3,38 @@ title: "Python"
icon: "python"
---
-If you're working with Python, the official [infisical-python](https://github.com/Infisical/infisical-python) package is the easiest way to fetch and work with secrets for your application.
+If you're working with Python, the official [infisical-python](https://github.com/Infisical/sdk/edit/main/crates/infisical-py) package is the easiest way to fetch and work with secrets for your application.
## Basic Usage
```py
from flask import Flask
-from infisical import InfisicalClient
+from infisical_client import ClientSettings, InfisicalClient, GetSecretOptions
app = Flask(__name__)
-client = InfisicalClient(token="your_infisical_token")
+client = InfisicalClient(ClientSettings(
+ client_id="MACHINE_IDENTITY_CLIENT_ID",
+ client_secret="MACHINE_IDENTITY_CLIENT_SECRET",
+))
@app.route("/")
def hello_world():
# access value
- name = client.get_secret("NAME")
+
+ name = client.getSecret(options=GetSecretOptions(
+ environment="dev",
+ project_id="PROJECT_ID",
+ secret_name="NAME"
+ ))
+
return f"Hello! My name is: {name.secret_value}"
```
This example demonstrates how to use the Infisical Python SDK with a Flask application. The application retrieves a secret named "NAME" and responds to requests with a greeting that includes the secret value.
- We do not recommend hardcoding your [Infisical
- Token](/documentation/platform/token). Setting it as an environment
- variable would be best.
+ We do not recommend hardcoding your [Machine Identity Tokens](/platform/identities/overview). Setting it as an environment variable would be best.
## Installation
@@ -35,26 +42,34 @@ This example demonstrates how to use the Infisical Python SDK with a Flask appli
Run `pip` to add `infisical-python` to your project
```console
-$ pip install infisical
+$ pip install infisical-python
```
Note: You need Python 3.7+.
## Configuration
-Import the SDK and create a client instance with your [Infisical Token](/documentation/platform/token).
+Import the SDK and create a client instance with your [Machine Identity](/api-reference/overview/authentication).
```py
-from infisical import InfisicalClient
+from infisical_client import ClientSettings, InfisicalClient
-client = InfisicalClient(token="your_infisical_token")
+client = InfisicalClient(ClientSettings(
+ client_id="MACHINE_IDENTITY_CLIENT_ID",
+ client_secret="MACHINE_IDENTITY_CLIENT_SECRET",
+))
```
### Parameters
-
- An [Infisical Token](/documentation/platform/token) scoped to a project
- and environment
+
+ Your Infisical Client ID.
+
+
+ Your Infisical Client Secret.
+
+
+ If you want to directly pass an access token obtained from the authentication endpoints, you can do so.
-
- Time-to-live (in seconds) for refreshing cached secrets. Default: `300`.
-
-
- Whether or not debug mode is on
-
-
-## Caching
-
-The SDK caches every secret and updates it periodically based on the provided `cache_ttl`. For example, if `cache_ttl` of `300` is provided, then a secret will be refetched 5 minutes after the first fetch; if the fetch fails, the cached secret is returned.
-
-
- For optimal performance, we recommend creating a single instance of the Infisical client and exporting it to be used across your entire app to take advantage of caching benefits.
-
## Working with Secrets
-### client.get_all_secrets()
+### client.listSecrets(options)
```py
-secrets = client.get_all_secrets()
+client.listSecrets(options=ListSecretsOptions(
+ environment="dev",
+ project_id="PROJECT_ID"
+))
```
Retrieve all secrets within the Infisical project and environment that client is connected to
-### client.get_secret(secret_name, options)
+### Parameters
+
+
+
+
+ The slug name (dev, prod, etc) of the environment from where secrets should be fetched from.
+
+
+ The project ID where the secret lives in.
+
+
+
+ The path from where secrets should be fetched from.
+
+
+
+ Whether or not to include imported secrets from the current path. Read about [secret import](/platform/secret-reference)
+
+
+
+
+
+### client.getSecret(options)
```py
-secret = client.get_secret("API_KEY")
+secret = client.getSecret(options=GetSecretOptions(
+ environment="dev",
+ project_id="658066938ffb84aa0aa507f6",
+ secret_name="API_KEY"
+))
value = secret.secret_value # get its value
```
-By default, `get_secret()` fetches and returns a personal secret. If not found, it returns a shared secret, or tries to retrieve the value from `os.environ`. If a secret is fetched, `get_secret()` caches it to reduce excessive calls and re-fetches periodically based on the `cacheTTL` option (default is 300 seconds) when initializing the client — for more information, see the caching section.
+By default, `getSecret()` fetches and returns a shared secret. If not found, it returns a personal secret.
### Parameters
-
- The key of the secret to retrieve
-
-
- The type of the secret. Valid options are "shared" or "personal"
+
+
+
+ The key of the secret to retrieve
+
+
+ The slug name (dev, prod, etc) of the environment from where secrets should be fetched from.
+
+
+ The project ID where the secret lives in.
+
+
+ The path from where secret should be fetched from.
+
+
+ The type of the secret. Valid options are "shared" or "personal". If not specified, the default value is "personal".
+
+
+ Whether or not to include imported secrets from the current path. Read about [secret import](/platform/secret-reference)
+
+
-### client.create_secret(secret_name, secret_value, options)
+### client.createSecret(options)
```py
-new_api_key = client.create_secret("API_KEY", "FOO");
+api_key = client.createSecret(options=CreateSecretOptions(
+ secret_name="API_KEY",
+ secret_value="Some API Key",
+ environment="dev",
+ project_id="PROJECT_ID"
+))
```
Create a new secret in Infisical.
### Parameters
-
- The key of the secret to create
-
-
- The value of the secret to create
-
-
- The type of the secret. Valid options are "shared" or "personal". A personal secret can only be created if a shared secret with the same name exists.
+
+
+
+ The key of the secret to create.
+
+
+ The value of the secret.
+
+
+ The project ID where the secret lives in.
+
+
+ The slug name (dev, prod, etc) of the environment from where secrets should be fetched from.
+
+
+ The path from where secret should be created.
+
+
+ The type of the secret. Valid options are "shared" or "personal". If not specified, the default value is "shared".
+
+
-### client.update_secret(secret_name, secret_value, options)
+### client.updateSecret(options)
```py
-updated_api_key = client.update_secret("API_KEY", "BAR");
+client.updateSecret(options=UpdateSecretOptions(
+ secret_name="API_KEY",
+ secret_value="NEW_VALUE",
+ environment="dev",
+ project_id="PROJECT_ID"
+))
```
Update an existing secret in Infisical.
### Parameters
-
- The key of the secret to update
-
-
- The new value of the secret
-
-
- The type of the secret. Valid options are "shared" or "personal"
+
+
+
+ The key of the secret to update.
+
+
+ The new value of the secret.
+
+
+ The project ID where the secret lives in.
+
+
+ The slug name (dev, prod, etc) of the environment from where secrets should be fetched from.
+
+
+ The path from where secret should be updated.
+
+
+ The type of the secret. Valid options are "shared" or "personal". If not specified, the default value is "shared".
+
+
-### client.delete_secret(secret_name, options)
+### client.deleteSecret(options)
```py
-deleted_secret = client.delete_secret("API_KEY");
+client.deleteSecret(options=DeleteSecretOptions(
+ environment="dev",
+ project_id="PROJECT_ID",
+ secret_name="API_KEY"
+))
```
Delete a secret in Infisical.
### Parameters
-
- The key of the secret to delete
+
+
+
+ The key of the secret to update.
+
+
+ The project ID where the secret lives in.
+
+
+ The slug name (dev, prod, etc) of the environment from where secrets should be fetched from.
+
+
+ The path from where secret should be deleted.
+
+
+ The type of the secret. Valid options are "shared" or "personal". If not specified, the default value is "shared".
+
+
-
- The type of the secret. Valid options are "shared" or "personal"
-
-
-Follow this GitHub
-[issue](https://github.com/Infisical/infisical/issues/433) to stay updated.
From 13d058025cfb28b599830b7603c53c42fe8f8652 Mon Sep 17 00:00:00 2001
From: Daniel Hougaard <62331820+DanielHougaard@users.noreply.github.com>
Date: Sat, 23 Dec 2023 15:29:24 +0400
Subject: [PATCH 05/13] Formatting and link changes
---
docs/sdks/overview.mdx | 89 +++++++++++++-----------------------------
1 file changed, 27 insertions(+), 62 deletions(-)
diff --git a/docs/sdks/overview.mdx b/docs/sdks/overview.mdx
index a83e7f726..7537b63fd 100644
--- a/docs/sdks/overview.mdx
+++ b/docs/sdks/overview.mdx
@@ -2,69 +2,34 @@
title: "Introduction"
---
-From local development to production, Infisical SDKs provide the easiest way for your app to fetch back secrets from Infisical on demand.
+From local development to production, Infisical SDKs provide the easiest way for your app to fetch back secrets from Infisical on demand.
-- Install and initialize a language-specific client SDK into your application
-- Provision the client scoped-access to a project and environment in Infisical
-- Fetch secrets on demand
+- Install and initialize a language-specific client SDK into your application
+- Provision the client scoped-access to a project and environment in Infisical
+- Fetch secrets on demand
-
- Manage secrets for your Node application on demand
-
-
- Manage secrets for your Python application on demand
-
-
- Manage secrets for your Java application on demand
-
-
- Manage secrets for your Ruby application on demand
-
-
- Manage secrets for your Go application on demand
-
-
- Manage secrets for your Rust application on demand
-
-
- Manage secrets for your PHP application on demand
-
+
+ Manage secrets for your Node application on demand
+
+
+ Manage secrets for your Python application on demand
+
+
+ Manage secrets for your Java application on demand
+
+
+ Manage secrets for your Ruby application on demand
+
+
+ Manage secrets for your Go application on demand
+
+
+ Manage secrets for your Rust application on demand
+
+
+ Manage secrets for your PHP application on demand
+
## FAQ
@@ -98,8 +63,8 @@ From local development to production, Infisical SDKs provide the easiest way for
- You always pull in the right secrets because they're fetched on demand from a centralize source that is Infisical.
- You can use the Infisical which comes with tons of benefits like secret versioning, access controls, audit logs, etc.
- You now risk leaking one token that can be revoked instead of dozens of raw secrets.
-
+
And much more.
-
+
From 2f249566517b685fde391978f7f47e652f5ce095 Mon Sep 17 00:00:00 2001
From: Daniel Hougaard <62331820+DanielHougaard@users.noreply.github.com>
Date: Sat, 23 Dec 2023 15:47:16 +0400
Subject: [PATCH 06/13] Updated coming soon description
---
docs/sdks/languages/go.mdx | 3 +--
docs/sdks/languages/php.mdx | 2 +-
docs/sdks/languages/ruby.mdx | 3 +--
docs/sdks/languages/rust.mdx | 3 +--
4 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/docs/sdks/languages/go.mdx b/docs/sdks/languages/go.mdx
index b470c5b7d..349efc3af 100644
--- a/docs/sdks/languages/go.mdx
+++ b/docs/sdks/languages/go.mdx
@@ -5,5 +5,4 @@ icon: "golang"
Coming soon.
-Follow this GitHub
-[issue](https://github.com/Infisical/infisical/issues/436) to stay updated.
+Star our GitHub repository to stay updated [cross-language SDK](https://github.com/Infisical/infisical/issues/437) GitHub repository to stay updated.
diff --git a/docs/sdks/languages/php.mdx b/docs/sdks/languages/php.mdx
index 996b95c74..e40b112d8 100644
--- a/docs/sdks/languages/php.mdx
+++ b/docs/sdks/languages/php.mdx
@@ -5,4 +5,4 @@ icon: "php"
Coming soon.
-Follow this GitHub [issue](https://github.com/Infisical/infisical/issues/531) to stay updated.
\ No newline at end of file
+Star our GitHub repository to stay updated [cross-language SDK](https://github.com/Infisical/infisical/issues/437) GitHub repository to stay updated.
diff --git a/docs/sdks/languages/ruby.mdx b/docs/sdks/languages/ruby.mdx
index 1233e44bd..b49493da1 100644
--- a/docs/sdks/languages/ruby.mdx
+++ b/docs/sdks/languages/ruby.mdx
@@ -5,5 +5,4 @@ icon: "gem"
Coming soon.
-Follow this GitHub
-[issue](https://github.com/Infisical/infisical/issues/435) to stay updated.
+Star our GitHub repository to stay updated [cross-language SDK](https://github.com/Infisical/infisical/issues/437) GitHub repository to stay updated.
diff --git a/docs/sdks/languages/rust.mdx b/docs/sdks/languages/rust.mdx
index 5d5b770ca..e4da1197f 100644
--- a/docs/sdks/languages/rust.mdx
+++ b/docs/sdks/languages/rust.mdx
@@ -5,5 +5,4 @@ icon: "rust"
Coming soon.
-Follow this GitHub
-[issue](https://github.com/Infisical/infisical/issues/437) to stay updated.
+Star our GitHub repository to stay updated [cross-language SDK](https://github.com/Infisical/infisical/issues/437) GitHub repository to stay updated.
From a514a62a299e9c098c057afb378309e64bb7fb23 Mon Sep 17 00:00:00 2001
From: Daniel Hougaard <62331820+DanielHougaard@users.noreply.github.com>
Date: Sat, 23 Dec 2023 15:48:02 +0400
Subject: [PATCH 07/13] Fixed typos
---
docs/sdks/languages/go.mdx | 2 +-
docs/sdks/languages/php.mdx | 2 +-
docs/sdks/languages/ruby.mdx | 2 +-
docs/sdks/languages/rust.mdx | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/docs/sdks/languages/go.mdx b/docs/sdks/languages/go.mdx
index 349efc3af..3baca3b0f 100644
--- a/docs/sdks/languages/go.mdx
+++ b/docs/sdks/languages/go.mdx
@@ -5,4 +5,4 @@ icon: "golang"
Coming soon.
-Star our GitHub repository to stay updated [cross-language SDK](https://github.com/Infisical/infisical/issues/437) GitHub repository to stay updated.
+Star our GitHub repository to stay updated [cross-language SDK](https://github.com/Infisical/sdk) GitHub repository to stay updated.
diff --git a/docs/sdks/languages/php.mdx b/docs/sdks/languages/php.mdx
index e40b112d8..bf861acb4 100644
--- a/docs/sdks/languages/php.mdx
+++ b/docs/sdks/languages/php.mdx
@@ -5,4 +5,4 @@ icon: "php"
Coming soon.
-Star our GitHub repository to stay updated [cross-language SDK](https://github.com/Infisical/infisical/issues/437) GitHub repository to stay updated.
+Star our GitHub repository to stay updated [cross-language SDK](https://github.com/Infisical/sdk) GitHub repository to stay updated.
diff --git a/docs/sdks/languages/ruby.mdx b/docs/sdks/languages/ruby.mdx
index b49493da1..2836f7043 100644
--- a/docs/sdks/languages/ruby.mdx
+++ b/docs/sdks/languages/ruby.mdx
@@ -5,4 +5,4 @@ icon: "gem"
Coming soon.
-Star our GitHub repository to stay updated [cross-language SDK](https://github.com/Infisical/infisical/issues/437) GitHub repository to stay updated.
+Star our GitHub repository to stay updated [cross-language SDK](https://github.com/Infisical/sdk) GitHub repository to stay updated.
diff --git a/docs/sdks/languages/rust.mdx b/docs/sdks/languages/rust.mdx
index e4da1197f..d535ad527 100644
--- a/docs/sdks/languages/rust.mdx
+++ b/docs/sdks/languages/rust.mdx
@@ -5,4 +5,4 @@ icon: "rust"
Coming soon.
-Star our GitHub repository to stay updated [cross-language SDK](https://github.com/Infisical/infisical/issues/437) GitHub repository to stay updated.
+Star our GitHub repository to stay updated [cross-language SDK](https://github.com/Infisical/sdk) GitHub repository to stay updated.
From b6d648f1f3f0e7320742a5d8f0cfbc87e4f34234 Mon Sep 17 00:00:00 2001
From: Daniel Hougaard <62331820+DanielHougaard@users.noreply.github.com>
Date: Sat, 23 Dec 2023 15:48:14 +0400
Subject: [PATCH 08/13] Added Java docs
---
docs/sdks/languages/java.mdx | 292 ++++++++++++++++++++++++++++++++++-
1 file changed, 289 insertions(+), 3 deletions(-)
diff --git a/docs/sdks/languages/java.mdx b/docs/sdks/languages/java.mdx
index 7bc371bae..6e59c67f7 100644
--- a/docs/sdks/languages/java.mdx
+++ b/docs/sdks/languages/java.mdx
@@ -3,7 +3,293 @@ title: "Java"
icon: "java"
---
-Coming soon.
+If you're working with Java, the official [Infisical Java SDK](https://github.com/Infisical/sdk/tree/main/languages/java) package is the easiest way to fetch and work with secrets for your application.
-Follow this GitHub
-[issue](https://github.com/Infisical/infisical/issues/434) to stay updated.
+## Basic Usage
+
+```java
+package com.example.app;
+
+import com.infisical.sdk.InfisicalClient;
+import com.infisical.sdk.schema.*;
+
+public class Example {
+ public static void main(String[] args) {
+ // Create a new Infisical Client
+ ClientSettings settings = new ClientSettings();
+ settings.setClientID("MACHINE_IDENTITY_CLIENT_ID");
+ settings.setClientSecret("MACHINE_IDENTITY_CLIENT_SECRET");
+
+ InfisicalClient client = new InfisicalClient(settings);
+
+ // Create the options for fetching the secret
+ GetSecretOptions options = new GetSecretOptions();
+ options.setSecretName("TEST");
+ options.setEnvironment("dev");
+ options.setProjectID("PROJECT_ID");
+
+ // Fetch the sercret with the provided options
+ GetSecretResponseSecret secret = client.getSecret(options);
+
+ // Print the value
+ System.out.println(secret.getSecretValue());
+
+ // Important to avoid memory leaks!
+ // If you intend to use the client throughout your entire application, you can omit this line.
+ client.close();
+ }
+}
+```
+
+This example demonstrates how to use the Infisical Java SDK in a Java application. The application retrieves a secret named `TEST` from the `dev` environment of the `PROJECT_ID` project.
+
+
+ We do not recommend hardcoding your [Machine Identity Tokens](/platform/identities/overview). Setting it as an environment variable would be best.
+
+
+# Installation
+
+The Infisical Java SDK is hosted on the GitHub Packages Apache Maven registry. Because of this you need to configure your environment properly so it's able to pull dependencies from the GitHub registry. Please check [this guide from GitHub](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-apache-maven-registry) on how to achieve this.
+
+Our package is [located here](https://github.com/Infisical/sdk/packages/2019741). Please follow the installation guide on the page.
+
+# Configuration
+
+Import the SDK and create a client instance with your [Machine Identity](/platform/identities/universal-auth).
+
+```java
+import com.infisical.sdk.InfisicalClient;
+import com.infisical.sdk.schema.*;
+
+public class App {
+ public static void main(String[] args) {
+
+ ClientSettings settings = new ClientSettings();
+ settings.setClientID("MACHINE_IDENTITY_CLIENT_ID");
+ settings.setClientSecret("MACHINE_IDENTITY_CLIENT_SECRET");
+
+ InfisicalClient client = new InfisicalClient(settings); // Your client!
+ }
+}
+```
+
+### ClientSettings methods
+
+
+
+
+ Your machine identity client ID.
+
+
+ Your machine identity client secret.
+
+
+
+ An access token obtained from the machine identity login endpoint.
+
+
+
+ Your self-hosted absolute site URL including the protocol (e.g. `https://app.infisical.com`)
+
+
+
+
+
+## Working with Secrets
+
+### client.listSecrets(options)
+
+```java
+ListSecretsOptions options = new ListSecretsOptions();
+options.setEnvironment("dev");
+options.setProjectID("PROJECT_ID");
+options.setPath("/foo/bar");
+options.setIncludeImports(false);
+
+SecretElement[] secrets = client.listSecrets(options);
+```
+
+Retrieve all secrets within the Infisical project and environment that client is connected to
+
+### Methods
+
+
+
+
+ The slug name (dev, prod, etc) of the environment from where secrets should be fetched from.
+
+
+
+ The project ID where the secret lives in.
+
+
+
+ The path from where secrets should be fetched from.
+
+
+
+ Whether or not to include imported secrets from the current path. Read about [secret import](/platform/secret-reference)
+
+
+
+
+
+### client.getSecret(options)
+
+```java
+GetSecretOptions options = new GetSecretOptions();
+options.setSecretName("TEST");
+options.setEnvironment("dev");
+options.setProjectID("PROJECT_ID");
+
+GetSecretResponseSecret secret = client.getSecret(options);
+
+String secretValue = secret.getSecretValue();
+```
+
+Retrieve a secret from Infisical.
+
+By default, `getSecret()` fetches and returns a shared secret.
+
+### Methods
+
+
+
+
+ The key of the secret to retrieve.
+
+
+ The project ID where the secret lives in.
+
+
+ The slug name (dev, prod, etc) of the environment from where secrets should be fetched from.
+
+
+ The path from where secret should be fetched from.
+
+
+ The type of the secret. Valid options are "shared" or "personal". If not specified, the default value is "shared".
+
+
+
+
+### client.createSecret(options)
+
+```java
+CreateSecretOptions createOptions = new CreateSecretOptions();
+createOptions.setSecretName("NEW_SECRET");
+createOptions.setEnvironment("dev");
+createOptions.setProjectID("PROJECT_ID");
+createOptions.setSecretValue("SOME SECRET VALUE");
+createOptions.setPath("/"); // Default
+createOptions.setType("shared"); // Default
+
+CreateSecretResponseSecret newSecret = client.createSecret(createOptions);
+```
+
+Create a new secret in Infisical.
+
+### Methods
+
+
+
+
+ The key of the secret to create.
+
+
+ The value of the secret.
+
+
+ The project ID where the secret lives in.
+
+
+ The slug name (dev, prod, etc) of the environment from where secrets should be fetched from.
+
+
+ The path from where secret should be created.
+
+
+ The type of the secret. Valid options are "shared" or "personal". If not specified, the default value is "shared".
+
+
+
+
+### client.updateSecret(options)
+
+```java
+UpdateSecretOptions options = new UpdateSecretOptions();
+
+options.setSecretName("SECRET_TO_UPDATE");
+options.setSecretValue("NEW SECRET VALUE");
+options.setEnvironment("dev");
+options.setProjectID("PROJECT_ID");
+options.setPath("/"); // Default
+options.setType("shared"); // Default
+
+UpdateSecretResponseSecret updatedSecret = client.updateSecret(options);
+```
+
+Update an existing secret in Infisical.
+
+### Methods
+
+
+
+
+ The key of the secret to update.
+
+
+ The new value of the secret.
+
+
+ The project ID where the secret lives in.
+
+
+ The slug name (dev, prod, etc) of the environment from where secrets should be fetched from.
+
+
+ The path from where secret should be updated.
+
+
+ The type of the secret. Valid options are "shared" or "personal". If not specified, the default value is "shared".
+
+
+
+
+### client.deleteSecret(options)
+
+```java
+DeleteSecretOptions options = new DeleteSecretOptions();
+
+options.setSecretName("SECRET_TO_DELETE");
+options.setEnvironment("dev");
+options.setProjectID("PROJECT_ID");
+options.setPath("/"); // Default
+options.setType("shared"); // Default
+
+DeleteSecretResponseSecret deletedSecret = client.deleteSecret(options);
+```
+
+Delete a secret in Infisical.
+
+### Methods
+
+
+
+
+ The key of the secret to update.
+
+
+ The project ID where the secret lives in.
+
+
+ The slug name (dev, prod, etc) of the environment from where secrets should be fetched from.
+
+
+ The path from where secret should be deleted.
+
+
+ The type of the secret. Valid options are "shared" or "personal". If not specified, the default value is "shared".
+
+
+
From 19e8b6d37b6b02e6d38d8519ed6ce78b989089de Mon Sep 17 00:00:00 2001
From: Daniel Hougaard <62331820+DanielHougaard@users.noreply.github.com>
Date: Sat, 23 Dec 2023 15:48:21 +0400
Subject: [PATCH 09/13] Update node.mdx
---
docs/sdks/languages/node.mdx | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/docs/sdks/languages/node.mdx b/docs/sdks/languages/node.mdx
index 82a1175eb..09af6fa57 100644
--- a/docs/sdks/languages/node.mdx
+++ b/docs/sdks/languages/node.mdx
@@ -27,7 +27,7 @@ app.get("/", async (req, res) => {
const name = await client.getSecret({
environment: "dev",
- projectId: "656dba7f979ebd6652586669",
+ projectId: "PROJECT_ID",
path: "/",
type: "shared",
secretName: "NAME"
@@ -131,10 +131,10 @@ Retrieve all secrets within the Infisical project and environment that client is
-
+
The slug name (dev, prod, etc) of the environment from where secrets should be fetched from.
-
+
The project ID where the secret lives in.
From 024914c168a20c0fab0ac3bf6378847e45105201 Mon Sep 17 00:00:00 2001
From: Daniel Hougaard <62331820+DanielHougaard@users.noreply.github.com>
Date: Sat, 23 Dec 2023 15:48:24 +0400
Subject: [PATCH 10/13] Update python.mdx
---
docs/sdks/languages/python.mdx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/sdks/languages/python.mdx b/docs/sdks/languages/python.mdx
index fbab3e2f8..557642c09 100644
--- a/docs/sdks/languages/python.mdx
+++ b/docs/sdks/languages/python.mdx
@@ -121,7 +121,7 @@ Retrieve all secrets within the Infisical project and environment that client is
```py
secret = client.getSecret(options=GetSecretOptions(
environment="dev",
- project_id="658066938ffb84aa0aa507f6",
+ project_id="PROJECT_ID",
secret_name="API_KEY"
))
value = secret.secret_value # get its value
From 37b036e614b1b4db1026767fbb7e63f74c0f9bca Mon Sep 17 00:00:00 2001
From: Daniel Hougaard <62331820+DanielHougaard@users.noreply.github.com>
Date: Sat, 23 Dec 2023 15:49:03 +0400
Subject: [PATCH 11/13] Update overview.mdx
---
docs/sdks/overview.mdx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/sdks/overview.mdx b/docs/sdks/overview.mdx
index 7537b63fd..3b93a147d 100644
--- a/docs/sdks/overview.mdx
+++ b/docs/sdks/overview.mdx
@@ -15,7 +15,7 @@ From local development to production, Infisical SDKs provide the easiest way for
Manage secrets for your Python application on demand
-
+
Manage secrets for your Java application on demand
From 287ed05ab704830f3e95d351e9b7fe9f4c55875c Mon Sep 17 00:00:00 2001
From: Daniel Hougaard <62331820+DanielHougaard@users.noreply.github.com>
Date: Sat, 23 Dec 2023 15:50:14 +0400
Subject: [PATCH 12/13] Removed FAQ for now
---
docs/sdks/overview.mdx | 37 -------------------------------------
1 file changed, 37 deletions(-)
diff --git a/docs/sdks/overview.mdx b/docs/sdks/overview.mdx
index 3b93a147d..b26330f18 100644
--- a/docs/sdks/overview.mdx
+++ b/docs/sdks/overview.mdx
@@ -31,40 +31,3 @@ From local development to production, Infisical SDKs provide the easiest way for
Manage secrets for your PHP application on demand
-
-## FAQ
-
-
-
- No. Infisical uses end-to-end encryption which ensures that secrets are always encrypted in transit
- and decrypted on the client side. In fact, not even the server can decrypt your secrets (unless
- that permission is explicitly granted from within the platform).
-
- Check out the [security guide](/security/overview).
-
-
- The client SDK caches every secret and implements a 5-minute waiting period before
- re-requesting it. The waiting period can be controlled by setting the `cacheTTL` parameter at
- the time of initializing the client.
-
-
- The SDK caches every secret and falls back to the cached value if a request fails. If no cached
- value ever-existed, the SDK falls back to whatever value is on `process.env`.
-
-
- Yes. If no `token` parameter is passed in at the time of initializing the client or nothing is found when requesting for a secret,
- then the SDK falls back to whatever value is on `process.env`.
-
-
- The token enables the SDK to authenticate with Infisical to fetch back your secrets.
- Although the SDK requires you to pass in a token, it enables greater efficiency and security
- than if you managed dozens of secrets yourself without it. Here're some benefits:
-
- - You always pull in the right secrets because they're fetched on demand from a centralize source that is Infisical.
- - You can use the Infisical which comes with tons of benefits like secret versioning, access controls, audit logs, etc.
- - You now risk leaking one token that can be revoked instead of dozens of raw secrets.
-
- And much more.
-
-
-
From 026864951b2c855995f1f34d6c1d41e84d127729 Mon Sep 17 00:00:00 2001
From: Daniel Hougaard <62331820+DanielHougaard@users.noreply.github.com>
Date: Sat, 23 Dec 2023 15:55:20 +0400
Subject: [PATCH 13/13] Updated links
---
docs/sdks/languages/java.mdx | 2 +-
docs/sdks/languages/node.mdx | 7 ++++---
docs/sdks/languages/python.mdx | 4 ++--
3 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/docs/sdks/languages/java.mdx b/docs/sdks/languages/java.mdx
index 6e59c67f7..a73d1bd09 100644
--- a/docs/sdks/languages/java.mdx
+++ b/docs/sdks/languages/java.mdx
@@ -128,7 +128,7 @@ Retrieve all secrets within the Infisical project and environment that client is
- Whether or not to include imported secrets from the current path. Read about [secret import](/platform/secret-reference)
+ Whether or not to include imported secrets from the current path. Read about [secret import](/documentation/platform/secret-reference)
diff --git a/docs/sdks/languages/node.mdx b/docs/sdks/languages/node.mdx
index 09af6fa57..34cce93ab 100644
--- a/docs/sdks/languages/node.mdx
+++ b/docs/sdks/languages/node.mdx
@@ -46,7 +46,8 @@ app.listen(PORT, async () => {
This example demonstrates how to use the Infisical Node SDK with an Express application. The application retrieves a secret named "NAME" and responds to requests with a greeting that includes the secret value.
- We do not recommend hardcoding your [Machine Identity Tokens](/platform/identities/overview). Setting it as an environment variable would be best.
+ We do not recommend hardcoding your [Machine Identity Tokens](/documentation/platform/identities/overview). Setting it as an environment variable
+ would be best.
## Installation
@@ -59,7 +60,7 @@ $ npm install @infisical/sdk
## Configuration
-Import the SDK and create a client instance with your [Infisical Token](/documentation/platform/token).
+Import the SDK and create a client instance with your [Machine Identity](/documentation/platform/identities/overview).
@@ -143,7 +144,7 @@ Retrieve all secrets within the Infisical project and environment that client is
- Whether or not to include imported secrets from the current path. Read about [secret import](/platform/secret-reference)
+ Whether or not to include imported secrets from the current path. Read about [secret import](/documentation/platform/secret-reference)
diff --git a/docs/sdks/languages/python.mdx b/docs/sdks/languages/python.mdx
index 557642c09..e8c4a90c6 100644
--- a/docs/sdks/languages/python.mdx
+++ b/docs/sdks/languages/python.mdx
@@ -110,7 +110,7 @@ Retrieve all secrets within the Infisical project and environment that client is
- Whether or not to include imported secrets from the current path. Read about [secret import](/platform/secret-reference)
+ Whether or not to include imported secrets from the current path. Read about [secret import](/documentation/platform/secret-reference)
@@ -149,7 +149,7 @@ By default, `getSecret()` fetches and returns a shared secret. If not found, it
The type of the secret. Valid options are "shared" or "personal". If not specified, the default value is "personal".
- Whether or not to include imported secrets from the current path. Read about [secret import](/platform/secret-reference)
+ Whether or not to include imported secrets from the current path. Read about [secret import](/documentation/platform/secret-reference)