Vault | Node.js SDK | General Endpoints
General Endpoints
Delete
delete(id: string): Promise<PangeaResponse<DeleteResult>>Delete a secret or key.
const response = await vault.delete(
"pvi_p6g5i3gtbvqvc3u6zugab6qs6r63tqf5"
);
Get Bulk
getBulk(request: GetBulkRequest): Promise<PangeaResponse<ListResult>>Retrieve a list of secrets, keys and folders.
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.
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.
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.
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.
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,
}
);