|
1 | 1 | #include "apis.h"
|
2 | 2 |
|
3 |
| -// TODO: Generate actual pre shared keys |
4 |
| -static mam_psk_t const psk = { |
5 |
| - .id = {1, 0, -1, -1, 0, -1, -1, 0, 0, 1, -1, 0, 1, 0, 0, 1, 1, |
6 |
| - 1, -1, 1, 1, 0, 1, 1, 0, 0, -1, 1, -1, -1, -1, -1, -1, -1, |
7 |
| - -1, 1, -1, -1, 0, -1, -1, 1, 0, -1, -1, -1, 1, 1, 1, 0, 0, |
8 |
| - -1, 1, -1, -1, -1, 0, -1, 1, -1, -1, -1, 1, 1, -1, 1, 0, 0, |
9 |
| - 1, 1, 1, -1, -1, 0, 0, -1, -1, 1, 0, -1, 1}, |
10 |
| - .key = {-1, 1, -1, -1, 1, -1, -1, 0, 0, 0, -1, -1, 1, 1, 1, -1, -1, |
11 |
| - -1, 0, 0, 0, 0, -1, -1, 1, 1, 1, 0, -1, -1, -1, 0, 0, 0, |
12 |
| - -1, -1, 1, -1, 0, 0, 1, 0, 0, -1, 1, 1, 0, -1, 0, 0, 1, |
13 |
| - -1, 1, 0, 1, 0, 0, -1, 1, 1, -1, 1, 0, -1, 0, -1, 1, -1, |
14 |
| - -1, -1, 0, -1, -1, 0, -1, -1, 0, 0, -1, -1, 1, -1, 0, 0, -1, |
15 |
| - -1, -1, -1, 0, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, 0, 1, |
16 |
| - 0, 1, -1, 0, 0, 1, 0, 1, 0, 0, 1, 0, -1, 0, 1, 1, 0, |
17 |
| - 0, -1, -1, 1, 1, 0, 0, 1, -1, 1, 1, 1, 0, 1, 1, 1, 0, |
18 |
| - 0, -1, -1, -1, -1, 1, 1, 1, 0, 0, -1, 0, 1, -1, 1, 1, 1, |
19 |
| - 0, 0, 1, -1, -1, 0, -1, 1, -1, 1, 0, 0, 1, -1, 0, 1, -1, |
20 |
| - 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, -1, 1, -1, 1, 0, 1, 1, |
21 |
| - 1, -1, 0, 0, -1, 1, 1, 0, -1, -1, 0, 0, -1, 1, 0, 1, -1, |
22 |
| - 0, 0, -1, 1, -1, 1, 1, 1, -1, 0, 1, 1, 0, 0, -1, -1, -1, |
23 |
| - 0, 0, 1, 0, 1, 0, -1, 1, -1, 0, 1, 0, -1, 1, 1, -1, -1, |
24 |
| - 0, 0, -1, 0, -1}}; |
25 |
| - |
26 | 3 | status_t api_get_tips(const iota_client_service_t* const service,
|
27 | 4 | char** json_result) {
|
28 | 5 | status_t ret = SC_OK;
|
@@ -178,7 +155,6 @@ status_t api_receive_mam_message(const iota_client_service_t* const service,
|
178 | 155 | }
|
179 | 156 |
|
180 | 157 | // Set first transaction's address as chid, if no `chid` specified
|
181 |
| - mam_psk_t_set_add(&mam.psks, &psk); |
182 | 158 | iota_transaction_t* curr_tx = (iota_transaction_t*)utarray_eltptr(bundle, 0);
|
183 | 159 | none_chid_trytes = (tryte_t*)malloc(sizeof(tryte_t) * NUM_TRYTES_ADDRESS);
|
184 | 160 | flex_trits_to_trytes(none_chid_trytes, NUM_TRYTES_ADDRESS,
|
@@ -228,7 +204,6 @@ status_t api_mam_send_message(const iota_config_t* const tangle,
|
228 | 204 | mam_api_t mam;
|
229 | 205 | const bool last_packet = true;
|
230 | 206 | bundle_transactions_t* bundle = NULL;
|
231 |
| - mam_psk_t_set_t psks = NULL; |
232 | 207 | bundle_transactions_new(&bundle);
|
233 | 208 | tryte_t channel_id[MAM_CHANNEL_ID_SIZE];
|
234 | 209 | trit_t msg_id[MAM_MSG_ID_SIZE];
|
@@ -256,13 +231,7 @@ status_t api_mam_send_message(const iota_config_t* const tangle,
|
256 | 231 | }
|
257 | 232 |
|
258 | 233 | // Write header and packet
|
259 |
| - if (!mam_psk_t_set_contains(&psks, &psk)) { |
260 |
| - if (mam_psk_t_set_add(&psks, &psk) != RC_OK) { |
261 |
| - ret = SC_MAM_FAILED_WRITE; |
262 |
| - goto done; |
263 |
| - } |
264 |
| - } |
265 |
| - if (mam_api_bundle_write_header_on_channel(&mam, channel_id, psks, NULL, 0, |
| 234 | + if (mam_api_bundle_write_header_on_channel(&mam, channel_id, NULL, NULL, 0, |
266 | 235 | bundle, msg_id) != RC_OK) {
|
267 | 236 | ret = SC_MAM_FAILED_WRITE;
|
268 | 237 | goto done;
|
@@ -292,7 +261,6 @@ status_t api_mam_send_message(const iota_config_t* const tangle,
|
292 | 261 | ret = SC_MAM_FAILED_DESTROYED;
|
293 | 262 | }
|
294 | 263 | }
|
295 |
| - mam_psk_t_set_free(&psks); |
296 | 264 | bundle_transactions_free(&bundle);
|
297 | 265 | send_mam_req_free(&req);
|
298 | 266 | send_mam_res_free(&res);
|
|
0 commit comments