Project

General

Profile

Actions

Task #12075

closed

Earn Alliance Register kampan

Added by Michal Hornak almost 2 years ago. Updated over 1 year ago.

Status:
Done
Priority:
Normal
Assignee:
Category:
Backend
Target version:
WWW - V3 - integrated custody L10
Start date:
07/10/2023
Due date:
% Done:

100%

Estimated time:
custom category:
Backend
Co-assignee:
Sprint:
#5 summer is here (Jul 03 - Jul 17)

Description

Documentation

https://docs.google.com/document/d/1DRugdiiHMwcQSt4Z9AvDXZ1nep9rjWY3_2dP1Cn2SAA/edit

Credentials

export const EARN_ALLIANCE_SETTINGS = {
  clientId: '46a72344-dc3d-42b9-8372-498666caadb9',
  clientSecret: 'e9hnAaN520e2VbHCN9gUvckXZJntNvq6',
  gameId: 'b2a0d439-414a-4f2d-aa2d-c2eb8fac56ea',
};

JS Example

private callCustomEvent(event: string) {
    const requestBody: EACustomEventRequestBody = {
      gameId: EARN_ALLIANCE_SETTINGS.gameId,
      event: event,
      address: this.walletAddres.value(),
      time: new Date().toISOString(),
    };

    const headers = new HttpHeaders({
      'x-client-id': EARN_ALLIANCE_SETTINGS.clientId,
      'x-timestapm': String(new Date().getMilliseconds()),
      'x-signature': this.generateSignature(requestBody),
    });

    return this.request.post(
      `${this.endpoint}${CUSTOM_EVENT_API}`,
      requestBody,
      { headers }
    );
  }

  private generateSignature(body) {
    const ts = Date.now();
    const message = `${EARN_ALLIANCE_SETTINGS.clientId}${ts}${JSON.stringify(
      body
    )}`;
    return HmacSHA256(message, EARN_ALLIANCE_SETTINGS.clientSecret).toString();
  }
Actions #1

Updated by Michal Hornak almost 2 years ago

Michal Hornak wrote:

https://docs.google.com/document/d/1DRugdiiHMwcQSt4Z9AvDXZ1nep9rjWY3_2dP1Cn2SAA/edit
`
export const EARN_ALLIANCE_SETTINGS = {
clientId: '46a72344-dc3d-42b9-8372-498666caadb9',
clientSecret: 'e9hnAaN520e2VbHCN9gUvckXZJntNvq6',
gameId: 'b2a0d439-414a-4f2d-aa2d-c2eb8fac56ea',
};

private callCustomEvent(event: string) {
const requestBody: EACustomEventRequestBody = {
gameId: EARN_ALLIANCE_SETTINGS.gameId,
event: event,
address: this.walletAddres.value(),
time: new Date().toISOString(),
};

const headers = new HttpHeaders({
  'x-client-id': EARN_ALLIANCE_SETTINGS.clientId,
  'x-timestapm': String(new Date().getMilliseconds()),
  'x-signature': this.generateSignature(requestBody),
});

return this.request.post(
  `${this.endpoint}${CUSTOM_EVENT_API}`,
  requestBody,
  { headers }
);

}

private generateSignature(body) {
const ts = Date.now();
const message = ${EARN_ALLIANCE_SETTINGS.clientId}${ts}${JSON.stringify(
body
)}
;
return HmacSHA256(message, EARN_ALLIANCE_SETTINGS.clientSecret).toString();
}`

Actions #2

Updated by Michal Hornak almost 2 years ago

Michal Hornak wrote:

https://docs.google.com/document/d/1DRugdiiHMwcQSt4Z9AvDXZ1nep9rjWY3_2dP1Cn2SAA/edit

export const EARN_ALLIANCE_SETTINGS = {
clientId: '46a72344-dc3d-42b9-8372-498666caadb9',
clientSecret: 'e9hnAaN520e2VbHCN9gUvckXZJntNvq6',
gameId: 'b2a0d439-414a-4f2d-aa2d-c2eb8fac56ea',
};

private callCustomEvent(event: string) {
const requestBody: EACustomEventRequestBody = {
gameId: EARN_ALLIANCE_SETTINGS.gameId,
event: event,
address: this.walletAddres.value(),
time: new Date().toISOString(),
};

const headers = new HttpHeaders({
  'x-client-id': EARN_ALLIANCE_SETTINGS.clientId,
  'x-timestapm': String(new Date().getMilliseconds()),
  'x-signature': this.generateSignature(requestBody),
});

return this.request.post(
  `${this.endpoint}${CUSTOM_EVENT_API}`,
  requestBody,
  { headers }
);

}

private generateSignature(body) {
const ts = Date.now();
const message =
${EARN_ALLIANCE_SETTINGS.clientId}${ts}${JSON.stringify(
body
)};
return HmacSHA256(message, EARN_ALLIANCE_SETTINGS.clientSecret).toString();
}

Actions #3

Updated by Michal Hornak almost 2 years ago

Michal Hornak wrote:

https://docs.google.com/document/d/1DRugdiiHMwcQSt4Z9AvDXZ1nep9rjWY3_2dP1Cn2SAA/edit

export const EARN_ALLIANCE_SETTINGS = {
clientId: '46a72344-dc3d-42b9-8372-498666caadb9',
clientSecret: 'e9hnAaN520e2VbHCN9gUvckXZJntNvq6',
gameId: 'b2a0d439-414a-4f2d-aa2d-c2eb8fac56ea',
};

private callCustomEvent(event: string) {
const requestBody: EACustomEventRequestBody = {
gameId: EARN_ALLIANCE_SETTINGS.gameId,
event: event,
address: this.walletAddres.value(),
time: new Date().toISOString(),
};

const headers = new HttpHeaders({
  'x-client-id': EARN_ALLIANCE_SETTINGS.clientId,
  'x-timestapm': String(new Date().getMilliseconds()),
  'x-signature': this.generateSignature(requestBody),
});

return this.request.post(
  `${this.endpoint}${CUSTOM_EVENT_API}`,
  requestBody,
  { headers }
);

}

private generateSignature(body) {
const ts = Date.now();
const message = ${EARN_ALLIANCE_SETTINGS.clientId}${ts}${JSON.stringify(
body
)}
;
return HmacSHA256(message, EARN_ALLIANCE_SETTINGS.clientSecret).toString();
}

Actions #4

Updated by Ondrej Grman almost 2 years ago

  • Sprint set to #5 summer is here (Jul 03 - Jul 17)
  • Description updated (diff)
  • Category set to Backend
  • Status changed from New to In Progress
  • Target version set to V3 - integrated custody L10
Actions #5

Updated by Ondrej Grman almost 2 years ago

  • % Done changed from 0 to 90
Actions #6

Updated by Ondrej Grman almost 2 years ago

  • Status changed from In Progress to Testing
  • % Done changed from 90 to 100
Actions #7

Updated by Andrej Ondrejovic over 1 year ago

  • Status changed from Testing to Done
Actions

Also available in: Atom PDF