Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Callback documentation & event status #17

Closed
evd0kim opened this issue Mar 9, 2024 · 1 comment
Closed

Callback documentation & event status #17

evd0kim opened this issue Mar 9, 2024 · 1 comment

Comments

@evd0kim
Copy link
Contributor

evd0kim commented Mar 9, 2024

  1. Documentation in README.md does not correspond to actual endpoints in Swagger
  2. Service returns {'error_message': None, 'status': 'Ok'} on the submitted event, but it (actually they) keeps appearing in the list of events

If /mark should somehow let the service know that the event was processed, then this is a bug. If events should be provided on every /events call then disregard this report besides documentation issues.

@evd0kim
Copy link
Contributor Author

evd0kim commented Oct 3, 2024

Also closing as not confirmed.

If somebody has issues with processing events please use these scripts as examples for debugging.

Getting event:

#!/usr/bin/env bash

host=http://0.0.0.0:8080
secret=
api_key=

function timestamp_ms {
  date +%s000
}

function create_signature() {
  stringToSign="$1"
  echo -en "$stringToSign" | openssl sha256 -hmac "$secret" -binary | base64
}

uri="/ton/v3/events/id/712150b7-16b0-4002-b961-cbd164a5ac64"
timestamp=$(timestamp_ms)
stringToSign="$timestamp$uri"
signature=$(create_signature "$stringToSign")

curl --location --request GET "$host$uri" \
  --header 'Content-Type: application/json' \
  --header "api-key: $api_key" \
  --header "timestamp: $timestamp" \
  --header "sign: $signature" | jq

Marking event as processed:

!/usr/bin/env bash

host=http://0.0.0.0:8080
secret=
api_key=

function timestamp_ms {
  date +%s000
}

function create_signature() {
  stringToSign="$1"
  echo -en "$stringToSign" | openssl sha256 -hmac "$secret" -binary | base64
}

uri="/ton/v3/events/mark"

body='{"id": ""}'
body=$(echo "$body" | jq --indent 4 -r --arg id "712150b7-16b0-4002-b961-cbd164a5ac64" '.id = $id')

timestamp=$(timestamp_ms)
stringToSign="$timestamp$uri$body"
signature=$(create_signature "$stringToSign")

echo $stringToSign
echo $signature

curl --location --request POST "$host$uri" \
  --header 'Content-Type: application/json' \
  --header "api-key: $api_key" \
  --header "timestamp: $timestamp" \
  --header "sign: $signature" \
  --data-raw "$body" | jq

@evd0kim evd0kim closed this as completed Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant