use GuzzleHttp\HandlerStack;
use Jasny\HttpDigest\HttpDigest;
use Jasny\HttpDigest\ClientMiddleware as DigestMiddleware;
use Jasny\HttpDigest\Negitiation\DigestNegotiator;
use Jasny\HttpSignature\HttpSignature;
use Jasny\HttpSignature\ClientMiddleware as SignatureMiddleware;
$secretKey = 'wJ4WH8dD88fSkNdFQRjaAhjFUZzZhV5yiDLDwNUnp6bYwRXrvWV8MJhQ9HL9uqMDG1n7XpTGZx7PafqaayQV8Rp';
$factory = new LTO\AccountFactory('T'); // 'T' for testnet, 'L' for mainnet
$ourAccount = $factory->create($secretKey);
$digestService = HttpDigest(new DigestNegotiator(), ["SHA-256"]);
$signatureService = new HttpSignature(
['ed25519', 'ed25519-sha256'],
new SignCallback($ourAccount),
function() { throw new \LogicException('verify not supported'); }
$signatureMiddleware = new SignatureMiddleware(
$service->withAlgorithm('ed25519-sha256'),
$ourAccount->getPublicKey()
$stack = new HandlerStack();
$stack->push((new DigestMiddleware($digestService))->forGuzzle());
$stack->push($signatureMiddleware->forGuzzle());
$client = new Client(['handler' => $stack]);