public HttpRequest signed(HttpRequest.Builder request, Method method, Supplier<InputStream> data) {
        try {
            String timestamp = clock.instant().toString();
            String contentHash = Base64.getEncoder().encodeToString(sha256Digest(data::get));
            byte[] canonicalMessage = Signatures.canonicalMessageOf(method.name(), request.copy().build().uri(), timestamp, contentHash);
            signer.update(canonicalMessage);
            String signature = Base64.getEncoder().encodeToString(signer.sign());

            request.setHeader("X-Timestamp", timestamp);
            request.setHeader("X-Content-Hash", contentHash);
            request.setHeader("X-Key-Id", keyId);
            request.setHeader("X-Key", base64PemPublicKey);
            request.setHeader("X-Authorization", signature);

            request.method(method.name(), HttpRequest.BodyPublishers.ofInputStream(data));
            return request.build();
        }
        catch (SignatureException e) {
            throw new IllegalArgumentException(e);
        }
    }
Completes, signs and returns the given request builder and data.<br>
<br>
The request builder's method and data are set to the given arguments, and a hash of the
content is computed and added to a header, together with other meta data, like the URI
of the request, the current UTC time, and the id and value of the public key which shall
be used to * verify this signature.
Finally, a signature is computed from these fields, based on the private key of this, and
added to the request as another header.
hosted-api/src/main/java/ai/vespa/hosted/api/RequestSigner.java