public LunoAPIImpl(String key, String secret, String uri, ClientConfig clientConfig) { luno = RestProxyFactory.createProxy(LunoAuthenticated.class, uri, clientConfig); auth = new BasicAuthCredentials(key, secret); }
byte[] hash = mac.doFinal(signature.getBytes()); BasicAuthCredentials auth = new BasicAuthCredentials(apiKey, LakeBTCUtil.bytesToHex(hash));
@Override public String digestParams(RestInvocation restInvocation) { String tonce = restInvocation.getHttpHeadersFromParams().get("Json-Rpc-Tonce"); LakeBTCRequest request = null; for (Object param : restInvocation.getUnannanotatedParams()) { if (param instanceof LakeBTCRequest) { request = (LakeBTCRequest) param; } } if (request == null) { throw new IllegalArgumentException("No LakeBTCDigest found."); } final long id = request.getId(); final String method = request.getRequestMethod(); final String params = ""; //stripParams(request.getParams()); String signature = String.format("tonce=%s&accesskey=%s&requestmethod=%s&id=%d&method=%s¶ms=%s", tonce, clientId, method, id, request.getMethod(), params); log.debug("signature message: {}", signature); Mac mac = getMac(); byte[] hash = mac.doFinal(signature.getBytes()); BasicAuthCredentials auth = new BasicAuthCredentials(apiKey, LakeBTCUtil.bytesToHex(hash)); return auth.digestParams(restInvocation); }
@Override public String digestParams(RestInvocation restInvocation) { String tonce = restInvocation.getHttpHeadersFromParams().get("Json-Rpc-Tonce"); BTCChinaRequest request = null; for (Object param : restInvocation.getUnannanotatedParams()) { if (param instanceof BTCChinaRequest) { request = (BTCChinaRequest) param; } } if (request == null) { throw new IllegalArgumentException("No BTCChinaRequest found."); } final long id = request.getId(); final String method = request.getMethod(); final String params = stripParams(request.getParams()); String signature = String.format("tonce=%s&accesskey=%s&requestmethod=%s&id=%d&method=%s¶ms=%s", tonce, exchangeAccessKey, "post", id, method, params); log.debug("signature message: {}", signature); Mac mac = getMac(); byte[] hash = mac.doFinal(signature.getBytes()); BasicAuthCredentials auth = new BasicAuthCredentials(exchangeAccessKey, BTCChinaUtils.bytesToHex(hash)); return auth.digestParams(restInvocation); }