1. Go to this page and download the library: Download onepub/revault-api library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
onepub / revault-api example snippets
evault\Revault;
$runtime = Revault::load();
// Vault, Lockbox, and AgentSession are now ready to use.
$length = $lockbox->withSecretVariable(
'api-token',
function (FFI\CData $token, int $length): int {
// Read token[0] through token[$length - 1] only in this callback.
return $length;
},
);
$agent = Revault::agentSession();
$agent->start();
$agent->cacheLockboxPassword('team-secrets.lbox', $password->bytes(), 30 * 60);
$lockbox = $agent->openLockboxPassword(
'team-secrets.lbox',
$password->bytes(),
);
try {
// Work with the Lockbox handle held by this process.
} finally {
$lockbox->close();
$agent->closeLockbox('team-secrets.lbox');
$agent->close();
}