/**
  * Sign request
  *
  * @param  RequestInterface     $request     Request
  * @param  CredentialsInterface $credentials Credentials
  * @return void
  */
 public function signRequest(OutgoingRequestInterface $request, CredentialsInterface $credentials)
 {
     $request->addParam('key', $credentials->getKey());
     $request->addParam('timestamp', $this->getTimestamp());
     $request->addParam('cnonce', $this->keyGenerator->generateNonce());
     $signature = $this->signature->createSignature($request, $credentials);
     $request->addParam('signature', $signature);
 }
Beispiel #2
0
 /**
  * Creates signature
  *
  * {@inheritDoc}
  */
 public function createSignature(RequestInterface $request, CredentialsInterface $credentials)
 {
     $data = $request->getMethod() . "\n" . $request->getHost() . "\n" . $this->getAbsolutePath($request->getPath()) . "\n" . $this->normalizeParameters($request->getParams());
     return \base64_encode(\hash_hmac('sha256', $data, $credentials->getSecret(), true));
 }