Skip to main content

Vault | Node.js SDK | Secrets Endpoints

Secrets Endpoints

Secret rotate

secretRotate(request: RotateRequest): Promise<PangeaResponse<RotateResult>>

Rotate a secret.

required parameters

RotateRequest

The following options are supported:

  • id (string): The item ID
  • secret (string): The secret value
  • rotation_state (Vault.ItemVersionState): State to which the previous version should transition upon rotation. Default is deactivated.

Response Object

Promise<PangeaResponse<RotateResult>>
const response = await vault.secretRotate(
  {
    id: "pvi_p6g5i3gtbvqvc3u6zugab6qs6r63tqf5",
    secret: "12sdfgs4543qv@#%$casd",
    rotation_state: Vault.ItemVersionState.DEACTIVATED,
  }
);

Secret store

secretStore(request: StoreRequest): Promise<PangeaResponse<StoreResult>>

Import a secret.

required parameters

StoreRequest

The following options are supported:

  • secret (string): The secret value
  • token (string): The Pangea Token value
  • client_secret (string): The oauth client secret
  • client_id (string): The oauth client ID
  • client_secret_id (string): The oauth client secret ID
  • name (string): The name of this item
  • folder (string): The folder where this item is stored
  • metadata (object): User-provided metadata
  • tags (string[]): A list of user-defined tags
  • rotation_grace_period (string): Grace period for the previous version of the secret
  • rotation_frequency (string): Period of time between item rotations
  • rotation_state (Vault.ItemVersionState): State to which the previous version should transition upon rotation.
  • expiration (string): Expiration timestamp

Response Object

Promise<PangeaResponse<StoreResult>>
const response = await vault.secretStore(
  {
    secret: "12sdfgs4543qv@#%$casd",
    name: "my-very-secret-secret",
    folder: "/personal",
    metadata: {
      "created_by": "John Doe",
      "used_in": "Google products"
    },
    tags: ["irs_2023", "personal"],
    rotation_frequency: "10d",
    rotation_state: Vault.ItemVersionState.DEACTIVATED,
    expiration: "2025-01-01T10:00:00Z",
  }
);