This is the String that will then be signed at the next step

For the String creation the following headers (request-target) host digest date must be used.

  • For the header field name (request-target) generate the header field value by concatenating the lowercased HTTP verb, a space and the request path

  • For the remaining headers create the string by concatenating the lowercased header field name followed with a colon :, a space and the header field value

🚧

Notes

  • Leading and trailing optional whitespace in the header field value must be omitted

  • Make sure that the order of the headers in the HTTP request is the same used to create the String

  • Request path in the (request-target) must include the QUERY PARAMS

  • The format of the date header must be EEE, dd MMM yyyy HH:mm:ss O

  • If there are multiple instances of the same header field, all header field values associated with the header field must be concatenated, separated by a comma , and a space and be used in the order in which they will appear in the transmitted HTTP message

POST /wally-services/protocol/tests/signature HTTP/1.1
Host: staging.authservices.satispay.com
Date: Mon, 18 Mar 2019 15:10:24 +0000
Content-Type: application/json
Content-Length: 123
Digest: SHA-256=ZML76UQPYzw5yDTmhySnU1S8nmqGde/jhqOG5rpfVSI=
{
  "flow": "MATCH_CODE",
  "amount_unit": 100,
  "currency": "EUR"
}
(request-target): post /wally-services/protocol/tests/signature
host: staging.authservices.satispay.com
date: Mon, 18 Mar 2019 15:10:24 +0000
digest: SHA-256=ZML76UQPYzw5yDTmhySnU1S8nmqGde/jhqOG5rpfVSI=

Code sample 2/4

BODY="{\n  \"flow\": \"MATCH_CODE\",\n  \"amount_unit\": 100,\n  \"currency\": \"EUR\"\n}"

DIGEST=$(echo -e "$BODY\c" | openssl dgst -sha256 -binary | base64)

STRING="(request-target): post /wally-services/protocol/tests/signature\nhost: staging.authservices.satispay.com\ndate: Mon, 18 Mar 2019 15:10:24 +0000\ndigest: SHA-256=$DIGEST"
$body = "{
  \"flow\": \"MATCH_CODE\",
  \"amount_unit\": 100,
  \"currency\": \"EUR\"
}";

$digest = base64_encode(hash("sha256", $body, true));

$string = "(request-target): post /wally-services/protocol/tests/signature
host: staging.authservices.satispay.com
date: Mon, 18 Mar 2019 15:10:24 +0000
digest: SHA-256=$digest";
const crypto = require('crypto')

const body = `{
  "flow": "MATCH_CODE",
  "amount_unit": 100,
  "currency": "EUR"
}`

const digest = crypto.createHash('sha256').update(body).digest('base64')

const string = `(request-target): post /wally-services/protocol/tests/signature
host: staging.authservices.satispay.com
date: Mon, 18 Mar 2019 15:10:24 +0000
digest: SHA-256=${digest}`