lib/AcmeClient.php
private function requestNonce(string $uri): Promise {
        return call(function () use ($uri) {
            $request = new Request($uri, 'HEAD');

            try {
                /** @var Response $response */
                $response = yield $this->http->request($request, [
                    Client::OP_DISCARD_BODY => true,
                ]);

                if (!$response->hasHeader('replay-nonce')) {
                    throw new AcmeException("HTTP response didn't carry replay-nonce header.");
                }

                return $response->getHeader('replay-nonce');
            } catch (HttpException $e) {
                throw new AcmeException("HEAD request to {$uri} failed, could not obtain a replay nonce: " . $e->getMessage(), null, $e);
            }
        });
    }
private function requestNonce(string $uri): Promise {
        return call(function () use ($uri) {
            $request = new Request($uri, 'HEAD');

            try {
                /** @var Response $response */
                $response = yield $this->http->request($request, [
                    Client::OP_DISCARD_BODY => true,
                ]);

                if (!$response->hasHeader('replay-nonce')) {
                    throw new AcmeException("HTTP response didn't carry replay-nonce header.");
                }

                return $response->getHeader('replay-nonce');
            } catch (HttpException $e) {
                throw new AcmeException("HEAD request to {$uri} failed, could not obtain a replay nonce: " . $e->getMessage(), null, $e);
            }
        });
    }
private function requestNonce ( string $ uri ) : Promise { return call ( function ( ) use ( $ uri ) { $ request = new Request ( $ uri , 'HEAD' ) ; try { /** @var Response $response */ $ response = yield $ this -> http -> request ( $ request , [ Client :: OP_DISCARD_BODY => true , ] ) ; if ( ! $ response -> hasHeader ( 'replay-nonce' ) ) { throw new AcmeException ( "HTTP response didn't carry replay-nonce header." ) ; } return $ response -> getHeader ( 'replay-nonce' ) ; } catch ( HttpException $ e ) { throw new AcmeException ( "HEAD request to {$uri} failed, could not obtain a replay nonce: " . $ e -> getMessage ( ) , null , $ e ) ; } } ) ; }
Requests a new request nonce from the server.

@param string $uri URI to issue the HEAD request against.

@return Promise Resolves to a valid nonce.
Requests a new request nonce from the server .