aboutsummaryrefslogtreecommitdiff
path: root/src/stasis/plugin_anastasis_postgres.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stasis/plugin_anastasis_postgres.c')
-rw-r--r--src/stasis/plugin_anastasis_postgres.c101
1 files changed, 50 insertions, 51 deletions
diff --git a/src/stasis/plugin_anastasis_postgres.c b/src/stasis/plugin_anastasis_postgres.c
index 0ece276..0915d24 100644
--- a/src/stasis/plugin_anastasis_postgres.c
+++ b/src/stasis/plugin_anastasis_postgres.c
@@ -96,7 +96,7 @@ postgres_drop_tables (void *cls)
96/** 96/**
97 * Check that the database connection is still up. 97 * Check that the database connection is still up.
98 * 98 *
99 * @param pg connection to check 99 * @param cls a `struct PostgresClosure` with connection to check
100 */ 100 */
101static void 101static void
102check_connection (void *cls) 102check_connection (void *cls)
@@ -271,11 +271,11 @@ postgres_gc (void *cls,
271 * Store encrypted recovery document. 271 * Store encrypted recovery document.
272 * 272 *
273 * @param cls closure 273 * @param cls closure
274 * @param anastasis_pub public key of the user's account 274 * @param account_pub public key of the user's account
275 * @param account_sig signature affirming storage request 275 * @param account_sig signature affirming storage request
276 * @param data_hash hash of @a data 276 * @param recovery_data_hash hash of @a data
277 * @param data contains encrypted_recovery_document 277 * @param recovery_data contains encrypted_recovery_document
278 * @param data_size size of data blob 278 * @param recovery_data_size size of data blob
279 * @param payment_secret identifier for the payment, used to later charge on uploads 279 * @param payment_secret identifier for the payment, used to later charge on uploads
280 * @param[out] version set to the version assigned to the document by the database 280 * @param[out] version set to the version assigned to the document by the database
281 * @return transaction status, 0 if upload could not be finished because @a payment_secret 281 * @return transaction status, 0 if upload could not be finished because @a payment_secret
@@ -284,7 +284,7 @@ postgres_gc (void *cls,
284static enum ANASTASIS_DB_StoreStatus 284static enum ANASTASIS_DB_StoreStatus
285postgres_store_recovery_document ( 285postgres_store_recovery_document (
286 void *cls, 286 void *cls,
287 const struct ANASTASIS_CRYPTO_AccountPublicKeyP *anastasis_pub, 287 const struct ANASTASIS_CRYPTO_AccountPublicKeyP *account_pub,
288 const struct ANASTASIS_AccountSignatureP *account_sig, 288 const struct ANASTASIS_AccountSignatureP *account_sig,
289 const struct GNUNET_HashCode *recovery_data_hash, 289 const struct GNUNET_HashCode *recovery_data_hash,
290 const void *recovery_data, 290 const void *recovery_data,
@@ -311,7 +311,7 @@ postgres_store_recovery_document (
311 { 311 {
312 struct GNUNET_HashCode dh; 312 struct GNUNET_HashCode dh;
313 struct GNUNET_PQ_QueryParam params[] = { 313 struct GNUNET_PQ_QueryParam params[] = {
314 GNUNET_PQ_query_param_auto_from_type (anastasis_pub), 314 GNUNET_PQ_query_param_auto_from_type (account_pub),
315 GNUNET_PQ_query_param_end 315 GNUNET_PQ_query_param_end
316 }; 316 };
317 struct GNUNET_PQ_ResultSpec rs[] = { 317 struct GNUNET_PQ_ResultSpec rs[] = {
@@ -358,7 +358,7 @@ postgres_store_recovery_document (
358 /* First, check if account exists */ 358 /* First, check if account exists */
359 { 359 {
360 struct GNUNET_PQ_QueryParam params[] = { 360 struct GNUNET_PQ_QueryParam params[] = {
361 GNUNET_PQ_query_param_auto_from_type (anastasis_pub), 361 GNUNET_PQ_query_param_auto_from_type (account_pub),
362 GNUNET_PQ_query_param_end 362 GNUNET_PQ_query_param_end
363 }; 363 };
364 struct GNUNET_PQ_ResultSpec rs[] = { 364 struct GNUNET_PQ_ResultSpec rs[] = {
@@ -391,7 +391,7 @@ postgres_store_recovery_document (
391 /* lookup if the user has enough uploads left and decrement */ 391 /* lookup if the user has enough uploads left and decrement */
392 { 392 {
393 struct GNUNET_PQ_QueryParam params[] = { 393 struct GNUNET_PQ_QueryParam params[] = {
394 GNUNET_PQ_query_param_auto_from_type (anastasis_pub), 394 GNUNET_PQ_query_param_auto_from_type (account_pub),
395 GNUNET_PQ_query_param_auto_from_type (payment_secret), 395 GNUNET_PQ_query_param_auto_from_type (payment_secret),
396 GNUNET_PQ_query_param_end 396 GNUNET_PQ_query_param_end
397 }; 397 };
@@ -432,7 +432,7 @@ postgres_store_recovery_document (
432 { 432 {
433 struct GNUNET_PQ_QueryParam params[] = { 433 struct GNUNET_PQ_QueryParam params[] = {
434 GNUNET_PQ_query_param_uint32 (&postcounter), 434 GNUNET_PQ_query_param_uint32 (&postcounter),
435 GNUNET_PQ_query_param_auto_from_type (anastasis_pub), 435 GNUNET_PQ_query_param_auto_from_type (account_pub),
436 GNUNET_PQ_query_param_auto_from_type (payment_secret), 436 GNUNET_PQ_query_param_auto_from_type (payment_secret),
437 GNUNET_PQ_query_param_end 437 GNUNET_PQ_query_param_end
438 }; 438 };
@@ -465,7 +465,7 @@ postgres_store_recovery_document (
465 /* finally, actually insert the recovery document */ 465 /* finally, actually insert the recovery document */
466 { 466 {
467 struct GNUNET_PQ_QueryParam params[] = { 467 struct GNUNET_PQ_QueryParam params[] = {
468 GNUNET_PQ_query_param_auto_from_type (anastasis_pub), 468 GNUNET_PQ_query_param_auto_from_type (account_pub),
469 GNUNET_PQ_query_param_uint32 (version), 469 GNUNET_PQ_query_param_uint32 (version),
470 GNUNET_PQ_query_param_auto_from_type (account_sig), 470 GNUNET_PQ_query_param_auto_from_type (account_sig),
471 GNUNET_PQ_query_param_auto_from_type (recovery_data_hash), 471 GNUNET_PQ_query_param_auto_from_type (recovery_data_hash),
@@ -508,7 +508,7 @@ retry:
508 * Increment account lifetime. 508 * Increment account lifetime.
509 * 509 *
510 * @param cls closure 510 * @param cls closure
511 * @param anastasis_pub which account received a payment 511 * @param account_pub which account received a payment
512 * @param payment_identifier proof of payment, must be unique and match pending payment 512 * @param payment_identifier proof of payment, must be unique and match pending payment
513 * @param lifetime for how long is the account now paid (increment) 513 * @param lifetime for how long is the account now paid (increment)
514 * @param[out] paid_until set to the end of the lifetime after the operation 514 * @param[out] paid_until set to the end of the lifetime after the operation
@@ -517,7 +517,7 @@ retry:
517static enum GNUNET_DB_QueryStatus 517static enum GNUNET_DB_QueryStatus
518postgres_increment_lifetime ( 518postgres_increment_lifetime (
519 void *cls, 519 void *cls,
520 const struct ANASTASIS_CRYPTO_AccountPublicKeyP *anastasis_pub, 520 const struct ANASTASIS_CRYPTO_AccountPublicKeyP *account_pub,
521 const struct ANASTASIS_PaymentSecretP *payment_identifier, 521 const struct ANASTASIS_PaymentSecretP *payment_identifier,
522 struct GNUNET_TIME_Relative lifetime, 522 struct GNUNET_TIME_Relative lifetime,
523 struct GNUNET_TIME_Absolute *paid_until) 523 struct GNUNET_TIME_Absolute *paid_until)
@@ -539,7 +539,7 @@ postgres_increment_lifetime (
539 { 539 {
540 struct GNUNET_PQ_QueryParam params[] = { 540 struct GNUNET_PQ_QueryParam params[] = {
541 GNUNET_PQ_query_param_auto_from_type (payment_identifier), 541 GNUNET_PQ_query_param_auto_from_type (payment_identifier),
542 GNUNET_PQ_query_param_auto_from_type (anastasis_pub), 542 GNUNET_PQ_query_param_auto_from_type (account_pub),
543 GNUNET_PQ_query_param_end 543 GNUNET_PQ_query_param_end
544 }; 544 };
545 qs = GNUNET_PQ_eval_prepared_non_select (pg->conn, 545 qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
@@ -565,7 +565,7 @@ postgres_increment_lifetime (
565 { 565 {
566 enum GNUNET_DB_QueryStatus qs2; 566 enum GNUNET_DB_QueryStatus qs2;
567 struct GNUNET_PQ_QueryParam params[] = { 567 struct GNUNET_PQ_QueryParam params[] = {
568 GNUNET_PQ_query_param_auto_from_type (anastasis_pub), 568 GNUNET_PQ_query_param_auto_from_type (account_pub),
569 GNUNET_PQ_query_param_end 569 GNUNET_PQ_query_param_end
570 }; 570 };
571 struct GNUNET_TIME_Absolute expiration; 571 struct GNUNET_TIME_Absolute expiration;
@@ -598,7 +598,7 @@ postgres_increment_lifetime (
598 { 598 {
599 /* user does not exist, create new one */ 599 /* user does not exist, create new one */
600 struct GNUNET_PQ_QueryParam params[] = { 600 struct GNUNET_PQ_QueryParam params[] = {
601 GNUNET_PQ_query_param_auto_from_type (anastasis_pub), 601 GNUNET_PQ_query_param_auto_from_type (account_pub),
602 GNUNET_PQ_query_param_absolute_time (&expiration), 602 GNUNET_PQ_query_param_absolute_time (&expiration),
603 GNUNET_PQ_query_param_end 603 GNUNET_PQ_query_param_end
604 }; 604 };
@@ -620,7 +620,7 @@ postgres_increment_lifetime (
620 rollback (pg); 620 rollback (pg);
621 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 621 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
622 "Payment existed, lifetime of account %s unchanged at %s\n", 622 "Payment existed, lifetime of account %s unchanged at %s\n",
623 TALER_B2S (anastasis_pub), 623 TALER_B2S (account_pub),
624 GNUNET_STRINGS_absolute_time_to_string (*paid_until)); 624 GNUNET_STRINGS_absolute_time_to_string (*paid_until));
625 return GNUNET_DB_STATUS_SUCCESS_NO_RESULTS; 625 return GNUNET_DB_STATUS_SUCCESS_NO_RESULTS;
626 } 626 }
@@ -629,7 +629,7 @@ postgres_increment_lifetime (
629 /* user exists, update expiration_date */ 629 /* user exists, update expiration_date */
630 struct GNUNET_PQ_QueryParam params[] = { 630 struct GNUNET_PQ_QueryParam params[] = {
631 GNUNET_PQ_query_param_absolute_time (&expiration), 631 GNUNET_PQ_query_param_absolute_time (&expiration),
632 GNUNET_PQ_query_param_auto_from_type (anastasis_pub), 632 GNUNET_PQ_query_param_auto_from_type (account_pub),
633 GNUNET_PQ_query_param_end 633 GNUNET_PQ_query_param_end
634 }; 634 };
635 635
@@ -667,7 +667,7 @@ postgres_increment_lifetime (
667 return GNUNET_DB_STATUS_HARD_ERROR; 667 return GNUNET_DB_STATUS_HARD_ERROR;
668 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 668 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
669 "Incremented lifetime of account %s to %s\n", 669 "Incremented lifetime of account %s to %s\n",
670 TALER_B2S (anastasis_pub), 670 TALER_B2S (account_pub),
671 GNUNET_STRINGS_absolute_time_to_string (*paid_until)); 671 GNUNET_STRINGS_absolute_time_to_string (*paid_until));
672 return GNUNET_DB_STATUS_SUCCESS_ONE_RESULT; 672 return GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
673retry: 673retry:
@@ -690,7 +690,7 @@ retry:
690static enum GNUNET_DB_QueryStatus 690static enum GNUNET_DB_QueryStatus
691postgres_update_lifetime ( 691postgres_update_lifetime (
692 void *cls, 692 void *cls,
693 const struct ANASTASIS_CRYPTO_AccountPublicKeyP *anastasis_pub, 693 const struct ANASTASIS_CRYPTO_AccountPublicKeyP *account_pub,
694 const struct ANASTASIS_PaymentSecretP *payment_identifier, 694 const struct ANASTASIS_PaymentSecretP *payment_identifier,
695 struct GNUNET_TIME_Absolute eol) 695 struct GNUNET_TIME_Absolute eol)
696{ 696{
@@ -711,7 +711,7 @@ postgres_update_lifetime (
711 { 711 {
712 struct GNUNET_PQ_QueryParam params[] = { 712 struct GNUNET_PQ_QueryParam params[] = {
713 GNUNET_PQ_query_param_auto_from_type (payment_identifier), 713 GNUNET_PQ_query_param_auto_from_type (payment_identifier),
714 GNUNET_PQ_query_param_auto_from_type (anastasis_pub), 714 GNUNET_PQ_query_param_auto_from_type (account_pub),
715 GNUNET_PQ_query_param_end 715 GNUNET_PQ_query_param_end
716 }; 716 };
717 qs = GNUNET_PQ_eval_prepared_non_select (pg->conn, 717 qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
@@ -726,14 +726,14 @@ postgres_update_lifetime (
726 rollback (pg); 726 rollback (pg);
727 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 727 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
728 "Payment existed, lifetime of account %s unchanged\n", 728 "Payment existed, lifetime of account %s unchanged\n",
729 TALER_B2S (anastasis_pub)); 729 TALER_B2S (account_pub));
730 return qs; 730 return qs;
731 } 731 }
732 } 732 }
733 733
734 { 734 {
735 struct GNUNET_PQ_QueryParam params[] = { 735 struct GNUNET_PQ_QueryParam params[] = {
736 GNUNET_PQ_query_param_auto_from_type (anastasis_pub), 736 GNUNET_PQ_query_param_auto_from_type (account_pub),
737 GNUNET_PQ_query_param_end 737 GNUNET_PQ_query_param_end
738 }; 738 };
739 struct GNUNET_TIME_Absolute expiration; 739 struct GNUNET_TIME_Absolute expiration;
@@ -758,7 +758,7 @@ postgres_update_lifetime (
758 { 758 {
759 /* user does not exist, create new one */ 759 /* user does not exist, create new one */
760 struct GNUNET_PQ_QueryParam params[] = { 760 struct GNUNET_PQ_QueryParam params[] = {
761 GNUNET_PQ_query_param_auto_from_type (anastasis_pub), 761 GNUNET_PQ_query_param_auto_from_type (account_pub),
762 GNUNET_PQ_query_param_absolute_time (&eol), 762 GNUNET_PQ_query_param_absolute_time (&eol),
763 GNUNET_PQ_query_param_end 763 GNUNET_PQ_query_param_end
764 }; 764 };
@@ -770,7 +770,7 @@ postgres_update_lifetime (
770 params); 770 params);
771 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 771 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
772 "Created new account %s with expiration %s\n", 772 "Created new account %s with expiration %s\n",
773 TALER_B2S (anastasis_pub), 773 TALER_B2S (account_pub),
774 GNUNET_STRINGS_absolute_time_to_string (eol)); 774 GNUNET_STRINGS_absolute_time_to_string (eol));
775 } 775 }
776 break; 776 break;
@@ -779,7 +779,7 @@ postgres_update_lifetime (
779 /* user exists, update expiration_date */ 779 /* user exists, update expiration_date */
780 struct GNUNET_PQ_QueryParam params[] = { 780 struct GNUNET_PQ_QueryParam params[] = {
781 GNUNET_PQ_query_param_absolute_time (&expiration), 781 GNUNET_PQ_query_param_absolute_time (&expiration),
782 GNUNET_PQ_query_param_auto_from_type (anastasis_pub), 782 GNUNET_PQ_query_param_auto_from_type (account_pub),
783 GNUNET_PQ_query_param_end 783 GNUNET_PQ_query_param_end
784 }; 784 };
785 785
@@ -792,7 +792,7 @@ postgres_update_lifetime (
792 params); 792 params);
793 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 793 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
794 "Updated account %s to new expiration %s\n", 794 "Updated account %s to new expiration %s\n",
795 TALER_B2S (anastasis_pub), 795 TALER_B2S (account_pub),
796 GNUNET_STRINGS_absolute_time_to_string (expiration)); 796 GNUNET_STRINGS_absolute_time_to_string (expiration));
797 } 797 }
798 break; 798 break;
@@ -832,7 +832,7 @@ retry:
832 * when we increment the account's lifetime.) 832 * when we increment the account's lifetime.)
833 * 833 *
834 * @param cls closure 834 * @param cls closure
835 * @param anastasis_pub anastasis's public key 835 * @param account_pub anastasis's public key
836 * @param post_counter how many uploads does @a amount pay for 836 * @param post_counter how many uploads does @a amount pay for
837 * @param payment_secret payment secret which the user must provide with every upload 837 * @param payment_secret payment secret which the user must provide with every upload
838 * @param amount how much we asked for 838 * @param amount how much we asked for
@@ -841,7 +841,7 @@ retry:
841static enum GNUNET_DB_QueryStatus 841static enum GNUNET_DB_QueryStatus
842postgres_record_recdoc_payment ( 842postgres_record_recdoc_payment (
843 void *cls, 843 void *cls,
844 const struct ANASTASIS_CRYPTO_AccountPublicKeyP *anastasis_pub, 844 const struct ANASTASIS_CRYPTO_AccountPublicKeyP *account_pub,
845 uint32_t post_counter, 845 uint32_t post_counter,
846 const struct ANASTASIS_PaymentSecretP *payment_secret, 846 const struct ANASTASIS_PaymentSecretP *payment_secret,
847 const struct TALER_Amount *amount) 847 const struct TALER_Amount *amount)
@@ -850,7 +850,7 @@ postgres_record_recdoc_payment (
850 struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); 850 struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
851 struct GNUNET_TIME_Absolute expiration; 851 struct GNUNET_TIME_Absolute expiration;
852 struct GNUNET_PQ_QueryParam params[] = { 852 struct GNUNET_PQ_QueryParam params[] = {
853 GNUNET_PQ_query_param_auto_from_type (anastasis_pub), 853 GNUNET_PQ_query_param_auto_from_type (account_pub),
854 GNUNET_PQ_query_param_uint32 (&post_counter), 854 GNUNET_PQ_query_param_uint32 (&post_counter),
855 TALER_PQ_query_param_amount (amount), 855 TALER_PQ_query_param_amount (amount),
856 GNUNET_PQ_query_param_auto_from_type (payment_secret), 856 GNUNET_PQ_query_param_auto_from_type (payment_secret),
@@ -866,7 +866,7 @@ postgres_record_recdoc_payment (
866 if user exists, and if not, create one */ 866 if user exists, and if not, create one */
867 { 867 {
868 struct GNUNET_PQ_QueryParam params[] = { 868 struct GNUNET_PQ_QueryParam params[] = {
869 GNUNET_PQ_query_param_auto_from_type (anastasis_pub), 869 GNUNET_PQ_query_param_auto_from_type (account_pub),
870 GNUNET_PQ_query_param_end 870 GNUNET_PQ_query_param_end
871 }; 871 };
872 struct GNUNET_PQ_ResultSpec rs[] = { 872 struct GNUNET_PQ_ResultSpec rs[] = {
@@ -893,7 +893,7 @@ postgres_record_recdoc_payment (
893 struct GNUNET_TIME_Absolute exp 893 struct GNUNET_TIME_Absolute exp
894 = GNUNET_TIME_relative_to_absolute (TRANSIENT_LIFETIME); 894 = GNUNET_TIME_relative_to_absolute (TRANSIENT_LIFETIME);
895 struct GNUNET_PQ_QueryParam params[] = { 895 struct GNUNET_PQ_QueryParam params[] = {
896 GNUNET_PQ_query_param_auto_from_type (anastasis_pub), 896 GNUNET_PQ_query_param_auto_from_type (account_pub),
897 GNUNET_PQ_query_param_absolute_time (&exp), 897 GNUNET_PQ_query_param_absolute_time (&exp),
898 GNUNET_PQ_query_param_end 898 GNUNET_PQ_query_param_end
899 }; 899 };
@@ -915,7 +915,7 @@ postgres_record_recdoc_payment (
915 /* successful, continue below */ 915 /* successful, continue below */
916 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 916 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
917 "Created new account %s with transient life until %s\n", 917 "Created new account %s with transient life until %s\n",
918 TALER_B2S (anastasis_pub), 918 TALER_B2S (account_pub),
919 GNUNET_STRINGS_absolute_time_to_string (exp)); 919 GNUNET_STRINGS_absolute_time_to_string (exp));
920 break; 920 break;
921 } 921 }
@@ -1004,7 +1004,7 @@ postgres_check_truth_upload_paid (
1004 * Store payment for challenge. 1004 * Store payment for challenge.
1005 * 1005 *
1006 * @param cls closure 1006 * @param cls closure
1007 * @param truth_key identifier of the challenge to pay 1007 * @param truth_uuid identifier of the challenge to pay
1008 * @param payment_secret payment secret which the user must provide with every upload 1008 * @param payment_secret payment secret which the user must provide with every upload
1009 * @param amount how much we asked for 1009 * @param amount how much we asked for
1010 * @return transaction status 1010 * @return transaction status
@@ -1037,7 +1037,7 @@ postgres_record_challenge_payment (
1037 * Store refund granted for challenge. 1037 * Store refund granted for challenge.
1038 * 1038 *
1039 * @param cls closure 1039 * @param cls closure
1040 * @param truth_key identifier of the challenge to pay 1040 * @param truth_uuid identifier of the challenge to refund
1041 * @param payment_secret payment secret which the user must provide with every upload 1041 * @param payment_secret payment secret which the user must provide with every upload
1042 * @return transaction status 1042 * @return transaction status
1043 */ 1043 */
@@ -1067,8 +1067,8 @@ postgres_record_challenge_refund (
1067 * 1067 *
1068 * @param cls closure 1068 * @param cls closure
1069 * @param payment_secret payment secret which the user must provide with every upload 1069 * @param payment_secret payment secret which the user must provide with every upload
1070 * @param truth_uuid which truth should we check the payment status of
1070 * @param[out] paid bool value to show if payment is paid 1071 * @param[out] paid bool value to show if payment is paid
1071 * @param[out] valid_counter bool value to show if post_counter is > 0
1072 * @return transaction status 1072 * @return transaction status
1073 */ 1073 */
1074static enum GNUNET_DB_QueryStatus 1074static enum GNUNET_DB_QueryStatus
@@ -1159,11 +1159,10 @@ postgres_check_payment_identifier (
1159 * @param cls closure 1159 * @param cls closure
1160 * @param truth_uuid the identifier for the Truth 1160 * @param truth_uuid the identifier for the Truth
1161 * @param key_share_data contains information of an EncryptedKeyShare 1161 * @param key_share_data contains information of an EncryptedKeyShare
1162 * @param method name of method 1162 * @param mime_type presumed mime type of data in @a encrypted_truth
1163 * @param nonce nonce used to compute encryption key for encrypted_truth
1164 * @param aes_gcm_tag authentication tag of encrypted_truth
1165 * @param encrypted_truth contains the encrypted Truth which includes the ground truth i.e. H(challenge answer), phonenumber, SMS 1163 * @param encrypted_truth contains the encrypted Truth which includes the ground truth i.e. H(challenge answer), phonenumber, SMS
1166 * @param encrypted_truth_size the size of the Truth 1164 * @param encrypted_truth_size the size of the Truth
1165 * @param method name of method
1167 * @param truth_expiration time till the according data will be stored 1166 * @param truth_expiration time till the according data will be stored
1168 * @return transaction status 1167 * @return transaction status
1169 */ 1168 */
@@ -1284,7 +1283,7 @@ postgres_get_key_share (
1284 * current @a recovery_document_hash. 1283 * current @a recovery_document_hash.
1285 * 1284 *
1286 * @param cls closure 1285 * @param cls closure
1287 * @param anastasis_pub account identifier 1286 * @param account_pub account identifier
1288 * @param[out] paid_until until when is the account paid up? 1287 * @param[out] paid_until until when is the account paid up?
1289 * @param[out] recovery_data_hash set to hash of @a recovery document 1288 * @param[out] recovery_data_hash set to hash of @a recovery document
1290 * @param[out] version set to the recovery policy version 1289 * @param[out] version set to the recovery policy version
@@ -1293,14 +1292,14 @@ postgres_get_key_share (
1293enum ANASTASIS_DB_AccountStatus 1292enum ANASTASIS_DB_AccountStatus
1294postgres_lookup_account ( 1293postgres_lookup_account (
1295 void *cls, 1294 void *cls,
1296 const struct ANASTASIS_CRYPTO_AccountPublicKeyP *anastasis_pub, 1295 const struct ANASTASIS_CRYPTO_AccountPublicKeyP *account_pub,
1297 struct GNUNET_TIME_Absolute *paid_until, 1296 struct GNUNET_TIME_Absolute *paid_until,
1298 struct GNUNET_HashCode *recovery_data_hash, 1297 struct GNUNET_HashCode *recovery_data_hash,
1299 uint32_t *version) 1298 uint32_t *version)
1300{ 1299{
1301 struct PostgresClosure *pg = cls; 1300 struct PostgresClosure *pg = cls;
1302 struct GNUNET_PQ_QueryParam params[] = { 1301 struct GNUNET_PQ_QueryParam params[] = {
1303 GNUNET_PQ_query_param_auto_from_type (anastasis_pub), 1302 GNUNET_PQ_query_param_auto_from_type (account_pub),
1304 GNUNET_PQ_query_param_end 1303 GNUNET_PQ_query_param_end
1305 }; 1304 };
1306 enum GNUNET_DB_QueryStatus qs; 1305 enum GNUNET_DB_QueryStatus qs;
@@ -1377,18 +1376,18 @@ postgres_lookup_account (
1377 * Fetch latest recovery document for user. 1376 * Fetch latest recovery document for user.
1378 * 1377 *
1379 * @param cls closure 1378 * @param cls closure
1380 * @param anastasis_pub public key of the user's account 1379 * @param account_pub public key of the user's account
1381 * @param account_sig signature 1380 * @param account_sig signature
1382 * @param recovery_data_hash hash of the current recovery data 1381 * @param recovery_data_hash hash of the current recovery data
1383 * @param data_size size of data blob 1382 * @param data_size size of data blob
1384 * @param data blob which contains the recovery document 1383 * @param data blob which contains the recovery document
1385 * @param version[OUT] set to the version number of the policy being returned 1384 * @param[out] version set to the version number of the policy being returned
1386 * @return transaction status 1385 * @return transaction status
1387 */ 1386 */
1388enum GNUNET_DB_QueryStatus 1387enum GNUNET_DB_QueryStatus
1389postgres_get_latest_recovery_document ( 1388postgres_get_latest_recovery_document (
1390 void *cls, 1389 void *cls,
1391 const struct ANASTASIS_CRYPTO_AccountPublicKeyP *anastasis_pub, 1390 const struct ANASTASIS_CRYPTO_AccountPublicKeyP *account_pub,
1392 struct ANASTASIS_AccountSignatureP *account_sig, 1391 struct ANASTASIS_AccountSignatureP *account_sig,
1393 struct GNUNET_HashCode *recovery_data_hash, 1392 struct GNUNET_HashCode *recovery_data_hash,
1394 size_t *data_size, 1393 size_t *data_size,
@@ -1397,7 +1396,7 @@ postgres_get_latest_recovery_document (
1397{ 1396{
1398 struct PostgresClosure *pg = cls; 1397 struct PostgresClosure *pg = cls;
1399 struct GNUNET_PQ_QueryParam params[] = { 1398 struct GNUNET_PQ_QueryParam params[] = {
1400 GNUNET_PQ_query_param_auto_from_type (anastasis_pub), 1399 GNUNET_PQ_query_param_auto_from_type (account_pub),
1401 GNUNET_PQ_query_param_end 1400 GNUNET_PQ_query_param_end
1402 }; 1401 };
1403 struct GNUNET_PQ_ResultSpec rs[] = { 1402 struct GNUNET_PQ_ResultSpec rs[] = {
@@ -1426,7 +1425,7 @@ postgres_get_latest_recovery_document (
1426 * Fetch recovery document for user according given version. 1425 * Fetch recovery document for user according given version.
1427 * 1426 *
1428 * @param cls closure 1427 * @param cls closure
1429 * @param anastasis_pub public key of the user's account 1428 * @param account_pub public key of the user's account
1430 * @param version the version number of the policy the user requests 1429 * @param version the version number of the policy the user requests
1431 * @param[out] account_sig signature 1430 * @param[out] account_sig signature
1432 * @param[out] recovery_data_hash hash of the current recovery data 1431 * @param[out] recovery_data_hash hash of the current recovery data
@@ -1437,7 +1436,7 @@ postgres_get_latest_recovery_document (
1437enum GNUNET_DB_QueryStatus 1436enum GNUNET_DB_QueryStatus
1438postgres_get_recovery_document ( 1437postgres_get_recovery_document (
1439 void *cls, 1438 void *cls,
1440 const struct ANASTASIS_CRYPTO_AccountPublicKeyP *anastasis_pub, 1439 const struct ANASTASIS_CRYPTO_AccountPublicKeyP *account_pub,
1441 uint32_t version, 1440 uint32_t version,
1442 struct ANASTASIS_AccountSignatureP *account_sig, 1441 struct ANASTASIS_AccountSignatureP *account_sig,
1443 struct GNUNET_HashCode *recovery_data_hash, 1442 struct GNUNET_HashCode *recovery_data_hash,
@@ -1446,7 +1445,7 @@ postgres_get_recovery_document (
1446{ 1445{
1447 struct PostgresClosure *pg = cls; 1446 struct PostgresClosure *pg = cls;
1448 struct GNUNET_PQ_QueryParam params[] = { 1447 struct GNUNET_PQ_QueryParam params[] = {
1449 GNUNET_PQ_query_param_auto_from_type (anastasis_pub), 1448 GNUNET_PQ_query_param_auto_from_type (account_pub),
1450 GNUNET_PQ_query_param_uint32 (&version), 1449 GNUNET_PQ_query_param_uint32 (&version),
1451 GNUNET_PQ_query_param_end 1450 GNUNET_PQ_query_param_end
1452 }; 1451 };
@@ -1509,7 +1508,7 @@ struct CheckValidityContext
1509 * 1508 *
1510 * @param cls closure of type `struct CheckValidityContext *` 1509 * @param cls closure of type `struct CheckValidityContext *`
1511 * @param result the postgres result 1510 * @param result the postgres result
1512 * @param num_result the number of results in @a result 1511 * @param num_results the number of results in @a result
1513 */ 1512 */
1514static void 1513static void
1515check_valid_code (void *cls, 1514check_valid_code (void *cls,
@@ -1578,7 +1577,7 @@ check_valid_code (void *cls,
1578 * does not match, the retry counter will be decreased by one. 1577 * does not match, the retry counter will be decreased by one.
1579 * 1578 *
1580 * @param cls closure 1579 * @param cls closure
1581 * @param truth_pub identification of the challenge which the code corresponds to 1580 * @param truth_uuid identification of the challenge which the code corresponds to
1582 * @param hashed_code code which the user provided and wants to verify 1581 * @param hashed_code code which the user provided and wants to verify
1583 * @return code validity status 1582 * @return code validity status
1584 */ 1583 */