PHP code example of alrayyes / hush-hush
1. Go to this page and download the library: Download alrayyes/hush-hush 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/ */
alrayyes / hush-hush example snippets
use HushHush\Client;
$client = new Client('https://hush-hush.example.com', 'your-api-key'); // or set HUSH_HUSH_API_KEY
// Create is a write operation — it needs the credential above.
$client->createObject('my-first-secret', 'already-sealed-ciphertext');
// Get needs no credential — hush-hush's confidentiality boundary is
// "who holds a matching private key," not who's calling this endpoint.
$value = $client->getObject('my-first-secret');
echo 'got ' . strlen($value) . " bytes of sealed ciphertext\n";
// The audit log records every read and write; querying it needs no
// credential either, and returns the full matching result set (there's
// no pagination on this endpoint).
foreach ($client->queryAuditLog() as $entry) {
echo $entry->getAction() . ' ' . $entry->getObjectId() . ' ' . $entry->getTimestamp()->format(DATE_ATOM) . "\n";
}