aboutsummaryrefslogtreecommitdiff
path: root/src/testing/testing_api_trait_account_pub.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/testing_api_trait_account_pub.c')
-rw-r--r--src/testing/testing_api_trait_account_pub.c72
1 files changed, 72 insertions, 0 deletions
diff --git a/src/testing/testing_api_trait_account_pub.c b/src/testing/testing_api_trait_account_pub.c
new file mode 100644
index 0000000..5a3632e
--- /dev/null
+++ b/src/testing/testing_api_trait_account_pub.c
@@ -0,0 +1,72 @@
1/*
2 This file is part of TALER
3 Copyright (C) 2019 Taler Systems SA
4
5 TALER is free software; you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 TALER is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public
16 License along with TALER; see the file COPYING. If not, see
17 <http://www.gnu.org/licenses/>
18*/
19/**
20 * @file lib/testing_api_trait_account_pub.c
21 * @brief traits to offer a account_pub
22 * @author Christian Grothoff
23 */
24#include "platform.h"
25#include "anastasis_testing_lib.h"
26
27#define ANASTASIS_TESTING_TRAIT_ACCOUNT_PUB "anastasis-account_pub"
28
29
30/**
31 * Obtain an account public key from @a cmd.
32 *
33 * @param cmd command to extract the public key from.
34 * @param index the public key's index number.
35 * @param n[out] set to the public key coming from @a cmd.
36 * @return #GNUNET_OK on success.
37 */
38int
39ANASTASIS_TESTING_get_trait_account_pub
40 (const struct TALER_TESTING_Command *cmd,
41 unsigned int index,
42 const struct ANASTASIS_CRYPTO_AccountPublicKeyP **pub)
43{
44 return cmd->traits (cmd->cls,
45 (const void **) pub,
46 ANASTASIS_TESTING_TRAIT_ACCOUNT_PUB,
47 index);
48}
49
50
51/**
52 * Offer an account public key.
53 *
54 * @param index usually zero
55 * @param h the account_pub to offer.
56 * @return #GNUNET_OK on success.
57 */
58struct TALER_TESTING_Trait
59ANASTASIS_TESTING_make_trait_account_pub
60 (unsigned int index,
61 const struct ANASTASIS_CRYPTO_AccountPublicKeyP *h)
62{
63 struct TALER_TESTING_Trait ret = {
64 .index = index,
65 .trait_name = ANASTASIS_TESTING_TRAIT_ACCOUNT_PUB,
66 .ptr = (const void *) h
67 };
68 return ret;
69}
70
71
72/* end of testing_api_trait_account_pub.c */