static CassieqCredentials key( final AccountName accountName, final AccountKey accountKey, final Clock requestClock) { return request -> { final Instant now = requestClock.now(); final SignedRequestSignatureGenerator requestParameters = new SignedRequestSignatureGenerator( accountName, request.method(), request.url().getPath(), now.toDateTime(DateTimeZone.UTC)); final String signature = requestParameters.computeSignature(MacProviders.HmacSha256(accountKey)); final String requestTime = SignatureGenerator.formatDateTime(now); return request .newBuilder() .header("Authorization", "Signed " + signature) .header(StandardAuthHeaders.RequestTime.getHeaderName(), requestTime) .build(); }; }