diff options
Diffstat (limited to 'src/include/anastasis_database_plugin.h')
-rw-r--r-- | src/include/anastasis_database_plugin.h | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/src/include/anastasis_database_plugin.h b/src/include/anastasis_database_plugin.h index e5012a6..20e87d1 100644 --- a/src/include/anastasis_database_plugin.h +++ b/src/include/anastasis_database_plugin.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of Anastasis | 2 | This file is part of Anastasis |
3 | Copyright (C) 2019-2021 Anastasis SARL | 3 | Copyright (C) 2019-2022 Anastasis SARL |
4 | 4 | ||
5 | Anastasis is free software; you can redistribute it and/or modify it under the | 5 | Anastasis is free software; you can redistribute it and/or modify it under the |
6 | terms of the GNU Affero General Public License as published by the Free Software | 6 | terms of the GNU Affero General Public License as published by the Free Software |
@@ -159,6 +159,24 @@ typedef bool | |||
159 | 159 | ||
160 | 160 | ||
161 | /** | 161 | /** |
162 | * Function called on matching meta data. Note that if the client did | ||
163 | * not provide meta data for @a version, the function will be called | ||
164 | * with @a recovery_meta_data being NULL. | ||
165 | * | ||
166 | * @param cls closure | ||
167 | * @param version the version of the recovery document | ||
168 | * @param recovery_meta_data contains meta data about the encrypted recovery document | ||
169 | * @param recovery_meta_data_size size of @a recovery_meta_data blob | ||
170 | * @return #GNUNET_OK to continue to iterate, #GNUNET_NO to abort iteration | ||
171 | */ | ||
172 | typedef enum GNUNET_GenericReturnValue | ||
173 | (*ANASTASIS_DB_RecoveryMetaCallback)(void *cls, | ||
174 | uint32_t version, | ||
175 | const void *recovery_meta_data, | ||
176 | size_t recovery_meta_data_size); | ||
177 | |||
178 | |||
179 | /** | ||
162 | * Handle to interact with the database. | 180 | * Handle to interact with the database. |
163 | * | 181 | * |
164 | * Functions ending with "_TR" run their OWN transaction scope | 182 | * Functions ending with "_TR" run their OWN transaction scope |
@@ -329,6 +347,8 @@ struct ANASTASIS_DatabasePlugin | |||
329 | * @param recovery_data_hash hash of @a data | 347 | * @param recovery_data_hash hash of @a data |
330 | * @param recovery_data contains encrypted recovery document | 348 | * @param recovery_data contains encrypted recovery document |
331 | * @param recovery_data_size size of @a recovery_data blob | 349 | * @param recovery_data_size size of @a recovery_data blob |
350 | * @param recovery_meta_data contains meta data about the encrypted recovery document | ||
351 | * @param recovery_meta_data_size size of @a recovery_meta_data blob | ||
332 | * @param payment_secret identifier for the payment, used to later charge on uploads | 352 | * @param payment_secret identifier for the payment, used to later charge on uploads |
333 | * @param[out] version set to the version assigned to the document by the database | 353 | * @param[out] version set to the version assigned to the document by the database |
334 | * @return transaction status, 0 if upload could not be finished because @a payment_secret | 354 | * @return transaction status, 0 if upload could not be finished because @a payment_secret |
@@ -342,11 +362,34 @@ struct ANASTASIS_DatabasePlugin | |||
342 | const struct GNUNET_HashCode *recovery_data_hash, | 362 | const struct GNUNET_HashCode *recovery_data_hash, |
343 | const void *recovery_data, | 363 | const void *recovery_data, |
344 | size_t recovery_data_size, | 364 | size_t recovery_data_size, |
365 | const void *recovery_meta_data, | ||
366 | size_t recovery_meta_data_size, | ||
345 | const struct ANASTASIS_PaymentSecretP *payment_secret, | 367 | const struct ANASTASIS_PaymentSecretP *payment_secret, |
346 | uint32_t *version); | 368 | uint32_t *version); |
347 | 369 | ||
348 | 370 | ||
349 | /** | 371 | /** |
372 | * Fetch recovery document meta data for user. Returns | ||
373 | * meta data in descending order from @a max_version. | ||
374 | * The size of the result set may be limited. | ||
375 | * | ||
376 | * @param cls closure | ||
377 | * @param account_pub public key of the user's account | ||
378 | * @param max_version the maximum version number the user requests | ||
379 | * @param cb function to call on each result | ||
380 | * @param cb_cls closure for @a cb | ||
381 | * @return transaction status | ||
382 | */ | ||
383 | enum GNUNET_DB_QueryStatus | ||
384 | (*get_recovery_meta_data)( | ||
385 | void *cls, | ||
386 | const struct ANASTASIS_CRYPTO_AccountPublicKeyP *account_pub, | ||
387 | uint32_t max_version, | ||
388 | ANASTASIS_DB_RecoveryMetaCallback cb, | ||
389 | void *cb_cls); | ||
390 | |||
391 | |||
392 | /** | ||
350 | * Fetch recovery document for user according given version. | 393 | * Fetch recovery document for user according given version. |
351 | * | 394 | * |
352 | * @param cls closure | 395 | * @param cls closure |