Represents an encrypted object stored by Vault.
const object = { id: 'secret_51B0AC67C2FB4247AC5ABDDD3C701BDC', metadata: { id: 'secret_51B0AC67C2FB4247AC5ABDDD3C701BDC', environmentId: 'environment_example_23456789', context: { organization_id: 'org_01EHZNVPK3SFK441A1RGBFSHRT', }, keyId: 'e2084ada-50c1-5f9a-b1c7-fa868d506e5a', updatedAt: '2025-02-21T12:04:09.165291Z', updatedBy: { id: 'user_01E4ZCR3C56J083X43JQXF3JK5', name: 'Marcelina Davis', }, versionId: 'Wq49AmJIR7QI0kSwfY9BZ6vNsOq6AO_X', }, name: 'secret-name', value: 'my secret value', };
interface ObjectCreate a new object, encrypted with the key(s) matching the provided key context.
import { WorkOS } from '@workos-inc/node'; const workos = new WorkOS('sk_example_123456789'); await workos.vault.createObject({ name: 'secret-name', value: 'my secret value', context: { organizationId: 'org_01EHZNVPK3SFK441A1RGBFSHRT' }, });
vault .createObject()Parameters objectReturns Get an existing object. The stored value will be decrypted and returned.
import { WorkOS } from '@workos-inc/node'; const workos = new WorkOS('sk_example_123456789'); await workos.vault.readObject({ id: 'secret_51B0AC67C2FB4247AC5ABDDD3C701BDC', });
Get an existing object by its name. The stored value will be decrypted and returned.
import { WorkOS } from '@workos-inc/node'; const workos = new WorkOS('sk_example_123456789'); await workos.vault.readObjectByName('my-secret-name');
Update the value for an object. The key context of the original object will be used to encrypt the new data.
import { WorkOS } from '@workos-inc/node'; const workos = new WorkOS('sk_example_123456789'); await workos.vault.updateObject({ id: 'secret_51B0AC67C2FB4247AC5ABDDD3C701BDC', value: 'new value', versionCheck: 'Wq49AmJIR7QI0kSwfY9BZ6vNsOq6AO_X', });
Retrieve metadata about an object. The value itself is not returned.
import { WorkOS } from '@workos-inc/node'; const workos = new WorkOS('sk_example_123456789'); await workos.vault.describeObject({ id: 'secret_51B0AC67C2FB4247AC5ABDDD3C701BDC', });
Get list of object names stored in Vault.
import { WorkOS } from '@workos-inc/node'; const workos = new WorkOS('sk_example_123456789'); await workos.vault.listObjects();
vault .listObjects()Parameters objectReturns objectPermanently delete an object.
import { WorkOS } from '@workos-inc/node'; const workos = new WorkOS('sk_example_123456789'); await workos.vault.deleteObject({ id: 'secret_51B0AC67C2FB4247AC5ABDDD3C701BDC', });
vault .deleteObject()Parameters objectReturns Represents a static version of an object stored by Vault.
const objectVersion = { createdAt: '2025-02-21T12:04:09.165291Z', currentVersion: true, etag: '"62b747b941ceefd67dacc026724044e4"', id: 'Wq49AmJIR7QI0kSwfY9BZ6vNsOq6AO_X', size: 271, };
Get list of versions for an object stored in Vault.
import { WorkOS } from '@workos-inc/node'; const workos = new WorkOS('sk_example_123456789'); await workos.vault.listObjectVersions({ id: 'secret_51B0AC67C2FB4247AC5ABDDD3C701BDC', });
vault .listObjectVersions()Parameters objectReturns object