Offboarding
Exporting Data from Piiano Vault to Another System
Your data is yours. Piiano offers two methods to export all your data from the Vault, allowing you to use it in other storage systems.
- Built-in Export: utilize the built-in export CLI command along with a decryption tool to securely export and decrypt your data.
- Custom Iteration: use the CLI or API to iterate through all objects and tokens, saving them in a format compatible with your preferred storage system.
Built-in Export
Piiano Vault provides a CLI command, pvault export
, which allows you to export all your data securely.
Prerequisites
Before exporting, you must set an environment variable to specify the encryption key that will be used to generate the export archive. If you are using the hosted version, contact Piiano support for assistance with this setup. For detailed instructions on configuring the environment and understanding the archive structure, refer to the Export Data Guide.
Using the Export CLI
After configuring the necessary keys, initiate the data export using the export CLI command. The export includes:
- All collection schemas
- All collection object data
- Token data
- IAM configuration
- All data types and bundles
You can choose to include archived objects or exclude specific items from the export, depending on your requirements.
The export archive consists of multiple JSON
files. In these files:
JSON
keys and non-sensitive data are stored in clear text.- All other data is encrypted for security.
To obtain a decrypted version of your data, you must use a decryption tool provided by Piiano. This tool transforms the encrypted data into clear text, using the encryption key configured in the prerequisites step.
Iterate and Save
If you need more control over the data format and are comfortable writing custom scripts, you can use the CLI or API to iterate through all objects and tokens, saving them in a format of your choice. Although this method requires more effort, it allows you to tailor the output to be compatible with your target storage systems.
Iterating Through All Objects
The following example demonstrates how to iterate through all objects. It has been simplified to just use a single thread and output the read objects to STDOUT. Modify this example to save the objects in your desired format:
import { VaultClient } from '@piiano/vault-client';
const client = new VaultClient({
vaultURL: 'https://vault.example.com:8123',
apiKey: 'vaultApiKey',
});
let cursor: string | undefined = undefined;
let hasMore = true;
while (hasMore) {
const response = await client.objects.listObjects({
collection: "Persons",
reason: "AppFunctionality",
pageSize: 100,
options: ["unsafe"],
cursor: cursor,
});
console.log(response.results);
cursor = response.paging?.cursor;
hasMore = !!cursor;
}
Iterating all tokens
When replacing the client.objects.listObjects
with the client.tokens.listTokens()
function in the previous code example, it would work for tokens in the same manner.