Skip to main content

Vault | Node.js SDK | General Endpoints

General Endpoints

Delete

delete(id: string): Promise<PangeaResponse<DeleteResult>>

Delete a secret or key.

required parameters

string

The item ID

Response Object

Promise<PangeaResponse<DeleteResult>>
const response = await vault.delete(
  "pvi_p6g5i3gtbvqvc3u6zugab6qs6r63tqf5"
);

Get Bulk

getBulk(request: GetBulkRequest): Promise<PangeaResponse<ListResult>>

Retrieve a list of secrets, keys and folders.

required parameters

GetBulkRequest

The following options are supported:

  • filter (object): A set of filters to help you customize your search. Examples: "folder": "/tmp", "tags": "personal", "name__contains": "xxx", "created_at__gt": "2020-02-05T10:00:00Z" For metadata, use: "metadata_": "<value>"
  • last (string): Internal ID returned in the previous look up response. Used for pagination.
  • order: (Vault.ItemOrder): Ordering direction
  • order_by: (Vault.ItemOrderBy): Property used to order the results
  • size: (number): Maximum number of items in the response

Response Object

Promise<PangeaResponse<ListResult>>
const response = await vault.getBulk(
  {
    filter: {
      folder: "/",
      type: "asymmetric_key",
      name__contains: "test",
      metadata_key1: "value1",
      created_at__lt: "2023-12-12T00:00:00Z",
    },
    last: "WyIvdGVzdF8yMDdfc3ltbWV0cmljLyJd",
    order: Vault.ItemOrder.ASC,
    order_by: Vault.ItemOrderby.NAME,
    size=20,
  }
);

Retrieve

getItem(request: GetRequest): Promise<PangeaResponse<GetResult>>

Retrieve a secret or key, and any associated information.

required parameters

GetRequest

The following options are supported:

  • id (string): The item ID
  • version (number | string): The key version(s). all for all versions, num for a specific version, -num for the num latest versions.
  • version_state (Vault.ItemVersionState): The state of the item version
  • verbose (boolean): Return metadata and extra fields

Response Object

Promise<PangeaResponse<GetResult>>
const response = await vault.getItem(
  {
    id: "pvi_p6g5i3gtbvqvc3u6zugab6qs6r63tqf5",
    version: 1,
    version_state: Vault.ItemVersionState.ACTIVE,
    verbose: true,
  }
);

List

list(request: ListRequest): Promise<PangeaResponse<ListResult>>

Look up a list of secrets, keys and folders, and their associated information.

required parameters

ListRequest

The following options are supported:

  • filter (object): A set of filters to help you customize your search. Examples: "folder": "/tmp", "tags": "personal", "name__contains": "xxx", "created_at__gt": "2020-02-05T10:00:00Z" For metadata, use: "metadata_": "<value>"
  • last (string): Internal ID returned in the previous look up response. Used for pagination.
  • order: (Vault.ItemOrder): Ordering direction
  • order_by: (Vault.ItemOrderBy): Property used to order the results
  • size: (number): Maximum number of items in the response

Response Object

Promise<PangeaResponse<ListResult>>
const response = await vault.list(
  {
    filter: {
      folder: "/",
      type: "asymmetric_key",
      name__contains: "test",
      metadata_key1: "value1",
      created_at__lt: "2023-12-12T00:00:00Z",
    },
    last: "WyIvdGVzdF8yMDdfc3ltbWV0cmljLyJd",
    order: Vault.ItemOrder.ASC,
    order_by: Vault.ItemOrderby.NAME,
    size=20,
  }
);

State change

stateChange(request: StateChangeRequest): Promise<PangeaResponse<StateChangeResult>>

Change the state of a specific version of a secret or key.

required parameters

StateChangeRequest

State change options. The following options are supported:

  • id (string): The item ID
  • state (Vault.ItemVersionState): The new state of the item version
  • version (number): the item version
  • destroy_period (string): Period of time for the destruction of a compromised key. Only valid if state=compromised

Response Object

Promise<PangeaResponse<StateChangeResult>>
const response = await vault.stateChange( {
  id: "pvi_p6g5i3gtbvqvc3u6zugab6qs6r63tqf5",
  state: Vault.ItemVersionState.DEACTIVATED
});

Update

update(request: UpdateRequest): Promise<PangeaResponse<UpdateResult>>

Update information associated with a secret or key.

required parameters

UpdateRequest

The following options are supported:

  • id (string): The item ID
  • name (string): The name of this item
  • folder (string): The folder where this item is stored
  • metadata (object): User-provided metadata
  • tags (string[], optional): A list of user-defined tags
  • rotation_frequency (string): Period of time between item rotations
  • rotation_state (Vault.ItemVersionState): State to which the previous version should transition upon rotation.
  • rotation_grace_period (string): Grace period for the previous version of the Pangea Token
  • expiration (string): Expiration timestamp
  • item_state (string): The new state of the item.

Response Object

Promise<PangeaResponse<UpdateResult>>
const response = await vault.update(
  {
    id: "pvi_p6g5i3gtbvqvc3u6zugab6qs6r63tqf5",
    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,
    rotation_grace_period: "1d",
    expiration: "2025-01-01T10:00:00Z",
    item_state: Vault.ItemState.DISABLED,
  }
);