Merge pull request #13 from Infisical/daniel/view-secret-permission
feat: add view secret value parameter to get/list secrets
This commit is contained in:
22
README.md
22
README.md
@@ -109,9 +109,10 @@ const allSecrets = await client.secrets().listSecrets({
|
|||||||
environment: "dev",
|
environment: "dev",
|
||||||
projectId: "<your-project-id>",
|
projectId: "<your-project-id>",
|
||||||
expandSecretReferences: true,
|
expandSecretReferences: true,
|
||||||
|
viewSecretValue: true,
|
||||||
includeImports: false,
|
includeImports: false,
|
||||||
recursive: false,
|
recursive: false,
|
||||||
secretPath: "/foo/bar"
|
secretPath: "/foo/bar",
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -119,10 +120,11 @@ const allSecrets = await client.secrets().listSecrets({
|
|||||||
- `projectId` (string): The ID of your project.
|
- `projectId` (string): The ID of your project.
|
||||||
- `environment` (string): The environment in which to list secrets (e.g., "dev").
|
- `environment` (string): The environment in which to list secrets (e.g., "dev").
|
||||||
- `secretPath` (str): The path to the secrets.
|
- `secretPath` (str): The path to the secrets.
|
||||||
- `expandSecretReferences` (bool): Whether to expand secret references.
|
- `expandSecretReferences` (bool, optional): Whether to expand secret references.
|
||||||
- `recursive` (bool): Whether to list secrets recursively.
|
- `viewSecretValue` (bool, optional): Whether or not to reveal the secret value of the secrets. If set to `false`, the `secretValue` is masked with `<hidden-by-infisical>`. Defaults to `true`.
|
||||||
- `includeImports` (bool): Whether to include imported secrets.
|
- `recursive` (bool, optional): Whether to list secrets recursively.
|
||||||
- `tagFilters` (string[]): Tags to filter secrets.
|
- `includeImports` (bool, optional): Whether to include imported secrets.
|
||||||
|
- `tagFilters` (string[], optional): Tags to filter secrets.
|
||||||
|
|
||||||
**Returns:**
|
**Returns:**
|
||||||
- `ApiV3SecretsRawGet200Response`: The response containing the list of secrets.
|
- `ApiV3SecretsRawGet200Response`: The response containing the list of secrets.
|
||||||
@@ -136,6 +138,7 @@ const allSecrets = await client.secrets().listSecretsWithImports({
|
|||||||
environment: "dev",
|
environment: "dev",
|
||||||
projectId: "<your-project-id>",
|
projectId: "<your-project-id>",
|
||||||
expandSecretReferences: true,
|
expandSecretReferences: true,
|
||||||
|
viewSecretValue: true,
|
||||||
recursive: false,
|
recursive: false,
|
||||||
secretPath: "/foo/bar"
|
secretPath: "/foo/bar"
|
||||||
});
|
});
|
||||||
@@ -145,9 +148,10 @@ const allSecrets = await client.secrets().listSecretsWithImports({
|
|||||||
- `projectId` (string): The ID of your project.
|
- `projectId` (string): The ID of your project.
|
||||||
- `environment` (string): The environment in which to list secrets (e.g., "dev").
|
- `environment` (string): The environment in which to list secrets (e.g., "dev").
|
||||||
- `secretPath` (str): The path to the secrets.
|
- `secretPath` (str): The path to the secrets.
|
||||||
- `expandSecretReferences` (bool): Whether to expand secret references.
|
- `expandSecretReferences` (bool, optional): Whether to expand secret references.
|
||||||
- `recursive` (bool): Whether to list secrets recursively.
|
- `viewSecretValue` (bool, optional): Whether or not to reveal the secret value of the secrets. If set to `false`, the `secretValue` is masked with `<hidden-by-infisical>`. Defaults to `true`.
|
||||||
- `tagFilters` (string[]): Tags to filter secrets.
|
- `recursive` (bool, optional): Whether to list secrets recursively.
|
||||||
|
- `tagFilters` (string[], optional): Tags to filter secrets.
|
||||||
|
|
||||||
**Returns:**
|
**Returns:**
|
||||||
- `ApiV1DashboardSecretsOverviewGet200ResponseSecretsInner`: The response containing the list of secrets, with imports.
|
- `ApiV1DashboardSecretsOverviewGet200ResponseSecretsInner`: The response containing the list of secrets, with imports.
|
||||||
@@ -236,6 +240,7 @@ const updatedSecret = await client.secrets().updateSecret("SECRET_TO_UPDATE", {
|
|||||||
projectId: "<your-project-id>",
|
projectId: "<your-project-id>",
|
||||||
secretName: "DATABASE_URL",
|
secretName: "DATABASE_URL",
|
||||||
expandSecretReferences: true, // Optional
|
expandSecretReferences: true, // Optional
|
||||||
|
viewSecretValue: true, // Optional
|
||||||
includeImports: true, // Optional
|
includeImports: true, // Optional
|
||||||
secretPath: "/foo/bar", // Optional
|
secretPath: "/foo/bar", // Optional
|
||||||
type: "shared", // Optional
|
type: "shared", // Optional
|
||||||
@@ -249,6 +254,7 @@ const updatedSecret = await client.secrets().updateSecret("SECRET_TO_UPDATE", {
|
|||||||
- `secretName` (str): The name of the secret.
|
- `secretName` (str): The name of the secret.
|
||||||
- `secretPath` (str, optional): The path to the secret.
|
- `secretPath` (str, optional): The path to the secret.
|
||||||
- `expandSecretReferences` (bool, optional): Whether to expand secret references.
|
- `expandSecretReferences` (bool, optional): Whether to expand secret references.
|
||||||
|
- `viewSecretValue` (bool, optional): Whether or not to reveal the secret value of the secret. If set to `false`, the `secretValue` is masked with `<hidden-by-infisical>`. Defaults to `true`.
|
||||||
- `includeImports` (bool): Whether to include imported secrets.
|
- `includeImports` (bool): Whether to include imported secrets.
|
||||||
- `version` (str, optional): The version of the secret to retrieve. Fetches the latest by default.
|
- `version` (str, optional): The version of the secret to retrieve. Fetches the latest by default.
|
||||||
- `type` (personal | shared, optional): The type of secret to fetch.
|
- `type` (personal | shared, optional): The type of secret to fetch.
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ type ListSecretsOptions = {
|
|||||||
recursive?: boolean;
|
recursive?: boolean;
|
||||||
secretPath?: string;
|
secretPath?: string;
|
||||||
tagSlugs?: string[];
|
tagSlugs?: string[];
|
||||||
|
viewSecretValue?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
type GetSecretOptions = {
|
type GetSecretOptions = {
|
||||||
@@ -32,6 +33,7 @@ type GetSecretOptions = {
|
|||||||
type?: SecretType;
|
type?: SecretType;
|
||||||
version?: number;
|
version?: number;
|
||||||
projectId: string;
|
projectId: string;
|
||||||
|
viewSecretValue?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type UpdateSecretOptions = Omit<DefaultApiApiV3SecretsRawSecretNamePatchRequest["apiV3SecretsRawSecretNamePatchRequest"], "workspaceId"> & {
|
export type UpdateSecretOptions = Omit<DefaultApiApiV3SecretsRawSecretNamePatchRequest["apiV3SecretsRawSecretNamePatchRequest"], "workspaceId"> & {
|
||||||
@@ -73,6 +75,7 @@ export default class SecretsClient {
|
|||||||
try {
|
try {
|
||||||
const res = await this.#apiInstance.apiV3SecretsRawGet(
|
const res = await this.#apiInstance.apiV3SecretsRawGet(
|
||||||
{
|
{
|
||||||
|
viewSecretValue: convertBool(options.viewSecretValue ?? true),
|
||||||
environment: options.environment,
|
environment: options.environment,
|
||||||
workspaceId: options.projectId,
|
workspaceId: options.projectId,
|
||||||
expandSecretReferences: convertBool(defaultBoolean(options.expandSecretReferences, true)),
|
expandSecretReferences: convertBool(defaultBoolean(options.expandSecretReferences, true)),
|
||||||
@@ -129,6 +132,7 @@ export default class SecretsClient {
|
|||||||
try {
|
try {
|
||||||
const res = await this.#apiInstance.apiV3SecretsRawSecretNameGet(
|
const res = await this.#apiInstance.apiV3SecretsRawSecretNameGet(
|
||||||
{
|
{
|
||||||
|
viewSecretValue: convertBool(options.viewSecretValue ?? true),
|
||||||
environment: options.environment,
|
environment: options.environment,
|
||||||
secretName: options.secretName,
|
secretName: options.secretName,
|
||||||
workspaceId: options.projectId,
|
workspaceId: options.projectId,
|
||||||
|
|||||||
Reference in New Issue
Block a user